Beehive Instrumentation Project-8: Wired prototype instrumentation board

Assembled and tested a more permanent prototype with soldered wire interconnections on the 74HC4052 mux/demux.

Wired hive instrumentation

Two temperature & humidity sensors shown.  Tested it with the outdoor 120 VAC-to-12VCD power system. Will likely connect the third for reading conditions between the hive body and the insulated enclosure tomorrow.  The fourth sensor shed a through-hole connector while I was trying to desolder and remove the bulky header pins–will have to be replaced.

Also need to reprogram the operating software to use daily logs with the date in the file names to facilitate log management.

Hopefully I can get this in the box tomorrow morning before the outside temperatures drop back below freezing and/or it starts snowing.  The next version should log temperature and humidity outside, between box and enclosure, and under the inner cover or close to the cluster of bees.

The all-foam enclosure stayed put during high winds yesterday, although it was left at an angle. I have a better design in mind, based on this experience.



“Baahubali – The Beginning”

Beehive Instrumentation Project-7: Update

Built and tested multiple HTU21D’s (2 so far) with identical fixed I2C addresses using the 74HC4052 mux/demux. Now building up on a wired prototyping board. I’m also switching to a 12VDC outdoor power, since the drill batteries only last 10-12 hours under sub-arctic conditions. I will hopefully get this to the hive while the current thaw lasts.

Beehive Instrumentation Project-7: Hive Enclosure

Tried out an idea for adding additional insulation and protection to the hive for Winter weather.  Still a “work in progress”, but it seems to be working.

Hive enclosure test 11-13-15

It may be working too well.  Will have to see if the temperature gets back into the ’40’s.  This will all hopefully make better sense when I get more sensors to check outside, inside enclosure, and two positions inside the hive.

Beehive Instrumentation Project-6: Winter measurements

November in Palmer, Alaska and a little snow is on the ground.

back yard 11-4-15

It’s been several months, but it’s time to see what hive conditions are like in colder weather.

The RPi2B has the same programming as before to read the HTU21D-F temperature and humidity sensor. I have added a little insulation to the inner cover to (hopefully) inhibit condensation on the underside of the cover. The hive has a partial screened bottom board and an upper entrance cut into the underside of the inner cover frame.  We want to know if the humidity gets high enough to condense water vapor to liquid.  We also want to know if the bottom-to-top air circulation is chilling the hive too much.

RPi & T-H sensor

Here is a sample of the SSH readings for about the last hour:

Pi T-H 11-4-15

Ambient conditions–per a consumer radio weather system are 30.6 degrees F and 82% relative humidity.  So the temperature under the inner cover is quite a lot warmer than outside the hive.  Humidity is lower than ambient, but creeping up gradually.

Per the dew point calculator at,  a temperature of 45 degrees F and a %RH of 74% yields a dew point of 37 degrees F.

dew point

Which suggests that the hive is reasonably safe for temperature and humidity.

A “manual” log for easier comparisons:



HTU21D-F placed under inner cover of hive

Ambient 30.6 deg F 82% RH
1:55 PM AKT
pi@raspberrypi ~ $ python
Temp: 7.52624511719 degrees C
Temp: 45.5665463867 degrees F
Humid: 71.6901245117 % rH

2:00 PM AKT
pi@raspberrypi ~ $ python
Temp: 7.48334472656 degrees C
Temp: 45.4700205078 degrees F
Humid: 73.3914794922 % rH

Ambient 30.0 deg F 82% RH
2:53 PM AKT
pi@raspberrypi ~ $ python
Temp: 7.2044921875 degrees C
Temp: 44.9680859375 degrees F
Humid: 75.7413330078 % rH


Bugatti 100p second test flight

Beehive Instrumentation Project-5: Case Installation and Temperature-Humidity Measurement Test in Hive

In this installment, I show the installation of the Raspberry Pi 2B into an obsolete NiMH charger case, along with the switching regulator to convert 18V to 5V.

Charger case RPi test fit

Test fit of the RPi 2B into old Ryobi charger case.

For the first test in one of our bee hives, I connected the Adafruit’s HTU21D-F breakout to the Pi’s GPIO header with a solderless prototyping board and proto jumper wires.

RPi Li-ion case install and Hive Test

Prototype board connection of T-H sensor to RPi.

I have mounted the sensor in a cut down plastic potting box, with 1/8″ holes for airflow.  Hopefully the holes will exclude bees, but not make it easy to plug with propilis.

T-H sensor case

Case for HTU21D-F breakout. (Potting box from DigiKey.)

For an initial test, I set the battery-computer assembly on the inner cover in the hive, and draped the T-H sensor through the access hole in the cover, on top of the frames.  (As is typical of Alaska beekeeping, we are still sustaining the bees with sugar syrup. Should have nectar in a week or so.)

I was skeptical about the long-range WiFi through the aluminum-clad top cover out in the yard, but the longer range WiFi USB dongle (Adafruit) is providing a very strong signal.

RPi inner cover test 6-10-15

Still using the Python code posted by Davespice to configure and read the sensor (see installment 3):

I’m operating the RPi through Putty SSH, as before.

Temperatue Humidity 6-10-15-1

The results show temperatures around 23 deg C (73 deg F) and relative humidity at first of about 47% (the RH fluctuated down to ~41 % after about 20 minutes, then rose again–not sure why).  The home weather station shows about 62 deg F and 52% RH.  The difference in humidity is probably due to the temperature difference, but I sort of expected it to be more humid in the hive, with all the sugar syrup curing in there (lots of pollen, but still waiting for the major nectar flow to start).
I was planning to build a small enclosure to hold the computer and battery at the back of the hive box. If the system works okay inside a spacer box on top of the inner cover, though, I might just stay with that.

Further intended developments include:

  • IR camera and illuminator (Pi NOIR camera)
  • A multiplexer for T-H sensors in additional hives.  This should allow a row of hives to share one RPi and battery for economy.
  • Battery monitoring.  Also have a few parts lying around for a solar charger with 4xAA batteries.
  • Hive weight measurement, taring, calibration, and logging.

Beehive Instrumentation Project-4: Adafruit HTU21D-F Temperature-Humidity Sensor Breakout Test

Among the most important things we want to monitor from beehives are temperature and humidity in the hives.  For convenience, I chose Adafruit’s breakout board for the HTU21D-F chip.


To test the sensor, I used code posted by Davespice:

Here is a sample of the output over SSH:

Rpi HTU21D-F ouput 2

Looks like the corner of to upstairs room is a bit warm.  Relative humidity started about 33%, and rose to 41% when I exhaled onto the sensor.

Beehive Instrumentation Project-3: Apache Server, Python in PHP

While running the Raspberry Pi 2-B off the drill battery, I installed the Apache-2 server and MySQL.

See for details.

I want to run the temperature and humidity logging, IR and USB cameras, and other possible instruments like weight measurement from a local web server on the remote RPi.  The first step is to run a PHP script on the server, which in turn selects the “driver” code for the attached devices.  The learning PHP script runs a simple Python script.

See for the basic ideas.

I wrote the PHP script “index.php”, which is placed in the RPi directory /var/www, where the Apache server runs it as the default start up code instead of index.html.

echo “hello world.”;
echo “<br>”;
$command = escapeshellcmd(‘python’);
$output = shell_exec($command);
echo $output;
echo “<br> I’m here in php”;

The Python script “”:

#!/usr/bin/env python
print “I’m here in Python”

When the IP address of the RPi is entered into the Firefox browser, this is the result:

RPi2B server Firefox browser image

RPi2B server Firefox browser image

Beehive Instrumentation Project-2: Raspberry Pi 2 on 18V Drill battery power

RPi 2 with 18V drill battery power.

RPi 2 with 18V drill battery power.

Last post, I checked out the UBEC as a DC-DC converter to power the Raspberry Pi 2-B from a Ryobi 18 V tool battery.  This time, I actually plugged the RPi into the battery power.  I attached the 5V output leads to a USB socket so the RPi could be powered through the micro USB connector for additional protection.

So far, I have operated the RPi2 from the battery for over 8 hours, including working on the Apache server (see later) over SSH, and an HDMI connection to a TV part of the time.  Battery open-circuit voltage dropped from ~22V to 17.35V.  Looks promising so far.  I’m planning a battery monitor using one of the channels of the MCP3008 analog-digital converter for a more accurate measurement of power status.