How to Build Arduino Weighing Scales

71,335

95

28

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 DT

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

2 People Made This Project!

Recommendations

  • Pi Day Speed Challenge

    Pi Day Speed Challenge
  • Trash to Treasure Contest

    Trash to Treasure Contest
  • Microcontroller Contest

    Microcontroller Contest

28 Comments

0
The57
The57

Question 6 weeks ago on Step 3

Bonjour , j'aimerais savoir si il y a un code couleur pour le branchement des fils .

Merci d'avance

0
p_leriche
p_leriche

Answer 4 weeks 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.

0
Jan-OlofF
Jan-OlofF

Question 2 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 :-)

0
Terragrub
Terragrub

Answer 4 months 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,

0
belliramalho
belliramalho

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

0
p_leriche
p_leriche

Reply 8 months 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.

0
KarlSemich
KarlSemich

Question 11 months 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.

0
p_leriche
p_leriche

Answer 11 months ago

Thanks for pointing it out - it should be fixed now though you might have to refresh the page.

0
ImmortalSoFar
ImmortalSoFar

1 year 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.

0
p_leriche
p_leriche

Reply 1 year ago

Sounds like a great idea! I hope it works out well.

0
ai3xb
ai3xb

Question 1 year ago

Great instructable. Can I ask how accurate your 4 load cells ended up being? I'm looking at only weighing things up to 1kg with 0.1g accuracy but for practical reasons it would be far easier to build it with a cell on each corner rather than a single bar in the middle.

0
p_leriche
p_leriche

Answer 1 year ago

Firstly it'll obviously depend on the accuracy of your calibration weight, but beyond that there are several factors to consider such as non-linearity, hysteresis and temperature effects. Google for Load Cell Accuracy and you'll find plenty of info to guide you.

0
axelfoeley
axelfoeley

1 year ago

A very easy to go instruction. Connected all as you said. Even though I used a Teensy 3.5 insted of an Arduino the code worked from the first flash and first try.
I´m impressed. Thanks

0
mats.bjonnes
mats.bjonnes

Question 1 year ago

Would it be possible to add a lcd screen showing the results?

0
p_leriche
p_leriche

Answer 1 year ago

Yes, of course it would! But it's beyond the scope of this project to show you how.

Look on ebay for Arduino LCD Module
and you'll find several types, all very cheap.

The cheapest are 16 character by 2 line or (20 by 4) modules which require 7 Arduino pins to drive them. That may not leave enough left for the HX711 module plus a couple of pins for push buttons you'll probably want. For just a little more you can get the same thing with a little adapter attached allowing you to drive it as an I2C (or IIC) device, using only 2 pins.

Alternatively for a similar price you can get a 128x64 pixel graphic OLED module which can display characters of various sizes and simple monochrome graphics, and again uses IIC with only 2 Arduino pins. But at a little under an inch square, the display is quite small.

For either type there are Arduino libraries available which make them easy to drive. The libraries also include examples. When you've decided which type you want to go with a bit of research online should throw up Instructables or other website that'll help you. Have fun - lots of it!

0
VinodMishra
VinodMishra

1 year ago

Very useful for me. But I have a problem, I have to made weighing scale with 4 loadcell. how is it possible ? Please help. Thanks in advance.

0
p_leriche
p_leriche

Reply 1 year ago

See Step 4: How to use 3-wire load cells. Connect the 4 together as described.

0
jupa1804
jupa1804

1 year ago

Hi there! First of all, thanks for share you made an excellent work! In a subject of my university i have to do a project like this, but i need to make a NI LABview interface from where i can reset the weighing machine, see the exact value, etc. I don´t have any knowledge about it :c ... Have you use this program? Any help it's welcome. Thanks for all, by the way

0
p_leriche
p_leriche

Reply 1 year ago

I'm sorry but I don't know anything about LABview. Googe is your friend. The key to getting the right answer out of Google is to ask the right question.

0
agus perdanas
agus perdanas

Question 1 year ago

Hi, Thank's for your Post. How take value of calibration?