Beehive scale build details. finally
I’ve put this off for a while, but here’s all the details!
Summary: I made (and you probably can too!) a scale that is readable via USB with better than 1lb resolution for less than $50. I have been using it to track the weight of my beehive, and year-to-date, they have produced over 150lb of honey!
Long version (pictures/schematics/code near the bottom):
A while back, I hacked together a bathroom scale, instrumentation amp, and attiny85 to make a device that could weigh my beehive and report how much it weighed. It taught me a lot about electronics and bees, so i thought i’d share the details with everyone.
Surprisingly it was very inexpensive ($40-$50 US) for the parts, and has been working well for 9 months or so.
The project works as follows:
* An attiny85 (8 pin) is the brains of the operation, and uses the V-usb project to emulate USB. This is the interface to the computer. ~$3
* A standard bathroom scale is taken apart and wired up to the electronics, and placed under the hive. ~$25
* A 15′ usb cable has the end cut off of it, and is wired to the attiny. ~$5 (this is connected to the PC, for power and scale readings)
* A small fet used as a low-side switch turns the scale/amp on and off, to prevent it from warming up (probably not necessary), but also saves power ~$1
* an instrumentation amp (INA136 or INA138 i believe) amplifies the signal from the scale to the level where it can be read by the 10 bit ADC on the attiny. ~$6
* a fixed voltage divider (potentiometer) provides a reference for error compensation, and feeds into a different ADC channel ~$1
* when a read is requested, the attiny turns the fet on, waits a few seconds, then reads the scale and the voltage reference 32 times, and stores that data
* later, the results are read by the PC and graphed.
Weighing setup:
The scale is just a standard bathroom scale, which i removed the brains from and am using only the analog electronics… basically just the strain gauges and their attached wires.
The scale has a wiring harness which connects all the strain gauges, and terminates in 4 wires: E+, E-, S+, S-. E stands for ‘excitation’, and S stands for ‘sense’.
Apply a voltage difference across E+ and E- (eg 3V, 5V, or 10V), then read the voltage difference between S+ and S-. It’s very basic and quite simple. The main problem to solves is that the maximum difference between S+ and S- is about 6 mV, and needs to be amplified several hundred times to be usable on a 10-bit adc. The scale I got (cheapie on eBay) happened to report 6mV at the maximum reading, and go all the way down to 0mV as weight was added. I happened to get a little more resolution out of the scale by turning the gain up on the amp so that it read max ADC voltage at around 60lbs. Since the beehive will always weigh over 60lbs, this won’t impact my data at all and i get better resolution out of it.
Read some my other, older blog posts for more info, but i had to spend a long time calibrating the scale. the system has a /very/ strong temperature coefficient. I probably spend 5 weeks with the scale in the garage with between 45 and 90 lbs on it, trying to figure out how to get it to produce a flat reading.
In the end, I determined that the voltage swings were primarily due to the attiny, and by setting up a voltage divider to produce a fixed voltage, i was able to compensate for the fluctuations. With the current setup, i am able to get readings at about +/- .5 lb of accuracy, even though the resolution is much better than that. For the purposes of beekeeping, this is just fine. My next version will be much better, I hope :)
There are a few critical things i will do differently for my next scale (currently under design)
* get a really clean voltage source. The current model uses the 5v signal from the USB bus for power. This is a noisy signal, and may fluctuate with temperature (or it may be the voltage reference on the attiny). Any voltage fluctuation will alter the reading on the scale somewhat.
* I am also using the internal voltage reference on the attiny. This does not seem to be a good idea.
* don’t use the voltage reference or ADC on the attiny. It’s not good enough for precision work, at least in my experience. It also seems to have an affinity for even-numbered readings (eg binary numbers ending in 0).. so call it a 9bit ADC :)
* use an ADC with a low thermal coefficient, and/or built in voltage reference. I have been experimenting with a purpose-built chip from TI which is made to be a strain gauge ADC. It is 24bit and costs about the same as the instrumentation amp i used. So far it is working very well. This simplifies things somewhat.
Eagle files:
scale-no-vreg-2.sch
scale-no-vreg-2.brd
Code
hostcode.tar.gz libusb interface
tinycode.tar.gz attiny code
Some pictures:
Raw scale, showing strain gauges. Why yes, that is an old macbook power supply case

Scale is the yellow thing at the bottom of the hive.. sorry the picture is sideways

.. and some graphs:
Nice day in spring.. 5lb of weight (nectar/honey) gained

They swarmed.. 7lb of bees went out, 5lb of which were later recaptured

As of may, here’s a cleaned up graph of overall honey production


September 16, 2011 at 2:01 pm
Sweet! :)
September 20, 2011 at 4:49 pm
Man! I thought about this a long time ago, but I thought that the scale would fall out of calibration. Now that I see it works I’ll have to try it! What was the maximum weight that your scale can measure?
September 21, 2011 at 4:03 am
Nice job. Excelent graphs. I would surely like to have one like this.
But it seems to difficult to make by myself. Have to find a simpler solution.
September 21, 2011 at 4:16 am
Cool project!
One question: Do you compensate for temperature changes?
September 25, 2011 at 4:39 pm
yes, temperature compensation is a must.. See other posts on this blog, i did a lot of stuff.
Regarding the maximum weight.. it’s limited by the analog circuitry on the scale.. About 330lb, which is plenty. I don’t think it’s been much over 210lb
September 26, 2011 at 5:04 am
Thank you for posting in such detail. I found you via HackaDay and it is of gr8 interest to the Nanode ( like and Arduino with Ethernet) group who have been looking a sensing for bee-keepers in conjunction with Pachube.com
Mike
February 21, 2012 at 9:01 am
Could you tell us a little more about the scale/load cell you used? All the electronic scales I’ve taken apart have a system of steel arms that transfer force to a single load cell, but, yours seems to have four separate load cells.
What TI part number is this that your are using? Is it one of the LMP90k series?
February 21, 2012 at 9:15 am
sorry mike, that should have been a direct response to the author
Could you tell us a little more about the scale/load cell you used? All the electronic scales I’ve taken apart have a system of steel arms that transfer force to a single load cell, but, yours seems to have four separate load cells.
What TI part number is this that your are using? Is it one of the LMP90k series?
January 3, 2013 at 11:28 am
I just bought a glass bathroom scale that had a load cell at each corner. It was ~$20 on eBay. Most of the glass scales have 4 load cells
I’ll post details on the TI chip in the future. I’ve got it sort of working but it’s a lot more complex than this project.
March 17, 2012 at 8:05 am
[...] 17.3.2012: Eine Bienenwaage mit gehackter elektronischer Körperwaage. Und noch ein Körperwaagenhack. Nachtrag [...]
October 12, 2012 at 2:00 am
Great, and very useful stuff (for bee keapers)
I plan to build one for my bees :)
But can it be done with Arduino instead of attiny45!? (because of the GSM shield for arduino, it would be VERY nice to get daily reports on intensive bee pastures 100 miles away…)
Thank you very much…
January 3, 2013 at 11:29 am
I think it would probably work on the arduino but you’ll need to modify a bunch of the code to use different pins and registers etc. V-USB is just a reporting mechanism and you can probably skip all that if using arduino.
November 12, 2012 at 1:58 am
How are the strain gauges connected ? Each one has 3 wires. I opened a bath scale and it has 4 sensors and there are 3 wires from each one of them connected in different places over the main lcd board.
January 3, 2013 at 11:31 am
That’s the great thing about buying a pre-made scale. All the complicated balancing and calibrating has already been done (in theory) by the manufacturer.
On my scale all 4 load cells were already connected to a little PCB with resistors etc. The little PCB had 4 pins by which it connected to the main scale controller board. Some testing revealed that this was V+, V-, S+, S-.. everything you need.
I’ve done this with 2 scales so far and they were both very similar in this regard.
February 10, 2013 at 5:57 am
Will this ever become a product since I do not have your electronic skills?
April 15, 2013 at 5:24 am
Fantastic web site. Lots of helpful information here.
I’m sending it to a few pals ans additionally sharing in delicious. And of course, thank you on your sweat!
May 2, 2013 at 9:36 pm
Hey I know this is off topic but I was wondering if you knew of any widgets
I could add to my blog that automatically tweet my newest twitter updates.
I’ve been looking for a plug-in like this for quite some time and was hoping maybe you would have some experience with something like this. Please let me know if you run into anything. I truly enjoy reading your blog and I look forward to your new updates.