The HMC Beelab's hives, set up with an Arnia scale (left) and an Eyes on Hives camera (right).
Beekeepers around the world, concerned about the health of their hives, are turning to technology to help them monitor key indicators of health, such as hive weight and activity. Here in the bee lab, (after experimenting with some homemade solutions) we decided to try out the Arnia hive monitoring system. The system was acquired by the bee lab because of its impressive sensor array consisting of an outside temperature sensor, a brood temperature sensor, a humidity sensor and a scale to weigh the hive. With this array of data we were hoping to deploy the system to monitor hive health as we performed experiments to interrupt the communication of the hive and discover how it reacts. The main goal was to measure hive weight to see the difference in weight gain (i.e. how much nectar they gather, minus what they use) between an actively communicating hive and one which was inhibited.
The data display screen, showing Arnia’s sharp-looking user interface.
Unfortunately we have not been able to do much with it yet, due to a number of setbacks with the system. Arnia at first sent us a defective scale; it took us about a month of troubleshooting to identify the faulty part and send it back to them. Besides the hardware issues, while their software is impressively put together with a sharp-looking UI and data graphing features that allow for researchers to quickly and easily visualize their data, it lacks a web API. The lack of an API makes it impossible to automate tasks like running models on the data or integrating it with other data sources. Applications for this tool could be running daily models on data or creating interactive data tools that automatically update. This problem I have been able to remedy and will describe below.
Dependencies:
To automatically download the hive data, I used Selenium, a python web crawler library that allows clients to navigate the web automatically as if they were clicking and typing themselves. I used Selenium in this case to navigate through Arnia’s website to download the sensor data file. The code first opens Arnia's website and is presented with a login dialog; it then enters the login credentials provided and then loads the next page. Once the page is loaded the script navigates to the requested hive, opens the hive information and then requests it to download the data. The function that accomplishes all this is called GetArniaData, and takes in the arguments HiveName (the name or number of your hive), accountName (your account name provided by Arnia), user (your username provided by Arnia) and password.
The Arnia Login dialog. GetArniaData inputs login credentials and then clicks the submit button.

The Arnia home screen. The function selects the scale you choose (in this view there is only one choice).
The data display screen. The function navigates here, clicks the blue download button on the bottom right, selects the scale associated with the scale number you choose and then selects sensor data.
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
def GetArniaData(HiveName, accountName, user, passwordAccount):
""" Will take in Hive name and use selenium to navigate to the hive data and downloadButton
the csvs this uses the chrome webdriver make sure you have the varibles configured
corrently
also note that the PATH varible does not update unless you restart your command line
"""
driver = webdriver.Chrome()
driver.get("http://server.arnia.co.uk/")#navigate to web page
account = driver.find_element_by_name("acc")
account.clear()
account.send_keys(accountName)#enter acount name
userName= driver.find_element_by_name("usr")
userName.clear()
userName.send_keys(user)#enter user name
password = driver.find_element_by_name("psw")
password.clear()
password.send_keys(passwordAccount)#enter password
submitButton = driver.find_element_by_name("sbm")
submitButton.click()
time.sleep(6)#wait for next page to load
hive = driver.find_element_by_id("brood_temp_" + HiveName)#navigate to hive
hive.click()
downloadButton = driver.find_element_by_id("download_tongue")#navigate to download button
downloadButton.click()
time.sleep(3)#load page update
Scale = driver.find_element_by_id("csv_monitor_container_" + HiveName)#select scale
Scale.click()
SensorData = driver.find_element_by_id("csv_type_combined")#select data type
SensorData.click()
Download = driver.find_element_by_id("download_csv")
Download.submit()
stay = input("Do you want to stay on page? y/n")
if stay == "n":
driver.close()
#Free use just give credit to HMC Bee lab and Alasdair Johnson
The hardest part of this process is downloading the chrome web driver. Simply go to the link, download the files and add the extracted file locations to your path variable. Oracle provides a nice tutorial for many different operating systems clearly showing users how to set path variables.
The above code will automatically log onto the Arnia website and download the sensor data. The Arnia system provides the raw analog readings from the sensors alongside the sensor readings converted into their respective values (for example, temperature data comes in an analog form and as degrees Celsius). The system also has a microphone that records audio of the hives, and Arnia supplies us with spectrum data directly from the microphone. Modifications to this code could be made to download spectrum data (spectrum data is the raw data coming from the microphone on Arnia’s system). To modify the code find the lines associated with selecting sensor data and change them to reflect the container name for the spectrum. Once the file is downloaded it is in a .csv format, which can be parsed by any scientific programming language, such as python, R, etc.
On the whole we found that once the Arnia system works correctly it seems like a promising tool for bee researchers. Arnia originally sent us a defective product and has promised to replace it; however, we are still waiting on that replacement. However, we have deployed the working system and wait with bated breath for the results to come in. At the lab we are excited to see this emerging sector of tech take shape. Another exciting new technology we are excited to try is the Eyes on Hives system from keltronix, an innovative new project that processes bee movement in and out of the hive using a video camera.
No comments:
Post a Comment