Introduction: Honey Bee Counter II

About: just have to figure out how all these things go together....

3/18/2020 - new instructable...

12/21/2019 The project that doesn't die!... I've made a few updates to this design. Just finishing up this design but wanted to start pushing this out. This version of the bee counter is all through hole components. I really wanted to make a kit that was easy to assemble for folks just starting out.

This is an old project... please see the link above for the latest designs.

Hello, I've made this project easier to build, data log, and post data. This bee counter like the last design counts bees going in and out through twelve gates.

We've teamed up with some new researchers and business owners to provide bee metrics. You can reach me at

.... and we're still interested in helping you build your own bee counter and this new design allows you to add dattalogging, connect to ethernet, wifi, or cellular. It also makes it easy to protect your most sensitive electronic parts..

Step 1: What You Need

What I like about this project is you can build it in pieces as you get comfortable with the parts...

You need a uController... say an Arduino

You need the bee sensor board:
Printed Circuit Board via Oshpark $19 for 3...
Qre1113 reflectance sensors (24 sensors for 12 gates) $10.08
Shift registers qty(3) $1.08 74HC165
pull down resistor array 100k qty(3) $2.04 100k resistor array
resistors LED qty(1) $0.68 47ohm resistor array
Headers qty(13) $5.85 six pin headers for the gates!

you need some plastic or wood pieces to surround your bee counter
you might want an ethernet, wifi, or data logging shield to log data
a plastic enclosure for your ucontroller

Step 2: How It Works - Electronics

Each gate has two QRE1113 sensors. When a bee is present, reflected IR light triggers the IR sensor HIGH and the shift register reads HIGH. Otherwise the 100K resistors pull the IR sensors low (to ground).

This design uses 3 shift registers. Each shift register can read 8 sensors or 4 gates for a total of 24 sensors and 12 gates. The shift registers continue to track the presence of bees and determines which way the bee is going.

Only one led from each sensor is used; such that, one IR LED provides enough light for reflectance to trigger both IR receivers when a bee passes under one. This reduces parts and simplifies the board.

The parts list for the main board is as follows:

Costs Per Board $6.5 via oshpark
Qre1113 reflectance sensors (24 sensors) $10.08
Shift registers qty(3) $1.08 74HC165
resistors 100k qty(3) $2.04 100k resistor array
resistors LED (47 or 100) qty(1) $0.68 47ohm resistor array, 100ohm resistor array
Headers for gates qty(13) $5.85 six pin headers

You connect the bee counter to your Arduino with five wires.

VCC=> 3.3V or 5V (for 3.3 volts use 45ohm LED resistor and for 5volts use 100ohm LED resistor)
MISO - master_in_serial_out, connects to QH
SCK - clock
Load - Parallel load pin
Gnd - ground

These are very standard connections for reading shift registers. Here is the classic button example from arduino

You may notice that I've broken out the VCC for the IR LEDs. This is done if you want to pulse (PWM) the LEDs and save on power.

Step 3: Soldering... Putting the Parts on the Sensor Board

Ok, brace yourselves... This is a great project to learn surface mount soldering!

All the parts are surface mount accept for the gates. The gates are made from 6 pin headers. You need to cut the middle 4 pins. Only the two outside pins are soldered.

There are a lot of surface mount soldering tutorials out there...but all you need for this project is:

Once you get everything soldered you can apply power and test your LEDs using a camera. Remember we only are powering one of the two LEDs so you will only see the the LED closest to the center lit up.

Solder the V2 jumper (labeled VCC) if you don't want to control V2 separately. Per the schematic, V2 allows you to control the LEDs independently. This might be useful for PWM of the LEDs. I've not tested this yet but it should work to reduce power.

Step 4: Hooking It Up and Getting Data

Before you get data... and even before you solder your gates on... I suggest testing your sensors with this easy shift register code.

pload Pin = 5; // Connects to /PL aka Parallel load aka latch pin the 165
dataPin = 6; // Connects to the Q7 aka MISO pin the 165
clockPin = 7; // Connects to the Clock pin the 165
plus VCC and GND.

I use a piece of white paper and slide it about 3-5mm over each sensor. The IR light will hit the sensor and reflect back into the receiver and trigger a 1 on your test code above.

Once that code is tested with your sensors you can try to save the data to an SD card... send it to your serial monitor, or post it to a webservice. You then need to come up with some simple data to COUNT BEES! This can be as simple as an if then statement. If the IN sensor is triggered first, followed by the OUT sensor ... you know the bee was going OUT. If the OUT sensor is triggered first, followed by the IN sensor is triggered, you know the bee is going IN. I can expand upon this code but it quickly becomes application specific.

I posted code here: github

Step 5: Bee Counter Enclosure

You need two enclosures. You need to wrap your bee counter in thin wood or 1/8" plastic. Then you have an ~18" cable from the hive entrance to your uController. You need an enclosure for the uController too.

I used ~3/16" pieces of plastic for the top of the bee counter and 1/16" at the bottom. I got this from the scrap bin at Tap Plastics. You want your top piece sturdy enough to overhang your entrance by 1" to stop direct sun light from triggering your sensors. The bottom of your bee enclosure must be black or painted black so it doesn't inadvertently reflect IR back into your sensor even though the spec sheet says the range is only ~1/4".

Also, I learned DON'T USE SILICONE. The bees hate silicone and will work feverishly to try to remove it.

The 2nd enclosure can be any water proof box that can house your uController.

Animal Innovations Contest

Participated in the
Animal Innovations Contest