Introduction: Honey Bee Counter II

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 Thomashudson.org.

.... 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!


Extras
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.

Comments

author
Impavido (author)2017-01-01

Hi Thomas,

I was buyed three PCB of Honey Bee Counter II via
OSH Park, and mounted and connected to an Arduino Pro Mini. I also
charged your code provided for the counter and seems to work, but now
I'd like to count and store an amount of bees going in and out. Does
your code have a continuity, an implementation to perform this?

Thank you very much and regards.

author
micromet (author)2016-10-17

Hi Thomas,

Great Project ! I appreciate your work on this. I just made two of your boards and tested them with the code your provided on git hub - worked great.

Could you share example code for data logging - storing the data to an SD card with a time stamp? Or do you of know of someone who has posted this kind of example ?

BTW, I fabricated the boards using the Controleo2 reflow oven setup

http://www.whizoo.com/

I reflowed the sensor side first. After it cooled, I applied paste solder to the other side and then reflowed the shift register and resistor side.

Thanks

author
Impavido (author)2016-08-07

Hi Thomas,

I was able to self-build
your bee counter using white plastic materials for the gates and beam IR sensors. Into the
lab all the gates worked fine but, outdoor, the sunlight cause problems,
as you commented before. Now I want to forget this design in order to
build a new one, following this instructable. But I can't find the
Arduino sketch anywhere! Can you help me on this, please?

Thanks in advance,

Juan

author
hydronics (author)Impavido2016-09-03

I just posted some code here: https://github.com/hydronics2/Bee-counter-3.1/tree/master

author
Impavido (author)hydronics2016-09-04

Wow! Great, Thomas. Now I can start testing the shift registers using your code.

Thank you!!

author
hydronics (author)Impavido2016-08-23

sorry I don't really have a good sketch to publish right now. I'll try to get it on github soon.

author
Impavido (author)hydronics2016-08-24

Ok Thomas, thank you for your reply. I will wait for it.

Regards,

Juan

author
Salvagione (author)2016-08-21

Thomas,

Any chance you would share your Eagle files? I'd like to order a solder mask from OSH. I'd also pondering adding an inexpensive wifi module.

author
hydronics (author)Salvagione2016-08-23

I added a zip file with eagle docs next to the schematics.

author
Salvagione (author)hydronics2016-08-27

Thank you!

author
AdrianO42 (author)2016-08-04

Thomas,

I really appreciate your project. I'm working on a similar open source bee counter using two stacked HY810H 3/8" gap sensors instead of reflection sensing. The sensors form the gates and the current is very low at 1.5mA each @ 3V. I have a working prototype ref. http://hivetool.org/w/index.php?title=User:Adrian

I'm wondering if you would be willing to consider the gap sensor? I'd really like to try your board design with the shift registers and modify it to use with the HY810H sensors. There are a few reasons for the change, less power, higher signal confidence using a narrow beam direct path, unaffected by target color. At least in theory. Please reach me at napaogdenatgmail.

author
hydronics (author)AdrianO422016-08-23

yes, I think a gap sensor would work great. I went with the reflective sensors because I thought at the time they were less expensive and then became interested in mfg with surface mount parts.

author
AdrianO42 (author)hydronics2016-08-23

Any chance you would be interested in collaborating on an updated design using the gap sensors and Nordic nrF52 BLE as a data processor and transmitter? I've picked out some nifty shift registers too. Everything low power to run off small LIPO cells.
napaogdenatgmaildotcom

author
AdrianO42 (author)2016-08-19

Well, I guess were going to develop independently at I have not received a response. napaogden_at_gmail.com

Is this thread dead?

author
ortav (author)2016-07-03

Appreciate your effort! Great project! What is exact gate size? Side - wall to wall diameter and trough the gate diameter?

Is it possible to distinguish drones from workers with current gate design?

Thank you.

author
hydronics (author)ortav2016-07-06

the gates are 3/8 wide (9.5mm) and the headers are 8.5mm high. I've not completed the testing and finish the programming to distinguish between drones and workers but I think it should be pretty easy to do.

author
ortav (author)hydronics2016-07-11

Thank you for your answer. I have already ordered all components for 3 counters so we'll see it in action. :)

author
rberkelm (author)2016-06-29

Congratulations on a very useful project! I'd love to give it a go.

What is your experience with it's accuracy when lots of bees are leaving (or entering) at the same time? Do two or more bees get counted as one? The gates obviously need to be large enough to allow drones (& queen) to go through but I wonder how much space that allows worker bees to crowd the gates?

I have zero experience with Arduino, but I was wondering if your code can be directly used on a Pic MCU? I normally use Picaxe MCU's (easy to program) but translating your code will be a challenge.... Do you have a program flow diagram?

Thanks again!

author
MikeF144 (author)2016-06-02

Hello,

this looks like a great Project :)

just one question.. what is the piece of wire that goes from the IR light to the circles on the end in this picture?

I am a complete novice to this stuff so i do apologise if it is a stupid Question.

Many Thanks,

Mike

author
hydronics (author)MikeF1442016-06-05

Hi Mike, one of the circuit boards was bad. I'm pretty sure it was a MFG issue. When I asked them about it they sent me three new boards at no charge. This is a very rare occurance so likely you wont have to add any jumper wires!

author
MartinS201 (author)2016-05-06

Hi,

first of all, great project and thanks for sharing! What do you use as absorber on the button of your Bee Counter. It looks like some black PVC shield? Is this absorbing the IR light enough?

Have you tried to do it the other way arround? Use some reflective material at the button (getting a HIGH if no bee is under the sensor) and the bee will pull the sensors to LOW?

thanks!

martin

author
hydronics (author)MartinS2012016-05-18

Hi Martin,

Most any black material will absorb the IR light. I used a thin strip of back ABS I got from the scrap bins at TAP plastics. I also tried 3D printed material and painted it black. You could probably do it the other way around as well... assuming the signal strength of the bee will be less strong than your highly reflective material. Sense both the bee and the reflective material 'reflect' IR back to your sensor you'll have to come up with some way of tuning the input... or you could use an analog input in stead of a digital input. This might be interesting as you could get a profile of the bee's back... you could use the profile to determine weather the bee is moving forward or backward.

author
whodean (author)2016-05-18

Just curious what the optional 0.1uF capacitors do? I'm in the process of building my third bee counter...first two appear to be working great!

author
hydronics (author)whodean2016-05-18

That's great. Glad the bee counters are working. I'd love to see some of your data. The 0.1uF capacitors are decoupling capacitors. They smooth out the power supply to the shift registers to guard against power fluctuations that might mess with its operation.

https://en.wikipedia.org/wiki/Decoupling_capacitor

author
txNgineer (author)2016-05-12

Great project! I started a few hives last year in partners with a long time bee keeper. I just got your boards from Oshpark and am building the sensors now. I also found a good, 200 Lb outdoor rated scale on Amazon and will hack that to give me weight change information. Thanks for making this and making it open!!

author
zis4me (author)2016-04-19

How exactly is it powered?

author
hydronics (author)zis4me2016-04-20

5vdc (like a usb battery pack or the Arduino 5V pin via the USB plug) or you can also run it on 3.3VDC it that's what your uController has.

author
whodean (author)2016-04-03

A bit new to electronics but thought I would have a go. The list makes reference to: resistors LED (47 or 100) qty(1) $0.68 47ohm resistor array, 100ohm resistor array

This is slightly confusing. I notice that there is one 47ohm resistor array on the circuit board. Does this mean that you can swap that out with a 100ohm resistor array to run it at 5V? Just not sure what it means "resistor LED"?

author
hydronics (author)whodean2016-04-12

Hello, sorry for the late reply. The 100ohm resistor array is for using a 5volt and the 47ohm resistor array is used for a 3.3volt setup. If you are using a standard Arduino Uno your voltage is 5volt and you should use the 100 ohm resistor array. sorry for the confusion.

The math goes something like this: resistor LED voltage is 1.3volts and 24ma according to the cut sheet(Figure 6) https://www.fairchildsemi.com/datasheets/QR/QRE1113.pdf

Two LEDs in series is 1.3 + 1.3 or 2.6volts. 5volts - 2.6 volts is 2.4volts. 2.4 volts / 24ma = 100 ohms

author
ImamS21 (author)2016-04-01

hello, I am imam from Indonesia. I am very glad to read your reserach. I have plan to build people conter at the train, the sensor can count people entry and out likes your project. is possible if your research Wil be implemented to our project? thanks

author
greengumbo (author)2015-12-17

Could you stick a different reflective disc on the back of the queen and use an adapted version of this to monitor when a swarm leaves or a mating flight occured ? This is very cool. Going to get some grad students to try it !

author
JeremiahO (author)2015-12-04

I very new to useing arduino. how had is to make. sold wait I get better or is this something newbie can due easyly

author
hydronics (author)JeremiahO2015-12-05

Yes, I think you might be able to complete this project with little Arduino experience. The example Arduino shift register code works great for reading the sensors.. The tough part is the soldering all the surface mount components onto the circuit board. That takes some patience and practice.... but still doable if you have the time.

author
The_Saint (author)2015-11-15

Hi, can you please share with me the entire schematic? Thank you! Gabor

author
hydronics (author)The_Saint2015-11-15

I shared the schematic. Let me know if you have any questions. thanks, thomas

About This Instructable

11,787views

46favorites

License:

Bio: just have to figure out how all these things go together....
More by hydronics:Fish eyeEllie's Rotary DialMini-Split 7-day Thermostat for a tiny house
Add instructable to: