Arduino Scale With 5kg Load Cell and HX711 Amplifier

71,309

73

28

This Instructable describes how to make a small weighing scale using readily available off the shelf parts.

Materials needed:

1. Arduino - this design uses a standard Arduino Uno, other Arduino versions or clones should work also

2. HX711 on breakout board - This microchip is specially made for amplifying the signals from load cells and reporting them to another mircocontroller. The load cells plug into this board, and this board tells the Arduino what the load cells measure.

3. 5kg load cell - Load cells are specially shaped metal parts that have strain gauges glue to them. The strain gauges are resistors that change their resitance when they are bent. When the metal part bends, the resistance of the load cell changes (the HX711 measures this small change in resistance accurately). You can buy both the HX711 and load cell here: https://www.amazon.com/Degraw-Load-Cell-HX711-Combo/dp/B075317R45/

If you do purchase the kit please leave a review! It is really helpful for future buyers.

4. Sturdy flat mounting surface (x2) - a stiff piece of hardwood or metal is ideal.

5. Wires in various colors for connecting all the parts

6. Power supply for Arduino

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Mount the Load Cell

First we are going to mount the load cell. Your mount will be unique, but here are the guidelines you need to follow:

1. The aluminum load cell should have 4 tapped holes and a label showing the direction of force.Mount the side without the label to the fixed surface and mount the side with the label to the moving surface. The arrow on the labeled side should point down in the direction the platform will move when a load is applied.

2. The mounting plate and the moving plate should both be as rigid as possible

3. Make sure to put some form of rigid spacers between the mounting plates and the load cell. Standoffs or washers both work well. The goal is that any force applied to the moving plate causes the load cell to bend and twist. Without spacers, load would be transferred directly from the moving plate to the fixed plate without affecting the load cell.

Step 2: Wire the Load Cells and HX711

See the wiring diagram for how to connect the load cells, HX711, and Arduino.

On aluminum load cells, multiple strain gauges are already wired together to for a Wheatstone bridge. All you need to do is connect the wires to the HX711 board in the correct orientation.

Step 3: Add HX711 Library to Your Arduino IDE

The HX711 library is available here: https://github.com/bogde/HX711

See this link on the Arduino website for instructions on how to add the library to your Arduino IDE: https://www.arduino.cc/en/Guide/Libraries

Step 4: Calibrate and Weigh!

Sparkfun has great Arduino programs to run the scale. The most up to date versions are available on GitHub and reprinted below: https://github.com/sparkfun/HX711-Load-Cell-Amplifier

The first software step is to determine calibration factors for the scale. To do this, run this code:

/*
 Example using the SparkFun HX711 breakout board with a scale
 By: Nathan Seidle
 SparkFun Electronics
 Date: November 19th, 2014
 License: This code is public domain but you buy me a beer if you use this and we meet someday (Beerware license).
 
 This is the calibration sketch. Use it to determine the calibration_factor that the main example uses. It also
 outputs the zero_factor useful for projects that have a permanent mass on the scale in between power cycles.
 
 Setup your scale and start the sketch WITHOUT a weight on the scale
 Once readings are displayed place the weight on the scale
 Press +/- or a/z to adjust the calibration_factor until the output readings match the known weight
 Use this calibration_factor on the example sketch
 
 This example assumes pounds (lbs). If you prefer kilograms, change the Serial.print(" lbs"); line to kg. The
 calibration factor will be significantly different but it will be linearly related to lbs (1 lbs = 0.453592 kg).
 
 Your calibration factor may be very positive or very negative. It all depends on the setup of your scale system
 and the direction the sensors deflect from zero state
 This example code uses bogde's excellent library:"https://github.com/bogde/HX711"
 bogde's library is released under a GNU GENERAL PUBLIC LICENSE
 Arduino pin 2 -> HX711 CLK
 3 -> DOUT
 5V -> VCC
 GND -> GND

 Most any pin on the Arduino Uno will be compatible with DOUT/CLK.

 The HX711 board can be powered from 2.7V to 5V so the Arduino 5V power should be fine.

*/

#include "HX711.h"

#define DOUT  3
#define CLK  2

HX711 scale;

float calibration_factor = -7050; //-7050 worked for my 440lb max scale setup

void setup() {
  Serial.begin(9600);
  Serial.println("HX711 calibration sketch");
  Serial.println("Remove all weight from scale");
  Serial.println("After readings begin, place known weight on scale");
  Serial.println("Press + or a to increase calibration factor");
  Serial.println("Press - or z to decrease calibration factor");
  
  scale.begin(DOUT, CLK);
  scale.set_scale();
  scale.tare(); //Reset the scale to 0
  
  long zero_factor = scale.read_average(); //Get a baseline reading
  Serial.print("Zero factor: "); //This can be used to remove the need to tare the scale. Useful in permanent scale projects.
  Serial.println(zero_factor);
}

void loop() {

  scale.set_scale(calibration_factor); //Adjust to this calibration factor
  Serial.print("Reading: ");
  Serial.print(scale.get_units(), 1);
  Serial.print(" lbs"); //Change this to kg and re-adjust the calibration factor if you follow SI units like a sane person
  Serial.print(" calibration_factor: ");
  Serial.print(calibration_factor);
  Serial.println();

  if(Serial.available())
  {
    char temp = Serial.read();
    if(temp == '+' || temp == 'a')
      calibration_factor += 10;
    else if(temp == '-' || temp == 'z')
      calibration_factor -= 10;
  }
}

After calibrating the scale, you can run this sample program, then hack it up for your own purposes:

/*
 Example using the SparkFun HX711 breakout board with a scale
 By: Nathan Seidle
 SparkFun Electronics
 Date: November 19th, 2014
 License: This code is public domain but you buy me a beer if you use this and we meet someday (Beerware license).

 This example demonstrates basic scale output. See the calibration sketch to get the calibration_factor for your
 specific load cell setup.

 This example code uses bogde's excellent library:"https://github.com/bogde/HX711"
 bogde's library is released under a GNU GENERAL PUBLIC LICENSE

 The HX711 does one thing well: read load cells. The breakout board is compatible with any wheat-stone bridge
 based load cell which should allow a user to measure everything from a few grams to tens of tons.
 Arduino pin 2 -> HX711 CLK
 3 -> DAT
 5V -> VCC
 GND -> GND

 The HX711 board can be powered from 2.7V to 5V so the Arduino 5V power should be fine.

*/

#include "HX711.h"

#define calibration_factor -7050.0 //This value is obtained using the SparkFun_HX711_Calibration sketch

#define DOUT  3
#define CLK  2

HX711 scale;

void setup() {
  Serial.begin(9600);
  Serial.println("HX711 scale demo");

  scale.begin(DOUT, CLK);
  scale.set_scale(calibration_factor); //This value is obtained by using the SparkFun_HX711_Calibration sketch
  scale.tare(); //Assuming there is no weight on the scale at start up, reset the scale to 0

  Serial.println("Readings:");
}

void loop() {
  Serial.print("Reading: ");
  Serial.print(scale.get_units(), 1); //scale.get_units() returns a float
  Serial.print(" lbs"); //You can change this to kg but you'll need to refactor the calibration_factor
  Serial.println();
}

2 People Made This Project!

Recommendations

  • Made with Math Contest

    Made with Math Contest
  • Multi-Discipline Contest

    Multi-Discipline Contest
  • Robotics Contest

    Robotics Contest

28 Discussions

0
None
WastedRhino

Question 6 weeks ago

Is a calibration factor of around 500.000 reasonable for a 2kg load cell? it seems rather high.

0
None
Carlos AndrésB1

8 weeks ago

Hello, thank you for the tutorial. Since you are using 4 50kg load cells, does it mean this scale can handle up to 200kg? Or is the range not linearly added? For the use case I am looking for, I would like to be able to handle around 100 to 150 kg at least.

Are those load cells reliable? The amazon reviews are not very encouraging but there are only 3, so it is hard to judge by that.

0
None
JackG129

5 months ago

Hi, I am a novice coder, and when I try to run this code I get an error message.

Arduino: error: HX711.h: No such file or directory
compilation terminated.
exit status 1
HX711.h: No such file or directory

anybody know how to fix this?


2 replies
0
None
wumiaoshunJackG129

Reply 2 months ago

Step 3: Add HX711 Library to Your Arduino IDE

0
None
sonaiguru.ei17

Question 3 months ago

Hello everyone,
I am just working on a project. In that I need to connect two load cell in one controller. can anyone help me???
2
None
SudeB1

Question 4 months ago on Step 1

hey ! I have no experiences with loadcells and its amplifiers so do these all steps work with s type 500 kg load cell ? please help me It s vital for my senior project.

0
None
KennethM124

6 months ago

Hello Everyone,
I am currently trying to get my load cell to work for my project. Unfortunately it appears there is some kind of error, and I cannot see why. I try running the calibration sketch, but I keep getting an error for the HX711 scale(DOUT, CLK) saying "no matching function for call to 'HX711::HX711(int,int)'" I have reviewed everything, I have the correct library installed, and am becoming a little frustrated. anybody else have this issue and was able to solve it? It appears to not like the HX711 part of the code.

Error.JPG
3 replies
0
None
themosfetjleona19

Reply 6 months ago

How do I define the pins for output, when I instantiate the object then?

0
None
DegrawStKennethM124

Reply 6 months ago

Thank you for your comment, I am sorry I am seeing it a little late. The HX711 library was updated and it broke the code a little bit. The line "HX711 scale(DOUT, CLK);" needs to be updated to "HX711 scale;"


The code in the Instructables is now updated.

0
None
mezhermikey

6 months ago

Great tutorial. Just a small note -- pretty sure "scale.begin(DOUT, CLK);" is missing prior to "scale.set_scale(calibration_factor);" in the second code block..

1 reply
0
None
DegrawStmezhermikey

Reply 6 months ago

Thank you for noticing this! It is fixed. I must have accidentally deleted it when pasting the code into the Instructable

0
None
Thabelomotuba

Question 7 months ago

Good day Engineers
I am trying to make a weighing scale so i ordered these components::1. load cell 50kg 2. hx711 24 bit precision AD AMPLIFIER MODULE FOR ARDUINO.
3. PIC 16F887 MICROCONTROLLER
4. LCD.
SO my confusion if hx711 module is going to work with this microcontroller or strictly needs arduino??
Is this hx711 module working with only 4 wire load sensor or any other load cell is fine??

Kindly give me assistance please

1 answer
0
None
TheOwlmanThabelomotuba

Answer 7 months ago

The datasheet for the PIC at http://ww1.microchip.com/downloads/en/devicedoc/41... states that it supports "3-wire SPI (all 4 modes)", so you should be able to interface to the hx711 module (consult the hx711 datasheet for the details). The hx711 specifically supports strain gauges in bridge format (AFAIK), so there are two wires that supply an excitation voltage and two wires that sense the resulting voltage across the bridge. You don't mention the type of LCD but be sure to check that its supply voltage is compatible with the other two.

Good luck with your project.

2
None
MuhammadS539

Question 1 year ago

Hi,

I am making a project which will measure the weight of human and i am using Load cell which will measure the weight from 1-200kg.

can you please help me in the programming of arduino?

0
None
junzi

1 year ago

Hello thanks for sharing. May I know if I could place the side edge of an object (lets say a container) on the load cell and still get an accurate reading?

1 reply
0
None
DegrawStjunzi

Reply 1 year ago

The aluminum beam style load cell still gives fairly accurate readings even if the load is off center. The key is a very rigid mount for both the fixed side and loaded side of the load cell. It is better to place the load in the center if possible, however.

0
None
PurpleL2

1 year ago

We used your article to build a device that measures the amount of water wasted in household leaks. Using weight we can tell you how much water is being wasted per month, then translate it into dollars. We built this for our FIRST LEGO League project. We are a FLL team called The Purple LEGO Eaters.

UVWW labeled.jpg
1 reply
0
None
DegrawStPurpleL2

Reply 1 year ago

That is a great project! Nice job. What was the hardest part of getting it set up?