Introduction: Make Your Weighing Scale Hack Using Arduino and Hx711

I am working on an application where i need to convert the weight of a person to calculate and use it for other parameter.

So i started searching the internet and found many tutorials using the load cell and arduino.

I started by opening up a bathroom scale and using the sensors available in it.

It turned out after trying with the AD620 insrumentation amplifier that i was not getting linear results and the readings were not accurate so i decided to use HX711 instead.

Also the code provided displays the weight in KG and can measure upto 120KGs.

I am publishing this instructable so it helps someone like me to make their project faster.

Step 1: Open Up the Scale.

First you need to open the weighing scale and get rid of the internal circuit to use the load sensors

Step 2: Understanding the Sensor

The load sensor found in the scale is https://www.sparkfun.com/products/10245 4 such sensors are connected in a bridge configuration.

The Sensor has 3 terminal wires as seen in the pic they are:

  1. Vcc ------ White
  2. Vss ------ Black
  3. Signal ------ Red

Generally we consider the white to be signal wire but its not its the red one

Found out my load cell was connected in a bridge configuration in image :

Step 3: Connecting Sensor to Arduino

So the sensor gives the analog voltage as an output to the arduino but the voltage level is too small to be detected by the adc of the arduino and needs to be amplified using instrumentation amplifiers like AD620 or INA125.

Also the ADC on the arduino is 10 bit which provides a maximum of 2^10 ie. 1024 readings compared to HX711 which is 24 bit ADC and easy to interface. HX711 Datasheet

The Hx711 uses SPI interface to communiacate to the Arduino. (Refer Data sheet for more info)

More info on DfRobots

Connecting to Arduino

Connection is pretty simple.

1. Connect the wires from the load sensors E+ E- on the terminals of the sensor

2. Connect the S+ and S- wires on the A+and A- terminals respectively.

3. Connect Vcc and Gnd

4. Connect the Dt terminal to A1 and Sck terminal to A0 (can be changed according to code)

Step 4: Library for Arduino

<p>//The library used for arduino  https://github.com/bogde/HX711<br>// LCD can also be used instead of serial 
#include "HX711.h"
// HX711.DOUT	- pin 10
// HX711.PD_SCK	- pin 11
HX711 scale(10, 11); // parameter "gain" is ommited; the default value 128 is used by the  library  library*/</p><p>void setup() 
{
  Serial.begin(38400);
  Serial.println("HX711 Demo");</p><p>  Serial.println("Before setting up the scale:");
  Serial.print("read: \t\t ");
  Serial.println(scale.read());			// print a raw reading from the ADC 
  
  Serial.print("read average:\t\t ");
  Serial.println(scale.read_average(20));       // print the average of 20 readings from the ADC
  
  Serial.print("get value: \t\t ");
  Serial.println(scale.get_value(5));		
// print the average of 5 readings from the ADC minus the tare weight (not set yet)
 
  Serial.print("get units: \t\t ");
  Serial.println(scale.get_units(5), 1);	
// print the average of 5 readings from the ADC minus tare weight (not set) divided by the SCALE parameter (not set yet) </p><p>  scale.set_scale(2280.f);  
 // this value is obtained by calibrating the scale with known weights; see the README for details
  scale.tare();   // reset the scale to 0
 
 Serial.println("After setting up the scale:");
 
 Serial.print("read: \t\t");
 Serial.println(scale.read());                	      // print a raw reading from the ADC
 
 Serial.print("read average:\t\t ");
 Serial.println(scale.read_average(20));       // print the average of 20 readings from the ADC
 
 Serial.print("get value: \t\t ");		
// print the average of 5 readings from the ADC minus the tare weight, set with tare()
Serial.println(scale.get_value(5));</p><p>Serial.print("get units: ");
Serial.println(scale.get_units(5), 1);      
// print the average of 5 readings from the ADC minus tare weight, divided by the SCALE parameter set with set_scale
 
Serial.println("Readings:");
}</p><p>void loop() 
{
  Serial.print("Weight :");                        
  /* ---------Weight in terms of KG-------------*/
  Serial.print(scale.get_units()*0.1 , 1);
  Serial.print("KG");</p><p>  scale.power_down();			        // put the ADC in sleep mode
  delay(5000);
  scale.power_up();
}</p>

Step 5: More Modifications and Links

You can connect a wifi module to it and upload the readings to an app or web server.

More details can be found here.

Update : 27/7/2015 : Had some issues like lcd displaying black boxes it was fixed by changing the analog pins A1,A0 to other digital pins eg (10,11) in the code.

Thanks: :)

Comments

author
PToniasso (author)2017-09-17

Hey guys, i'm doing a balance system with 4 balances to do a mass balance in a race car (a project of my university). I did all, but the balances display a wrong result. I calibrated the system (individualy) but when i put a 5kg mass in the balance (used to calibration) all display the same value, but if i mount in the balances, one same more and one same less. I don't know what's happening, could it be the cables? (i need a long cable) I'm sorry for my bad english, i'm brazilian. Please Help me! Thanks

author
suNOnin (author)2016-03-06

Hello sir,

I followed your instructions but still i get a 0 reading. Can you please help?

author
UnoA3 (author)suNOnin2017-06-10

you get 0 reading because the diagram says you connect sck to A0 and dout (dt) to A1 but inside his code he is using pin 10 for dout and 11 for sck. In order to get a result/reading you must change the HX711 scale(10, 11); to HX711 scale(A1, A0);

author
hossein keshavarz (author)2017-04-10

hello

The load sensor have three wire while in the figure there is four wires for sensor.

we must connect white and black wires to E+ and E- terminals.But only red wire left while we have two terminals A+ and A-. How do I connect one wire to two terminals.?!!!

author
dlauresta (author)2016-11-25

Hi,

After compiling the codes given, I received an error about the "yield being not declared".

What should i do? thanks

author
barbieIII (author)2016-11-16

What sensor can i use to measure the weight of a coin?

author
SamW41 (author)2016-06-09

What am I supposed to do with the black/white leads from each sensor? When only hooking up the red signal wires like you have shown here the readings are all over the place and are unusuable.

author
agr00m (author)SamW412016-06-17

Most scale sensors have 3 wires, V+, gnd and signal. You'll need to find out which are which. An easy way is to measure the resistance between each. You should get 2x the resistance across V+ and gnd as you do across V+ and signal and GND and signal.

The harder part is finding which is V+ and which ground; however, I don't think it matters too much as long as you're consistent.

author
ratheeshbr (author)2016-04-28

Can I use HX711 with one sensor and Three resistors to form the Wheat stone Bridge?

author
tomatoskins (author)2015-06-18

Really cool idea! What did you use this for?

author
KeyurV1 (author)tomatoskins2016-04-10

I have made same kind of circuit but I am getting a problem in amplifying the voltage. I have tried this with a 3 wired load sensor in which I am keeping 2 resistors on the breadboard and 2 wires (black and white) coming out of load sensor are connected to make a Wheatstone bridge and I am reading the value of voltage between red wire of load sensor and its other end in Wheatstone bridge. Now when I am applying force on load sensor then it's value are changing ( very minute change but still change I have to amplify that). Now my problem is I am able to amplify the value of the voltage but the change is so minute that it's amplification doesn't show up in comparison to the actual voltage. How should I go about it?

author
Baptiste 49 (author)KeyurV12016-04-17

Hi KeyurV1,

Firstly what tools are you using to mesure the voltage? (multimeter, oscilloscope,...)

Then I understood that you made your own wheastone bridge, so you have 4 load sensors? and what is the value (ohm) of the resistances you have plugged?

As you can read in this tutorial, we use a HX711 to amplify the very low voltage changement, does it answer your question??

Hope I'll be able to help you when you would have answer my questions! :D

author
ChipK5 (author)tomatoskins2015-10-24

I received always this error .

How can i solve this error?

Thanks your reply

^

C:\Users\Kotesz\Documents\Arduino\pontosabb_scale\pontosabb_scale.ino: In function 'void setup()':

pontosabb_scale:14: error: 'scale' was not declared in this scope

Serial.println(scale.read()); // print a raw reading from the ADC

^

C:\Users\Kotesz\Documents\Arduino\pontosabb_scale\pontosabb_scale.ino: In function 'void loop()':

pontosabb_scale:49: error: 'scale' was not declared in this scope

Serial.print(scale.get_units(), 1);

^

exit status 1

'scale' was not declared in this scope

author
Baptiste 49 (author)ChipK52016-01-24

Hello,

I hope you have fixed up your issues since 3 months...

But if you don't maybe it can be due to :

> HX711 librarie was not imported in arduino IDE

or :

> you are calling scale.read() outside of setup() or loop() functions...

Hope it can help, contact me if you still have bugs ;)

author
NileshK20 (author)Baptiste 492016-03-27

Hello do you have any idea which sensor to use for 100Kg weigh

author
Baptiste 49 (author)NileshK202016-03-28

Hi ☺

You can find weight (or load) sensors here :
https://secure.robotshop.com/en/type-s-load-cell-100-kg.html
or here :
https://www.sparkfun.com/products/13332

Firstly it depend of how much you are ready to invest into a load sensor !
Then it is your choice to buy rather on a DIY website or elsewhere such as alibaba etc...
Also use search engine, just type 'weight sensor 100kg' in the search box you will find tones of websites !

Finally I highly recommand you to take car about the "shape" of the sensor (because you have to fix it to something stable).

Have a nice day and tell us about your achievements ; )

author
SohamG (author)tomatoskins2015-06-18

This is going to be used for calculating bmi (body mass index) of the person.

author
KeyurV1 (author)2016-04-10

I have made same circuit but I am getting a problem in amplifying the voltage. I have tried this with a 3 wired load sensor in which I am keeping 2 resistors on the breadboard and 2 wires (black and white) coming out of load sensor are connected to make a Wheatstone bridge and I am reading the value of voltage between red wire of load sensor and its other end in Wheatstone bridge. Now when I am applying force on load sensor then it's value are changing ( very minute change but still change I have to amplify that). Now my problem is I am able to amplify the value of the voltage but the change is so minute that it's amplification doesn't show up in comparison to the actual voltage. How should I go about it?

author
SamW41 (author)2016-02-16

I keep getting the error "Serial does not name a type" for each Serial.PrintIn. What do I do?

author
matti.virta.1 (author)2016-01-21

how i can connect thats relay and adding code row, (read kg if value x stop relay)

or better have how made code ? select weight 1-1900gram, set point, button RUN on relay(pump) and then pottle have full value X end relay)

can somebody help, im newbie and not understan code lot, example here then i can test and understand how working and change values what my project need. i have load cell 4 wire part and hx711 amplified and nano and uno board. and i2c LCD and button&key LCD button board.

author
ShaneH26 (author)2015-12-30

I found this link useful: http://electronics.stackexchange.com/questions/199487/connect-hx711-to-a-three-wire-load-cell

author
ajinvthomas (author)ShaneH262016-01-15

thanks

author
ShaneH26 (author)2015-12-29

The HX711 has pins for 2 load cell sensors. Please explains specifically which wires: Red(Signal) , Black (Positive-Vss), and White(Negative-Vcc) from the load sensors connect to which pins on the chip (E+, E-, A-, A+,B-, B+). Example Solution: Sensor 1: Black1 to E+, White1 to E-, and Red1 to A-. Sensor 2: Black2 to A+, White2 to B-, and Red2 to B+. Please advise.

IMG_1326.JPG
author
SohamG (author)ShaneH262015-12-29

hi shane

You need to 4 such sensors to build a Wheatstone bridge configuration as shown in figure in the beginning. After that you will get 4 wires which can be connected to E+ E- A+ A - . Hx711 has 2 channels A and B out of which we are using only the first one.

Hope this helps.

Get back to me if you have any other queries.

author
ShaneH26 (author)SohamG2015-12-29

The HX711 has pins for 2 load cell sensors. Please explains specifically which wires: Red(Signal) , Black (Positive-Vss), and White(Negative-Vcc) from the load sensors connect to which pins on the chip (E+, E-, A-, A+,B-, B+). Example Solution: Sensor 1: Black1 to E+, White1 to E-, and Red1 to A-. Sensor 2: Black2 to A+, White2 to B-, and Red2 to B+. Please advise. I have actually have 4 such sensors, but would like to only configure 2 for my project.

IMG_1326.JPG
author
sino93 (author)2015-08-02

To me it looks like you mixed a lot of things and i can't figure it out.

So, i have the same sensor (https://www.sparkfun.com/products/10245) with BLACK, WHITE, and RED wire. And i have a different bridge which has: RED/E+, BLACK/E-, WHT/A-, GRN/A+, YLD/SD.

How do i hook them up?

author
SohamG (author)sino932015-08-08

Which sensor are you going to use?

If you are using the sparkfun sensors then you need to connect 4 sensors in bridge configuration as shown.

Else if you are using the other one it can be directly connected to the HX711.

Let me know if you need more info

Thanks

author
ShaneH26 (author)SohamG2015-12-29

can you clarify how to connect the wires to the chip? see above post

author
sino93 (author)SohamG2015-08-11

I have the sparkfun sensor(3 wires) and i only need one sensor. And this is the bridge i can get my hands on: http://www.robofun.ro/senzori/forta/amplificator-celula-de-sarcina-hx711

About This Instructable

130,626views

56favorites

License:

More by SohamG:Arduino 433Mhz Wireless Communication Rc SwitchMake your weighing scale hack using arduino and hx711
Add instructable to: