A Digital Beehive: A scientific study proposal.

kasslloyd:
Yea I sent a PM.

If its just an AVR per box, then it's size is irrelevent, since it can be outside of the hive, just put a connector on the outside of the box that goes in to connect to each of the frames. Then the AVR for the box can be safely mounted outside. If it's per frame, then that will need some tiny chips, which would be an issue I think. :-\

This is where my understanding of Dallas 1-wire is not so good. AFAIK the 1-wire library only reads on 1 pin but I don't see why an AVR can't keep up with a few such wires. If it's 1:1 then go with Tiny AVR's, I bought 10 years ago from Mouser for $1.30-some each.

There will need to be a way for the AVR to tell each frame apart, without any mixups, even if the order of frames change.

The DS18B20 ID of the 1st sensor in the frame is not good enough?

I would then assume the AVR's for the boxes would then connect to an Arduino that will read via a serial line the temp data out? Or, we could just actually burn the Arduino patform onto individual AVR's

Arduino boards are development boards. UNO costs about $25. UNO chip costs about $2.50. The board has the USB chip and USB jack and power regulator, clock crystals and connectors that you don't need as long as you can supply regulated power, solid ground, be happy at 8 MHz or less and not want USB.
The chip is a complete self-contained small computer. Load the code and wire it up, that's all it takes. Add what you need, in-deed.

per box, then connect all those back up to the central computer and write a simple program that reads out the temp data every 10 minutes and saves it as a CSV, that would be the ideal?

We could run several Cat5 cables from the hive back into the house, then put individual serial lines on those wires, then connect it all up via USB-to-Serial connectors inside, then a small program to read out those datas and write to a CSV... nothing complex here, just needs to be stable ;-\

You can add an SD card to each hive and swap out chips as you do the physical inspections you will be doing anyway. I get SD modules from LC Tech in China, below costs I see on eBay. If you're okay about soldering, a micro-SD to full SD adapter (the thing they usually sell with a micro-SD chip so it can fit & work in a full size slot) can be turned into a module with a few resistors for voltage dividers.. that you only need for 5V operation. If you run your AVR's at 3.3V (I think you can at 8 MHz, know you can't at 16.) then you can wire the SD adapter direct.
I think that SD would be cheaper than long cable runs and the chips you'd need to handle the extra voltage required for long cable runs. Also with cables, you need something running all the time to receive data.

The main issue here is the data needs correlated with other data sets by a timestamp, so the weight for example, and weather data, and bee counter, all need the same time stamp. Easiest way I think is to collect it all from the same computer. If everything is collecting on it's own then it's easy for these things to drift since they're not extremely accurate clocks.. ;-\

As for RFID chips... they'd have to be cheap (~$1 each) and I don't think they are.

Yourduino wants $1.50 for a single DS18B20. Want to bet Terry King would give you a volume discount on 100+?
http://yourduino.com/sunshop2/index.php?l=product_detail&p=134

Yes, I'll do that; Kass, you'll see an email from me soon.

About DS18B20; you can put MANY on a cable with +5, Gnd and Signal wires. Some have used shielded twisted pair with the shield as ground. The occasional bypass capacitor from +5 to ground is a good idea.

Usually cable capacitance and distance/delay are issues, but in your case both are small.

Since your time per update is "long" there is not problem with an individual DS18B20 taking 500ms or so to return value, and I expect that you could put dozens of DS18B20s on one circuit. So maybe your architecture is the occasional master frame, with 3-pin connectors that point up and down on several 'slave' (Drone?) frames. You could probably use simple .1 inch IC type sockets and pins for low cost. The internal hive environment is pretty benign, right??

Some DS18B20 info on the http://ArduinoInfo.Info WIKI here: http://arduino-info.wikispaces.com/Brick-Temperature-DS18B20

I expect you could actually have one Arduino (possibly a Mega) external to the hive, and simply cable to the DS18B20's.. It Would Be Nice if every frame was identical. At frame build time you would document the individual DS18B20 IDs. Then you can read any sensor and know where it is, and build a 3-D map of temperature.

Let us know what you're thinking about all this...

DISCLAIMER: Mentioned stuff from my own shop...

Do you know the HOBOS project at the University of Wuerzburg?

http://www.hobos.de/en/students/hobos-data/beehive.html
http://www.hobos.de/en/students/hobos-live/chart.html

For commercial hive scales have a look at http://hackerbee.com/2012/10/02/meeting-about-bee-hive-monitoring/#comment-21 there is an overviews about existing solutions - most in Germany. Or have a look at http://arduino.cc/forum/index.php/topic,113534.0.html

Kasslloyd, do you think there's room to make frames with different sensor and control layouts so that over time possible improvements or alternatives could be tested?
Think of it as allowing for sooner than later evolution.

Terry, Thanks for the gracious offer and help with our project. The internal hive environment is.. well.. probably not ideal for electronics. There's decent humidity as they cure the new nector to honey, and any small gaps (6mm or less usually) bees seal with propolis, a resinous material. They also seal up any larger gaps with wax. Space clearances around the frames and between frames and the walls is pretty small as well so it's very cramped inside. Water can in theory get in, but the hive we're studying will be protected under the roof of a small shelter, it sits on a scale and that needs protected from the rain.

After discussing it with my professor the largest he'd ever go with this hive is two large super boxes, and several smaller boxes for collecting honey. (a queen excluder is placed between the brood supers and honey super so she can't get in there to lay eggs, so the workers only store honey up there.) So 1 arduino is probably good. By recording the ID of each sensor on the frames before hand, then we can with paperwork keep track of where a frame was in the boxes at any time and where it gets moved too. So as long as the CSV file logs the ID of the frame, probably ID of first sensor, then we can organize things.

Clemens, yea I've looked at HOBOS, they seem to be getting FAR more funding then we could ever hope, one of their cameras is probably more than we can hope, lol. We've been collecting weight data for two years now using an Adam Equipment GFK 660A digital scale, they offer a software package that you can log the weight into a CSV file at specified intervals. Doubt theres any easy way to make an arduino interface it, it uses a serial connection, but yea. We're fine with keeping that setup for the weight, we just have a serial cable ran to the house from the hive, and a power line ran to the hive for the scale. So power isn't an issue at the hive site.

GoForSmoke, It may be possible. The temp sensors are not cheap and in bulk it's still going to be a lot of dollars for the sensors alone, that combined with finding someone to design the circuits, the circuit boards, cost of getting boards made, and the other equipment, we may not have much money for exploring alternative designs. We're basing our design off of another experiment (http://mietz.imkerforum.de/) so we're not going in blind on design, but alternative ideas would be helpful. The bees generally don't build hive out to the edges of the frame, so putting sensors on the edges would generally be a waste, and they generally start putting brood cells in the center of a frame, so biasing our measurements toward the center seems to make sense.

Do you have suggestions?

GoForSmoke:
This is where my understanding of Dallas 1-wire is not so good. AFAIK the 1-wire library only reads on 1 pin but I don't see why an AVR can't keep up with a few such wires. If it's 1:1 then go with Tiny AVR's, I bought 10 years ago from Mouser for $1.30-some each.

I think for at most we'd be using 160 sensors (two boxes, 80 per box) that 1 arduino can probably be setup to query all those sensors. We only need a temp reading every 10 minutes or so per, at most 5 minutes, I think that even with that number of sensors it can read them all out.

The DS18B20 ID of the 1st sensor in the frame is not good enough?

Yea, I wasn't thinking that the chips had an ID that you can get out of them, now that I know they can that's more than sufficent to tell the frames apart.

Arduino boards are development boards. UNO costs about $25. UNO chip costs about $2.50. The board has the USB chip and USB jack and power regulator, clock crystals and connectors that you don't need as long as you can supply regulated power, solid ground, be happy at 8 MHz or less and not want USB.
The chip is a complete self-contained small computer. Load the code and wire it up, that's all it takes. Add what you need, in-deed.

If i have a good wiring diagram I can probably translate that into a custom board for this, instead of buying prebuilt arduinos. But the cost of a prebuilt one is probably not bad, that and they're likely to be more reliable than one with my noob skills could make, and it's easy to replace if it fails since buying another is trivial. We're looking to make sure it's easy to replace a failed piece of hardware, so off-the-shelf stuff would be preferred over custom stuff, custom stuff will need to have extras made initially so they're ready to be swapped if something fails.

You can add an SD card to each hive and swap out chips as you do the physical inspections you will be doing anyway. I get SD modules from LC Tech in China, below costs I see on eBay. If you're okay about soldering, a micro-SD to full SD adapter (the thing they usually sell with a micro-SD chip so it can fit & work in a full size slot) can be turned into a module with a few resistors for voltage dividers.. that you only need for 5V operation. If you run your AVR's at 3.3V (I think you can at 8 MHz, know you can't at 16.) then you can wire the SD adapter direct.
I think that SD would be cheaper than long cable runs and the chips you'd need to handle the extra voltage required for long cable runs. Also with cables, you need something running all the time to receive data.

Yea... SD cards could probably work. There is a laptop that is running all the time anyway collecting the weight measurements from the scale. So having a computer on to collect data isn't an issue. Alternatively we could get a Raspberry Pi that sits at the scale site and have it collect data from the hive and timestamp everything with it's central clock.

It would be nice if someone could figure out a way to get the scale data and have a Raspbery Pi read it or arduino.. lol. But that isn't necessary. I'm trying to think of something crazy, like a WWVB receiver that way everything is timecoded to the atomic clock, then probably one for USB on the PC that will also synch it' s clock. Then everything will have the same time stamps.

Just making this more complex I'm affraid... lol. :-\

I think it depends really on the goal you have with the temperature sensors. Michael (from http://mietz.imkerforum.de) included the sensors--I think it was some TI stuff with I2C--in the comb foundation. This may be good for (old) brood measuring, but is not helpful for monitoring small and fast changing temperature differences, e.g. as they occur in pre-swarming. The especially with honey cells coated sensors do react very slow, nectar / honey, pollen absorb temperature and so you will not get the real degree between the combs.

Time... RTC modules are pretty cheap if you shop. In fact, if you do a deal with Yourduino (Terry King) for the DS18B20's, see about Real Time Clock modules as well. Bigger deal should get bigger discount?
Worst thing I find about Yourduino is that the prices are so low the shipping ends up a larger part of the total, but I guess he could raise prices so that wouldn't be true.

If you run cables then you should be able to use them to power the data collectors. You could also run time signal through the cables.
How many hives will you be getting data from at once? Each will give how many bytes of data per hour? And I feel sure that you will need at least 12V for long cable data transmission, but my experience on that is old and that may no longer be true.

Can you get the temperature of the air the bees circulate, even just at the exits?
Can you put pyrometers above the space between the frames? You might not have to do them all if you can extrapolate from the ones that have both.

This is super exciting to me, kasslloyd, because I've spent the last year relearning electronics (from a few courses in university) and building remote hive monitoring equipment!

I'm never going to be able to cover everything in a post like this, but check out www.hackerbee.com and maybe send me an email at my username @gmail.com as I'd love to chat on the phone. I'm by no means an expert, but I'm about to deploy a system that sounds very similar to yours in the next week or two (minus the temp sensors, although I toyed with that idea).

I've also been working with Hydronics (at the Instructables link) to revise his bee counter design. Basically, I just designed it to pulse the LEDs only while their corresponding sensors are being read. That allows a massive reduction in power consumption (important since I have to run my sensors off a solar panel and battery)! I have a prototype board assembled that I think is functional, and once I've found a couple hours to verify it's working, I'll be ordering a full-length board.

Anyway, I built my prototype bee hive data collection around an Adams CPWPlus220 scale, but it's much too expensive and doesn't do exactly what I want. I've got it logging 2 temperatures (one will be in the hive and one to measure ambient temperature) as well as weight, and it will send the data back to the internet via XBee radios. My bees are coming this weekend, so I'm just doing some final testing, but the system seems to be running reliably in my lab. You can see the data output at Channels - ThingSpeak IoT

Finally, starting in June, I'll be putting together the pieces to design an open sourced bee hive scale that should interface nicely with Arduino. It will simply include three load cells, an ADC, and a cheap little microcontroller, so I'm hoping to put it together for under $75 (under $50 if I can make more than a couple). I've published most of the app notes that I've used to design the system on my blog, so you can learn most of what I know. I'm not sure it'll be the most accurate, and I KNOW it won't be the best engineered, but it'll be as cheap as I can manage with a target of a 0.1kg accuracy (hopefully including temperature sensitivity and drift).

Eventually, I'll get my existing, working system documented -- hopefully within the next couple weeks as I work on installing a solar panel out at the bee clearing and get the scale running in the field. Then I hope to get a working prototype of the low-power bee counter and build another hive scale prototype around a cheaper custom scale that uses less power, and interfaces nicely with Arduino!

Clemens, True... Michael Mietz used the TMP275 sensor, and it as far as I can tell ended up burried in the wax. I see your point that measuring the air temp in the hive is useful too. I can incorporate a sensor along the edge of frames where the bees are less likely to encapsulate in wax (they tend to avoid the edges), and/or put one up by the connector at the top of the frame for the air temp between the frames. and put some of the Waterproof DS18B20 probes that he sells. I was going to get one at least for soil temperature. I'm sure the stainless casing will act as a small heat sink and slow it's response time. I'm going to be putting a bee counter device infront of the hive as well, so I could incorporate temp sensors into that arduino there to log the air tempature right at the opening. I donno. It's really about money here, the more sensors the more money. :wink: Then the issue of trying to interpret all that data once it's collected. I'm game for logging any and everything we can. I'm just getting affraid this is beyond my ability to design/wire. And I definitely don't have the ability to create the files to make custom circuit boards, never used that software before. So at some point I'm going to probably beg/ask/hope someone with knowledge here will want to join in and help with the more technical stuff.. lol.

GoForSmoke, there is just one hive we're collecting this kind of data from. It sits on the digital scale, so there is an outlet already wired out by the hive for that scale. The hive sits under a roof shelter to protect the scale so power isn't an issue on-site. Real-time clock modules are ok, but they drift over time I think, after a year of data collection they may not exactly agree with the base computer the scale is logging with or the other devices. :stuck_out_tongue: But it may not be that big of a deal in drift, probably a minute difference is probably more than OK for our purposes between the data sets.

Potting a temperature sensor in epoxy doesn't waterproof it?

I try to tell ya, a board is not necessary for an AVR doing simple things like this.

How many ways would you like to update the RTC on a regular basis? Cable, wifi, IR remote, keypad and LCD,..... but I assume the hive will be visited more than once a year.

Well yea... I can make my own board... I guess... getting a circuit board designed isn't cheap and doing it all on prototype boards isn't exactly neat... sigh

Yea, in epoxy it's waterproof and beeproof.

I donno, yea it's visited a lot, my professor is entirely electronics deficient, so he wouldn't really know how to do anything without training him, and taking a laptop out to the hive to update the times would be inconvenient. an LCD with keypad to change the time would be good if there was an easy way to do that.. I don't know anything about that? I'd prefer leaning to automated solutions than doing more tinkering with it than necessary. Swapping SD cards is about as much interaction then I'd prefer. :stuck_out_tongue:

You will have to have a way to set time.

Cheapest would be plugging a laptop you already have that time is correct (check via internet before going out) via USB and run a quick program written in Processing (free PC language that is what Arduino IDE is based on, they go together well) to do the job without user needing to type a thing.

An LCD and keypad cost a big hand full of sensors but could make time set about like time set on a microwave.

If you epoxy with a bit of cloth, especially glass cloth but cotton is good, the result will be much stronger even if a thinner coat. Remember that if you ever do any glue jobs that have to take pulling, bending or twisting force.

After the initial uploading of the sketch, which should set the time, how much drift (seconds/month/year/whatever) can you expect from one of these RTC modules?

In this thread are 2 RTC's compared:
http://forums.adafruit.com/viewtopic.php?f=8&t=22895

I find this post to be the most informative. Highlight is mine:

Re: Accurate clocks: DS1307 vs. ChronoDot

Postby JBeale » Fri Sep 16, 2011 12:52 pm
from http://datasheets.maxim-ic.com/en/ds/DS1307.pdf
"CLOCK ACCURACY
The accuracy of the clock is dependent upon the accuracy of the crystal and the accuracy of the match between the capacitive load of the oscillator circuit and the capacitive load for which the crystal was trimmed. Additional error will be added by crystal frequency drift caused by temperature shifts."

The datasheet as far as I can see, makes no claims about actual accuracy of the clock, reasonable since it's up to the user's circuit to insure correct crystal and matching caps.

By contrast, the DS3231 chip in the ChronoDot has its own crystal and caps internally, so they have control over the complete timing circuit and can make a specific claim about accuracy (+/-2 ppm over 0-40 C).
http://pdfserv.maxim-ic.com/en/ds/DS3231.pdf

A further metric is that by internal monitoring of the hive temperature you can estimate brood size (amount of new bees being raised). This requires a HUGE amount of temperature sensors to be installed within the hive. Here's where the feasibility problem and issues comes in. I'd be looking at the temperature sensor Texas Instruments TMP275 which allows for up to 8 sensors to be tied together within a bus. If we go with 8 sensors per frame, 10 frames per box, we'd be looking at 80 sensors per brood box, and the hive can eventually have 3 or 4 brood boxes once mature. So 240 to 320 temperature senors would need to be captured from 30 to 40 data buses each with 8 sensors.

How much variation do you expect across these sensors? That seems like overkill, at least to a non-beekeeper.

wildbill:
How much variation do you expect across these sensors? That seems like overkill, at least to a non-beekeeper.

I'd like to see some more information on that too. I get the idea that the OP will be able to determine what's happening where in the hive by temperature zoning. I was always under the impression that the entire hive was kept at a constant temperature, but obviously this must not be the case.

With such a large number of sensors looking for slight variations, the system will be drowning in noise and device variations. I would imagine that each sensor might need specific calibration against a known base device so that an error formula can be applied to the output of the sensor.

@OP, I haven't been ignoring you, I just was busy with tax junk and some other things. I also needed to read thru the thread. I need to do that again since I kinda flew thru it all.

I find bees amazing, my dad and his dad have raised them. I am allergic and I live in the deep south so I can't really risk getting a hive full of africanized variants that could take a notion to kill me. Otherwise I'd love to be able to study them like this.

GoForSmoke, the DS3231 chip sounds like exactly what we need for these data loggers. And the circuit for it appears pretty simple too, which is good for me. :wink:

wildbill, bees need to keep their developing larvae at specific temperatures. 34-35C is what is necessary, and theres actually some research that shows that on the lower end of that bees develop for one purpose and higher end develop for another, i.e. they can produce different kinds of workers based on tempature of just one degree. Regardless of that, the key range for brood development is that tempature. Other parts of the hive, honey storage, is not so temperature critical so they don't actively regulate tempature in those parts of the hive. So if you can temperature profile a hive you can roughly (key word is roughly) gestimate the brood size.

Sources:
http://www.pnas.org/content/100/12/7343.full.pdf

afremont, thanks for taking the time to look over my proposal. I'm expecting to know if I get my full grant or just partial funding (which probably can't support 3D temp profiling, where full would) by the end of the month. I'm going to need assistance in designing circuits, or boards. I have some help already but any and all people who want to help with the project is welcome. :slight_smile: I want to keep this thread going with updates as we go and all relevant circuits, boards, files and code to help anyone else who wants to do what I'm doing.

I agree that bees definitely need studying, they're EXTREMELY important for the health of our plants, ecology and us! Plus even if this isn't ground-breaking research, its good for undergraduates to learn the process of experiment design, data collection, and analysis. :wink:

With the sensor it should have a variance of 0.5C, correct? Would calibration of each sensor help? Is each off a specific amount that could be corrected if you knew the offset? Or is it random/variable?

Ultimately the range I'm looking for is 33-36C or 34-35C. It's a fairly narrow range, but it's not fractional of a degree but whole degrees. Obviously I need high precision sensors, but I can't afford EXPENSIVE sensors. The $1/sensor range is about my limit.

The cheap sensors are 2x closer at detecting change as they are at absolute temperature.

If your school has an Electronic Engineer department or a Physics department then check with them, they might know or cook up something you can use.

A pyrometer is based on rock that electrically polarizes when exposed to heat with the amount of polarization dependent on the temperature, sensitive enough to detect body heat. The expensive part is the electronics to read that as absolute temperature yet a PIR detector that uses the same principle gets around that expense by comparing output from 2 different pyrometers to look for difference. Suppose you had one looking in the hive and one outside, then if you have outside temperature known closely (1 expensive sensor) you can work with the comparative readings of many cheaper sensors inside versus the well known outside -- which would need calibration. You won't be able to use the PIR movement sensors as the two eyes on those are too close, but the principle may be something the physicists and EE's might get their own project out of.