Raspberry Pi Beekeeping Server




Beekeeping (or apiculture, from Latin: apis "bee") is the maintenance
of honey bee colonies, commonly in hives, by humans. A beekeeper (or apiarist) keeps bees in order to collect their honey and other products that the hive produces (including beeswax, propolis, pollen, and royal jelly), to pollinate crops, or to produce bees for sale to other beekeepers. A location where bees are kept is called an apiary or "bee yard".

Depictions of humans collecting honey from wild bees date to 15,000 years ago. Beekeeping in pottery vessels began about 9,000 years ago in North Africa.[2] Domestication is shown in Egyptian art from around 4,500 years ago. Simple hives and smoke were used and honey was stored in jars, some of which were found in the tombs of pharaohs such as Tutankhamun. It wasn't until the 18th century that European understanding of the colonies and biology of bees allowed the construction of the moveable comb hive so that honey could be harvested without destroying the entire colony. This is one of my hobbies. My job is electronic engineer so, I decided to automate the beekeeping process, sort of. It very important when harvesting to have the right informations like temperature, humidity, honey quality and weight chart, to make the decision to stay or move on to a different zone. My system is based on Raspberry Pi and Arduino. Arduino board is connected to DHT humidity and temperature sensor, LCD display and HX711 amplifier with scale, reads the values and print it to the LCD display and to Serial port. DHT sensor is used for outdoors and will be mounted outside the projects case. The load scale sensor is from a a weight scale, already has a frame, and will be mounted at the bottom of a beehive. Raspberry Pi reads the serial port and stores the values in database, then a web server is opened and displays charts with temperature, humidity and weight of the hive, along with statistics, Min, max, average and a selection for information (6, 12, 24 hours).

Step 1: BOM

Gathering the parts:

1 x Raspberry Pi B+

1x Arduino Nano

1x HX711 Scale amplifier board

1x Load Cell (mine is from a scale, and it's max 300 KG)

1x DHT Humidity and Temperature sensor

1x LCD display for Arduino

1x 4.7k Resistor

2x 10k Resistors

2x Push Buttons

1x Wifi Dongle

Power Banks

Enclosure box

Usb Cables

Step 2: Begin

First, you need to install Raspbian. More information here: https://www.raspberrypi.org/documentation/installation/installing-images/
To connect to ssh, you need the Pi's Ip address. I used a cool tool for Mac called PiFinder (https://learn.adafruit.com/the-adafruit-raspberry-pi-finder/finding-and-connecting) which finds all the Raspberry Pi's connected to the network. You can connect the Pi to a display, open the Terminal and run:


The inet Ip address is the Pi connection to the network. Next step is to connect via ssh either through Putty on Windows, or from Terminal via Linux or Mac.

I ran the command from terminal:

ssh pi@ (where pi = user and = Ip address of the PI)

Do an update of the system. Open the terminal,or ssh, and run:

sudo apt-get update sudo apt-get upgrade -y sudo reboot

Install the software for comunnicating with the Arduino via serial: sudo apt-get install ino

Install the database software: sudo apt-get install sqlite3

Install the web server: sudo apt-get install apache2

Step 3: Setting Up the Arduino

Next step is to setup the Arduino environment: https://www.arduino.cc/en/Main/Software
Install Arduino IDE and then install the libraries from the links below.

Connect your Arduino board and upload the sketch: ArduinoRaspberryPiHive.ino located in the Git repository.

Connect DHT sensor to digital pin 10, LCD display to SCL and SDA, HX711 board to A1 and A0, button for reset scale to pin 11 and button for backlight on to digital pin 12. Also, all extensions have 5v and Ground. I did a split and soldered directly to my Arduino's usb, a screw on terminal, for 5V and GND. I figured if I used the 5v pin on the Arduino I would get about 4.5v.

Now we proceed with configuring Raspberry Pi.

Connect the Arduino via USB cable to Arduino.

Step 4: Prepare the Enclosure

Solder wires to the push buttons and 10k resistors as in the schematic attached.

Drill holes to the enclosure box and add the buttons, DHT sensor, Load scale cable and Lcd Display.

I also glue the DHT sensor to the box and added an On/Off switch.

One of the push buttons is for lighting up the LCD backlight.

The other one is for setting the scale to 0 Kg.

Step 5: Back to Raspberry Pi

Connect the Arduino via USB cable to Arduino.
Open the terminal and run:

ino serial

You will be prompted with a serial reading from the Arduino. If not you did something wrong.

Close the window and open another Terminal.

Create the database by runing the following command: This creates a database called templog.

sqlite3 templog.db

Add tabels weight and temps: This query creates 2 tables called temps (having a coluimn for date and time called timestamp, and a numeric column called temp) and weight (having a coluimn for date and time called timestamp, and a numeric column called Kg)

CREATE TABLE temps (timestamp DATETIME, temp NUMERIC);

CREATE TABLE weight (timestamp DATETIME, Kg NUMERIC); Commit;

Make sure to add ; after each query.

If you run -tables you should be prompted with two tables, temps and weight.

Quit the Terminal, and run the following commands: FIrst will copy the templog.db to folder /var/www/. The second command changes the file's owner.

sudo cp templog.db /var/www/ sudo chown www-data:www-data /var/www/templog.db

Now it's time to import code from git. In the Terminal window, run:

git clone https://github.com/vpetrache/Raspberry-Pi-Web-Application-Temperature-Reading.git

This will create a folder called Raspberry-Pi-Web-Application-Temperature-Reading with monitor.py and webgui.py in it. Go to the directory:

cd Raspberry-Pi-Web-Application-Temperature-Reading cp monitor.py /usr/lib/cgi-bin/ cp webgui.py /usr/lib/cgi-bin/

Change the file ownership: sudo chmod +x /usr/lib/cgi-bin/monitor.py sudo chmod +x /usr/lib/cgi-bin/webgui.py sudo chown www-data:www-data /usr/lib/cgi-bin/monitor.py

Step 6: Starting the Server

To add the python script to run as a job:
sudo crontab -u www-data -e

Add the follwing line at the end of the www-data file:

*/15 * * * * /usr/lib/cgi-bin/monitor.py

Next step, enable the Apache web server to run the script:

sudo leafpad /etc/apache2/sites-enabled/000-default &

Navigate to line:

< Directory "/usr/lib/cgi-bin" >


< /Directory >

Add the following line:

AddHandler cgi-script .py

And restart the Apache server:

sudo service apache2 reload

Restart the Raspberry Pi:

sudo reboot

Go to any browser and connect to http://YourPiIpAddress/cgi-bin/webgui.py and you should see something like this (with a few data):

Step 7: Wrap Up

When the season comes, I have a functional load scale and more knowledge about honey harvesting.

Here are the repositories used in this project:



Also, a short video.



    • Growing Beyond Earth Maker Contest

      Growing Beyond Earth Maker Contest
    • Colors of the Rainbow Contest

      Colors of the Rainbow Contest
    • Classroom Science Contest

      Classroom Science Contest

    22 Discussions


    4 months ago

    Este posibil să realizăm un astfel de proiect sim800l and not use Raspberry Pi B


    Question 1 year ago on Step 3

    hello. i am starting with the arduino board.

    but it seems to be the libs are not ok

    the IDE cannot find




    I also cannot find it on github


    2 years ago

    Hello, I have the arduino running. Needed some tweeking in relation to the library's. Now this part is working.

    The raspbian pi is not... the picture is the result after "ino serial" (maybe just a baud rate problem) But if I follow the instructions on how to get apache2 run the scripts I get lost.

    Can you put me back on track?

    thank you.

    2016-06-26 14.40.17.jpg2016-06-26 14.44.15.jpg
    2 replies

    Reply 2 years ago


    Starting to learn Python: Found a few bugs in monitor.py. Or using the wrong python version? (somthing with temperatura and function caling...

    I am curious about your answer.

    Thank you,



    Reply 2 years ago

    I have now readable output (baudrate 9600!). Apache2 is showing the default page.


    wegui.py is webgui.py ?

    In de file: monitor.py en webgui.py you place te database in /var/www/ In apache2 is this nou /var/www/html/?

    If i browse to myip/cgi-bin/webgui.py The only text i see is: No data found (I find it in webgui.py but I do not program in py (jet))

    thank you, Leo.

    2016-06-27 15.33.58.jpg

    2 years ago

    Hello, Nice project and I want to build it: Problem:

    The command sudo apt-get install ino does not find "ino" There is "arduino" software. Is this right?

    greetings Leo.

    2 replies

    Reply 2 years ago

    Try this:



    Reply 2 years ago

    Thanks, that's it!


    3 years ago

    Did you try to check weight measurement variation? We did an experiment using HX711 and Arduino: we loaded 10 kg and let Arduino recording readings, we recorded +/- 800 grams over 24 hours which is too much for a bee hive.

    3 replies

    Reply 3 years ago

    PS: this was done outside, therefore temperature varied from +3 to +18


    Reply 3 years ago

    Nope. Weight variation is too much to use it in productive environment. This project was first made as a school project and if it's relevant, as a . I was wondering if I can place the scale sensor in a vacuum chamber, will it still have those variations?


    Reply 3 years ago

    Not sure what is actually influencing the weight measurement. Temperature, air moisture, cosmic radiation... Yes, in vacuum may be perfect, but not practical. I have no vacuum chamber to check.


    3 years ago

    Can the Arduino Uno be used? I am almost positive it has the same ports, if not more.


    3 years ago

    Nice 'ible.

    I'm also a beekeeper and will be keeping an eye on this project to see if I can implement it into my setup.

    Do you think that the weights will be accurate in measuring the amount of honey in there? As you know the weight of the bees can be pretty heavy when they have built up. Of course I may be misunderstanding the way that you will use these measurments.

    4 replies

    Reply 3 years ago

    Actually, my load scale has a max of 300 Kg. The hive might weight as much as 80 Kg, so it;s not much of a problem.

    Reading error is +-0.1kg, so it's pretty accurate.


    Reply 3 years ago

    Actually what I meant was how do you know your honey measurement is accurate? The weight of the bees and pollen in the hive will fluctuate quite a bit as the season goes on. I feel certain the bees will be a fraction of the weight of the honey, but are probably heavy enough to throw off any calculations.


    Reply 3 years ago

    The usual use of a scale hive is to track weight gain over time as an indication of colony strength and the presence of an active honeyflow. One such scale hive in an outyard can serve to give information about the likely conditions in all the hives in the yard. Now, a wifi uplink to your home computer or smartphone would save visits to distant yards. Add a webcam, and you could watch bears tear up your hives from the comfort of your living room. ;-)


    Reply 3 years ago

    Let me know if you need help.

    pvalykTecwyn Twmffat

    Reply 3 years ago

    Hey, Actually no.

    The calibration takes place in void setup (once at boot). Outside temperature factor is not considered but I'm guessing won't make much of a difference as this is a simple configuration.

    Look at this for more details :