Introduction: Backyard Beehives: the Electric Hive

This instructable is part of a larger project being documented at http://hive.honeybeegardens.net/

David Ammons, a research biologist and hobbyist beekeeper, and myself, Graham Toal - computer programmer and Maker - are working on a project to add electronic instrumentation to beehives.

What you're looking at here is a raspberry pi with a video camera which records all the bees entering and leaving a hive. It's a starter project for a fully instrumented hive which will eventually record data from many other sensors, including temperature, sound, and hive weight.

We support several goals - gathering data for colony collapse disorder research; gathering data for commercial beekeeping operations to make them more cost effective; and gathering data for education and pure research.

However we're not going to go into the goals of the project for this instructable - all we're presenting here is a cost-effective way to instrument a hive with a camera at the entrance and room for expansion to add arbitrary sensors for whatever data you want to collect yourself.

The setup we've come up with here is simple to build and adaptable to many purposes - for example this would easily make a good 'critter cam' or even part of an outdoor surveillance setup.

The total cost of creating this unit as a one-off build using retail sources should be no more than $200, probably much less depending on what components you already have available. The complexity of this project is 'low to moderate' and can be finished in a day after you've acquired all the components.

Step 1: What You'll Need

There are a few assumptions here that I'll go over...

We need the Pi2 because we'll be doing video processing in parallel with recording video. The extra cores are essential. We don't need the pi3 for Wifi or Bluetooth as we'll be using a wired ether connection. The Pi2 is a compromise between functionality and power consumption.

We want to record at night. You can build your own IR LED illumination with three Vishay TSAL6400 IR LEDs and a resistor, but the pre-built IR illuminators are good enough. The 940nm Vishay LEDs may be marginally less visible to bees but most likely the bees can't see the 850nm LEDs that are likely to be what's supplied with the off-the-shelf illuminator.

If you get the lens with the adjustable focal length you won't need to add a close-up lens yourself. If you do add a close up lens, I've found the eye loupes from Harbor Freight to be a cheap way to get a set of lenses of different focal lengths so you can pick one to suit. I attached it to the camera with superglue.

The waterproof enclosure is one of those that cable and phone companies use. I picked a large one so that while prototyping, I would have no trouble making enough space to fit everything in. Even if your initial build is simple like this one, at some point you may find yourself adding a breadboard and some sensors, and you'll appreciate the spare space when you do.

The disk drive is the interesting addition. Although we are using an ethernet cable here for both networking and power, which means we could if we wished save data to a central server indoors, I decided not to do that for this build because at some point we expect to convert this into a battery-powered installation without that central server (so we can install in a field where there are several hives but no power). The pidrive is very low power and conceivably we may be able to power both the pi and the drive from a single solar panel. For our app we had a worst-case scenario - we wanted to record 24x7 (so that if a colony collapse happened, we would have the entire event on video). We tried recording to 128Gb SD chips, to 128Gb USB flash drives, to a 256Gb SSD drive - and none of them stood up to the combination of continuous writing plus low power availability. After about 3 months of R&D we found the Western Digital PiDrive which seems to have solved the problem. It doesn't corrupt even if written to continuously and it has excellent low power saving modes.

The stand-off mounts are worth having if you have a few Raspberry Pi's. The Pi holes are a bit tight but if you squeeze the standoff tip with a plier, it'll ease in with a little force. I haven't found any other mounting method that is as tidy. Avoid velcro or double-sided tape!

Step 2: Let's Have a Look at the Assembly

The Pi2 is attached with the sef-adhesive stand-offs.

The PoE splitter is attached with Velcro.

The disk drive sits in a tray that I had handy which just happens to be the exact size. I cut a hole in the tray for the drive's power/data cable, and cut two holes through the top-right for screwdriver access because it is placed over one of the enclosure's mounting holes. The tray is actually a compartment from a cheap Harbor Freight component box. It would not stay in place with superglue so I also velcroed it down. I forgot to drill some holes in the bottom of the tray for ventilation and I'll probably do that later, but initial testing doesn't seem to indicate too much heat so I'll leave that as is for now. If you have a 3D printer, you could always print your own shelf for the PiDrive...

The PiNoir in my installation uses a longer cable than normal but I think that a regular cable is long enough so I didn't include it in the B.O.M.

The camera is attached using "Oogoo" (or silicone caulk as you normally would call it, mixed with corn starch). The caulk hack is my go-to solution for improvised waterproofing. Still to do - build a shell around the camera to keep water out. That won't be hard. You'll note that the camera points inwards a little. You want to cover the entrance to the hive and catch bees that enter from above as well as from the landing zone in front of the entrance.

Step 3: Outdoor Concerns

I'm assuming you have an easy way to run an ethernet cable from somewhere that has power. One reason for my using Power over Ether (PoE) rather than running a 110V power cable is that I'm not comfortable running high voltage outdoors - and neither is your local building safety code.

There are also some constraints on running PoE but assuming you're doing this yourself it's still safer than putting mains cables outdoors. (For example: a lightning strike on an outdoor cable could fry your indoor electronics (or people) - so consider a lightning arrestor) Note that if you have a back yard hive and want to keep things neat by burying your cable, regular 'plenum' cable doesn't make the grade. There's a special type of CAT5 cable suitable for burial (called, not surprisingly, 'direct burial' cable) although it's a bit more expensive. I listed an example in the Bill Of Materials, but if you have your own tools and know how to crimp connectors properly, the cabling should be a lot cheaper.

If you're like me and a bit of a neatness freak, you may also want to run the cable through the wall of your house and connect via an indoor wall socket. This isn't for the faint of heart (I used to do this stuff as an installer for an ISP so I more or less know what I'm doing) and most people will want to hire a professional wireman to do this for you. This will bump up the cost of the project more than some people may be comfortable with, but it does considerably improve the WAF. Doing it yourself, badly, however, earns negative WAF.

Step 4: Next Steps?

After suiting up, attach the case to the front of your hive - either with the four screws provided and the default mounting holes, or find some other way that doesn't involve screws. Hopefully when you attached an appropriate lens you'll have made some sort of measuring stick so that you can mount the enclosure at just the right height to have focus on the entrance. (I know I should have mentioned that earlier :-) )

I'll eventually add information on software, but that's for a second posting as it will be quite long!

Also on our 'to do' list is our web site, which will document the overall project and hopefully show some live video samples. We don't have the bandwidth to stream live video but we can upload minute-long samples every few minutes.

The main thing that remains to be done is processing and analyzing the video. We think there is a lot of data that can be mined from this video but it will require new software to be written. Probably using OpenCV. We'll be looking for collaborators to work with us because video processing software isn't something that either David or myself have any experience with so far.

We also plan to apply for grants to take the research aspects of this farther, and perhaps we'll be able to hire contract programmers to write some of the software that's needed. A large part of our project that hasn't even been mentioned here comes from what happens when you instrument lots of hives and share and analyze the data in the cloud. This should enable making predictions and allowing beekeepers to react quickly to critical changes in the state of their hives.

There's a discussion forum at raspberrypi.org where we've been discussing this. (actually there are a few related projects sharing the same thread...) Any beekeepers with raspberry pi interest are welcome to join us!

Urban Farming Contest

Participated in the
Urban Farming Contest