Introduction: How to Build Arduino Weighing Scales
At the Restart Project in London we hold repair events where members of the public are invited to bring in all manner of electrical and electronic items for repair, so as to save them from landfill. A few months ago (at an event I didn't actually attend) someone brought in some faulty kitchen weighing scales which nobody could fix.
Never having seen inside any digital weighing scales and not knowing how they work, I took it as a challenge to research them, in the process, building two versions of my own.
If you wish to build your own weighing scales or incorporate a weighing function in a wider project, you can use this Instructable as a basis, whatever your requirements, from weighing fractions of a gram up to many kilograms.
Hence I will concentrate on the electronics, the software and the underlying principles. How you realise your own project is completely up to you.
I will also show you how to calibrate them, even if you don't have any standard weights.
Having done my research and having validated it by building my own scales, I wrote up the principles of weighing scales, including whatever I could deduce about fault-finding, in the Restart Project Wiki. Go and take a look!
Step 1: Choosing Your Load Cells
All digital weighing scales are built around either a 4-terminal load cell or four 3-terminal load cells. Which to get depends on what sort of scales you want to make. They are all electrically compatible and fairly cheap so you can change your mind later, or get more than one type to experiment with.
For kitchen or postal scales with a maximum load in the range of 100g to 10kg, you can get 4-terminal load cells consisting of an aluminium bar. This is mounted horizontally, supported at one end and supporting the weighing platform at the other. It has 4 strain gauges attached to it. I explain fully how it works in my wiki article so I shan't repeat it here.
These are less suitable for heavier loads such as bathroom scales, where a person's full weight, not necessarily centred on the platform, is better supported by 4 load cells supporting the 4 corners of the platform.
This is where four 3 terminal load cells are more suitable. Ones rated at 50kg each are widely available, which together will weigh up to 200kg.
Others with even higher ratings are designed for suspending the weight to be measured after the fashion of luggage scales
Step 2: What Else You Need
In addition to your load cell or load cells, you will need:
- An Arduino. You can use virtually any type you like but I used the Nano as it has the USB interface built-in and still only costs a few pounds.
- A HX711 module. This may come bundled with your load cell but is available very cheaply as a separate item from many sources.
- For prototyping, a 400 point breadboard, jumper leads, pin and socket strips.
You will also need wood, plastic, screws, glue, or whatever you require for your particular version of the project.
Step 3: Preparing the Parts
To use the HX711 module on the breadboard, solder a 4-wide pinstrip to the interface pins (GND, DT, SCK, VCC) of the HX711.
For easy connection and disconnection of the load cell (particularly if you're experimenting with more than one sort) solder a 6-wide pin socket strip to the analogue pins. (You only need the E+, E-, A- and A+ pins but I fitted a 6-wide strip anyway in case I wanted to experiment with the other two.)
If you are using a 4-wire load cell you will then need to solder the 4 leads from the load cell to a 4-wide pin strip. The first two pins will be E+ and E- and the other two A- and A+. I taped over the solder joints with PVC tape to protect them. A mark on one end and a corresponding mark on the pin socket means I know which way round to connect it, though I don't think it matters.
Different load cells colour code the wires differently, but it's easy to tell which is which. With a test meter on a resistance range, measure the resistance between each pair of wires. There are 6 possible pairs of 4 wires but you will only get 2 different readings. There will be 2 pairs which read 33% more than the other 4, say, 1,000Ω instead of 750Ω. One of those pairs is E+ and E- and the other is A+ and A- (but it doesn't matter which).
Once you get everything working, if the scale reads a negative weight when you put something on it, swap E+ and E-. (Or A+ and A- if it's easier. But not both!)
Step 4: How to Use 3-wire Load Cells
If you are using four 3-wire load cells you will have to wire them us together with a piece of stripboard, and take the E+, E-, A+ and A- connections from the combination.
Since the wire colours of yours may be different from mine, let's call the 3 wire colours of each load cell A, B and C.
With a test meter on a resistance range, measure the resistance between each pair of wires. There are 3 possible pairs, but you will only measure 2 different readings. Identify the pair that reads twice either of the other two. Call this pair A and C. The one you left out is B. (The resistance between B and either A or C is half the resistance between A and C.)
Simply stated, you need to wire the 4 load cells in a square, with the A wire of each connected to the A wire of its neighbour, and the C wire to the C wire of its neighbour on the other side. The B wires of two load cells on opposite sides of the square are E+ and E-, and the B wires of the other pair are A+ and A-
Step 5: Wiring Up the Breadboard
Wiring up the breadboard is very simple, needing only 4 jumpers. The Fritzing library only offered me a slightly different version of the HX711 module from mine but the wiring is the same. You can follow the diagram, or if you're using a different Arduino, wire it up as in the table below:
Arduino Pin HX711 Pin 3V3 VCC GND GND A0 SCK A1 DTStep 6: Mounting the Load Cells
The aluminium bar type of load cell has two threaded holes in each end. You can use one pair to mount it on a suitable base with a spacer in between. The other pair you can use in the same way to mount a weighing platform, again, with a spacer. Just for experimental purposes you can use whatever pieces of scrap wood or plastic you have to hand, but for a polished end product you will want to take more care.
The easiest way to mount the four 3-wire load cells is between two pieces of chipboard. I used a router to make 4 shallow indentations in the base so as to positively locate the four cells. In my case the indentations needed a slightly deeper central well so that two rivets on the bottom didn't rest on the base.
I used a hot melt glue gun to hold the load cells in place on the base and also to fix the stripboard onto the base in the middle. I then pressed the weighing platform hard down on them so that the pimples on the tops of the load cells made slight indentations. I deepened these with the router and checked they still aligned nicely with the load cells. I then put hot melt glue on and around each indentation and quickly pressed the weighing platform onto the load cells before the glue hardened.
Step 7: Programming the Arduino
I assume you have the Arduino IDE installed on your computer and know how to use it. If not, check out one of the many Arduino tutorials - that is not my purpose here.
From the IDE drop-down menus, select Sketch - Include Library - Manage Libraries...
Type hx711 in the search box. It should find HX711-master. Click Install.
Download the attached file HX711.ino example sketch. From the IDE File drop-down menu, open the file you just downloaded. The IDE will say it needs to be in a folder - allow it to put it in one.
Compile and upload the sketch, then click on the serial Monitor in the IDE.
Below is some example output. In the initialisation phase it displays an average of 20 raw readings from the HX711, then sets the tare (i.e. the zero point). After this it gives a single raw reading, an average of 20 and an average of 5 less the tare. Finally, an average of 5 less the tare and divided by the scale factor to give a calibrated reading in grams.
For each reading it gives the calibrated average of 20, and the standard deviation. The standard deviation is the rage of values within which 68% of all measurements are expected to lie. 95% will lie within twice this range and 99.7% within three times the range.It's therefore useful as a measure of the range of random errors in the result.
In this example, after the first reading I placed a new pound coin on the platform, which should weigh 8.75g.
HX711 Demo<br>Initializing the scale Raw ave(20): 1400260 After setting up the scale: Raw: 1400215 Raw ave(20): 1400230 Raw ave(5) - tare: 27.00 Calibrated ave(5): 0.0 Readings: Mean, Std Dev of 20 readings: -0.001 0.027 Time taken: 1.850Secs Mean, Std Dev of 20 readings: 5.794 7.862 Time taken: 1.848Secs Mean, Std Dev of 20 readings: 8.766 0.022 Time taken: 1.848Secs Mean, Std Dev of 20 readings: 8.751 0.034 Time taken: 1.849Secs Mean, Std Dev of 20 readings: 8.746 0.026 Time taken: 1.848Secs
Step 8: Calibration
The Arduino sketch in the previous step contains two calibration values (or scale factors) relating to my 1kg and my set of four 50kg 3-wire load cells. These are on lines 19 and 20. You will need to perform your own calibration, starting with any arbitrary calibration value such as 1 (on line 21).
I didn't have any standard weights, so for the 1kg load cell I used a new £1 coin, which weighs 8.75g. Ideally you should use something weighing at least a tenth of the scale's maximum.
Find something - anything - of a roughly suitable weight. Take it down to your local post office, pretend you need to post it, and put it on the scales there and make a careful note of the weight. Or you could take it to a trader such as a friendly local greengrocer. Any reputable trader should have their scales calibrated regularly to comply with trading standards.
You now have an object of known weight. Place it on your scales and note the reading. Multiply your current scale factor by the reading you got and divide the result by what the reading should have been, whether in grams, kilograms, pounds, micro-elephants or whatever units you choose. The result is your new scale factor. Try your know weight again, and if necessary, repeat the process.
39 Comments
2 years ago
hi, I am just wondering if i could get in contact to ask some questions about a school project similar to this.
Reply 2 years ago
could an Arduino Uno board be used instead of a bread board?
Reply 2 years ago
Yes, of course, almost any Arduino. You just need a breadboard for the small form factor ones which you can't easily wire up otherwise.
Reply 1 year ago
Hi. I wanted to make a variant of this- to enable keypad entry of a multiplier which would show both the weight and the product on the screen. What need I modify on the set up and coding to achieve this?
Reply 1 year ago
You'll have to do your own research for this. Search online for Arduino keypad and you should find a few projects that'll give you a head start. But you'll have to roll up your sleeves and be prepared to do a bit of your own coding. Don't be afraid - it's not hard, and quite a lot of fun. Perhaps start by finding and following one or two Arduino tutorials.
Reply 2 years ago
By all means ask what you like!
Reply 2 years ago
where would you buy these components in Australia? Because I can't seem to find a load cell anywhere (or does it have alternative names?) Also can you use an Ardunio uno instead of a bread board?
Reply 2 years ago
I'm afraid I have no direct knowledge of the antipodean market but I'm sure you should be able to find all you need on eBay, either from local sellers (if they exist) and if not, from the Far East.
2 years ago
Hello,
nice project!
I could realize a first draft setup quite easily... only point is that I think that your figure on step 4, about wiring the 4 3-wides load cells, has a bug: the A terminals are connected cross wise, and if one follows that exactly (as I did at first) then the readouts are not good, they come out all zeroes... (after the first setup lines). Instead your text and the scheme given in the wiki link are good and specify that the A and C terminals should connect to opposite cells on the sides of each cell. After changing that it all worked. I see actually the comment of somebody having all zero readings, he/she might have done the same as me...
Bye
Daniel
Reply 2 years ago
Thank you Daniel, and sorry for taking a little while to reply. You're dead right, and I've changed the diagram accordingly. Does that look right now? Amazing that it's taken 3½ years and nearly 75,000 pairs of eyes to spot this - you get teacher's gold star!
Reply 2 years ago
Hello. Thanks for your kind answer. I also hesitated before posting a comment after seeing nobody had noticed it since a long time! I thought I was getting something wrong. Anyway, the scheme looks good to me now.
Question 2 years ago on Step 3
Bonjour , j'aimerais savoir si il y a un code couleur pour le branchement des fils .
Merci d'avance
Answer 2 years ago
Autant que je
sache il n’y en a pas, mais identifier les fils est très simple avec un
multimètre numérique comme je le décris. Si vous n’en a pas, va en acheter tout
de suite ! L’un le plus bon marché fera parfaitement l’affaire.
Question 5 years ago
wow - have I found what I´m looking for ?
I´m a beekeeper and is looking for a cheap scale that can be placed under my
beehives to measure the progress of my busy friends ...
1) Can this set-up be use under permanent load - eg tara set once and then
when I come back 2 days/weeks/months later it shows the present weight.
I mean it if difficult to set tara each time as I need to lift the hive a side and
back again ... They are pretty heavy if my bees have done their job :-)
2) Can I have the powerless loadcells in the hive and then connect the Ardino/Electrical
part one hive at the time. E.g have just one Ardino and a lot of loadcell units.
If so do I need to restart etc between each - how much fuzz would it be to
get the weight from 10 hives lined up with premade cable connectors to each load cell units
one at the time ?
Should I dig into this or is this not really what I´m searching for ? :-)
I have made an attempt that I gave up so I have loadcells allready :-)
Answer 3 years ago
Very interested if you ever completed this project for your Bee hives?
I'm also a beekeeper and looking to have a scale on my hive as well.
Thanks,
3 years ago
Hello, My prototype is a 4 load cells and apparently I assembled it all correctly but the readings are always zeros. I replaced the HX711 module, the load cells and the Arduino board but still reading zeros. Not sure what else to try to fix it.
Reply 3 years ago
Hmm... hard to know what to suggest. But if it's truly reading zero then that implies the Arduino isn't communicating with the HX711 properly rather than a problem with the load cells or their wiring - maybe the pin numbers are wrong or one of the Arduino pins is dead (less likely). You double-checked everything, didn't you? Now check it again, having put it aside for a few days. If you're still puzzled, try explaining it all to your granny - she might not understand a word of it (though some amazing grandmothers might!) but the process of explaining it to someone else often turns on the light bulb in your head.
Question 3 years ago on Introduction
Hi,
The link to the wiki page on the restart project is broken. I found a new restart wiki but can't find the page on it. Could you fix the link?
Thanks so much.
Answer 3 years ago
Thanks for pointing it out - it should be fixed now though you might have to refresh the page.
3 years ago on Step 2
I'm doing a self-conversion of a van into a full-time camper, fixing all of the annoying things I've put up with in pre-built ones. As well as networking the entire system to simplify wiring and modularise the system, I'm correcting the damned water gauges.
Normally, these have three electrodes up the side of the tank to show which third the fresh/gray water is currently covered. For my version, I have two 40L detachable tanks and I'm going to use the weight (1L of water weighs 1Kg) to more accurately indicate the state of water, broadcasting the result across the internal network.
Just another possible use for this.