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

Ready for outdoor use

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 made about 5lb of Honey that day

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

About these ads

24 Responses to “Beehive scale build details. finally”

  1. Sweet! :)

  2. 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?

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

  4. Cool project!

    One question: Do you compensate for temperature changes?

    • makingthingswork Says:

      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

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

    • TechMaster Says:

      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?

  6. TechMaster Says:

    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?

    • makingthingswork Says:

      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.

  7. [...] 17.3.2012: Eine Bienenwaage mit gehackter elektronischer Körperwaage. Und noch ein Körperwaagenhack. Nachtrag [...]

  8. 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…

    • makingthingswork Says:

      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.

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

    • makingthingswork Says:

      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.

      • It looks like each load scale has three wires. Are they pwr, gnd, and sensor output? If so, do the four sensor output wires (one from each load cell) make up the V+, V-, S+ and S-?

        Thanks…

  10. Will this ever become a product since I do not have your electronic skills?

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

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

  13. This article will help the internet visitors for setting
    up new blog or even a blog from start to end.

  14. Hey there! I know this is kind of off topic but I was wondering if you knew where I could locate a captcha plugin for my comment form?

    I’m using the same blog platform as yours and I’m having problems finding
    one? Thanks a lot!

  15. Thanks for a marvelous posting! I certainly enjoyed reading it, you are a great author.
    I will be sure to bookmark your blog and definitely will come back down
    the road. I want to encourage one to continue
    your great job, have a nice weekend!

  16. Is Version 2 operational? Any further info?

    I would like to learn more about connecting a scale… Thanx for your post.

  17. William Says:

    Hi – realise you haven’t been active here for a while but I would like to do something very similar and am trying to get to grips with it all. I too would like to use an arduino and GSM shield for remote monitoring. Have you made progress on your next design? also, I understood that the load cells from standard scale do not take being loaded for a long time very well? I thought there was some element of ‘creep’? thanks

  18. how much would it cost if I ask you to help build 20-30 of these? Thanks.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: