In this post we are going to learn about strain gauge based load cell. We will be exploring what Strain Gauge is, what Load Cell is, temperature effect on strain gauge, temperature compensation with Wheatstone bridge and Load cell amplifier HX711, and finally we will learn how to build an Arduino based weighing scale machine by implementing load cell as the weight sensor.

By Girish Radhakrishnan

This post deals with weight measurement and measuring methods, and implementing the methods in an Arduino based weighing scale circuit.

We all love to see our weight regardless of our age, a small kid may love to see his / her weight gain and adults may love to see his / her weight loss. Weight is being a vital concept since ancient times; it helped in trading goods, development of scientific equipments and commercial products.

In modern times, we measure weights in kilograms, milligrams even micrograms for laboratory purpose. One gram is same across the globe, all weight measuring device must measure the same. The mass production of a pill with tiny difference of few milligrams of dosage is enough to make a lifesaving pill in to a suicide pill.

What is Weight?


Weight is the force exerted on a plane. The amount of force exerted is directly proportional to mass of an object, which means higher the object’s mass, the higher the force exerted.

Mass is the amount of physical matter present in an object.

The weight depends on one more factor: Gravity.

The gravity is constant across the globe (There are minor variation in gravity due to non-uniform spherical shape of the earth, but it is very tiny). The weight of 1Kg on earth will weight 160 gram on the moon with exact same mass, because moon has much weaker gravitational pull.

Now you know what is weight and what are the factors make an object heavy.

What is Strain gauge:


The strain gauge is a transducer or a sensor which measures the strain (deformation) on an object. This was invented by electrical engineer Edward E. Simmons and mechanical engineer Arthur Claude Ruge.

Illustration of Strain Gauge:

Illustration of Strain Gauge


The Strain gauge is flexible; it is a thin metallic foil pattern sandwiched between two thin plastic sheets and it has to be attached on a surface using suitable glue or any adhesive material.

When we apply weight or force on the surface it deforms and the strain gauge deforms as well. The deformation of the strain gauge causes the electrical resistance of the metallic foil to change.

Now the strain gauge’s change in the resistance is directly proportional to weight or applied force on the surface.

In real life the change in resistance of strain gauge is very insignificant to detect. To detect tiny changes in the resistance we are utilizing Wheatstone bridge.

Let’s explore what Wheatstone bridge is in a nutshell.

Understanding a Wheatstone bridge:


A wheat stone bridge is a circuit which can be used for determining unknown resistance. The Wheatstone bridge was devised by Samuel Hunter Christie, later; the Wheatstone bridge was enhanced and disseminated by Sir Charles

Wheatstone.

Illustration of Wheatstone bridge circuit:

Wheatstone bridge circuit


Our modern digital multimeters can read the resistance value ranging from mega ohms, kilo ohms and ohms range.

Using Wheat stone bridge we can measure resistance in milli ohm range.

The wheat stone bridge consists of 4 resistors, out of the four, 3 are known resistance and one is unknown resistance.

The potential difference (voltage) is applied on the points “A” and “C” and from points “B” and “D” a voltmeter is connected.

If the all the resistors are equal no current will flow at the points “B” and “D” and voltmeter will read zero. This is called balanced bridge.

If a resistor’s resistance is different from other three resistors, there will be voltage flow between the points “B” and “D” and voltmeter will read some value proportional to unknown resistance. This is called unbalanced bridge.

Here the unknown resistance is the strain gauge, when the resistance is changed, it reflects on the voltmeter.

Now, we have converted a deformation or weight or force to voltage signal. This voltage needs to be amplified in order to get some useful readings, which will be fed to a microcontroller to get the readings in grams.

Now let’s discuss how temperature affects strain gauge performance.

Temperature effects on Strain Gauge:


The strain gauge is temperature sensitive and it can mess up with actual weight / force readings. When there is a change in ambient temperature the metallic foil is subjected metal expansion, which directly affects the resistance.

We can nullify the temperature effect using Wheatstone bridge. Let’s see how we can compensate the temperature using the Wheatstone bridge.

Temperature Compensation:


We can easily neutralize the temperature effect by replacing all the resistors with strain gauge. Now all the strain gauge’s resistance will be affected by the temperature equally and unwanted noise will be nullified by the Wheatstone bridge’s character.

What is a Load Cell?


A Load cell is an aluminium profile with strain gauge attached to 4 sides in Wheatstone bridge configuration.

Illustration of Load cell:

Load cell


This type of load cell is rigid and used commonly in industries. There are 4 screw mounts, one side is bolted to a stationary surface and the other end is bolted to a holder (say basket) to hold the object to be measured.

It has maximum weight specified on the datasheet or on its body, exceeding the specification might damage the load cell.

A full bridge cells consists of 4 terminals namely E+, E-, which are excitation wires through which the supply voltage is applied. The other two wires are S+ and S-, which are signal wires, from which the voltage is measured.

Now these voltages are in millivolt range not strong enough for a microcontroller to read and process. We need amplification and tiny changes should be visible to the microcontroller. To do this there are dedicated module called load cell amplifiers, let’s take an overview on that.

Load cell Amplifier HX711:


Illustration of HX711 Load cell amplifier module:

Load cell Amplifier HX711


The load cell amplifier is based on the IC HX711 which is 24-bit analog to digital converter specifically designed for weight measures. It has different selectable gains 32, 64 and 128 and it operates on 2.6 to 5.5 V.
This breakout board helps to detect tiny variation on load cell. This module require HX711.h library to operate with

Arduino or any other microcontrollers.


The load cell will be connected to HX711 module and the module will be interfaced with Arduino. The weight measuring circuit needs to be developed in this manner.

In conclusion, now you know what strain gauge is, what Wheatstone bridge is, temperature effects on the strain gauge, temperature compensation and what load cell amplifier is.

We have comprehensively understood the theoritical part of the a weighing scale design from the above discussion, now let's see how a loas cell may e used for making a pratical weighing scale machine using Arduino

Designing a Digital Weighing Scale Machine using Arduino


In the following discussions we will learn how to construct a digital weight scale machine using Arduino which can measure weights from few grams to 40 Kg (depending on the specs of your load cell) with reasonable accuracy. We will be learning about classification of precision grade load cells and we will be calibrating the proposed circuit and finalizing the weight scale machine.

Note: This circuit may not be compliant with the standards required for commercial implementation.

Weight scale machines are used in different varieties of trades and research ranging from milligrams to several tons. The proposed weight scale machine’s maximum scale depends on your load cell’s specification. There are ranges from 500 gram, 1 Kg, 5Kg, 10 Kg, 20 Kg and 40 Kg etc.

There are different grades of load cell, they offer different accuracy range and you should choose the suitable one for your project.

Classification of Load cell Accuracy Class:


The different accuracy classes are defined for different kinds of applications. The below classification is from lowest accuracy to highest accuracy range.

The load cells with lower accuracy (but reasonably accurate) are classified as D1, C1 and C2. This is enough for this project. These load cells are used for measuring weight of sand, cement or water.

C3 grade load cell are used in quality assurance such as checking weight of ball bearings, machine constructions parts etc.

C4, C5, C6 are the best in class accuracy, these grades of load cells are used to measure in grams to micrograms. These grade classes are used in shop-counter scales, large scale production monitoring, food packing and laboratory use etc.

Now let’s dive into technical details of the project.

Circuit Diagram:


Load cell connection HX711 to Arduino and load cell.


Load cell connection HX711 to Arduino and load cell

The project consists of Arduino, Load cell and HX711 load cell amplifier board and a computer. The output can be monitored on the Serial monitor of Arduino IDE.

The brain of the project is as always the arduino, you can use any Arduino board model. The HX711 is 24 bit ADC, which can find tiniest flex due to weight on the load cell. It can operate from 2.7 V to 5 V. The power is provided from Arduino board.

The load cell has four wires generally, which is the output from the Wheatstone bridge configured strain gauge.

The Red wire is E+, black wire is E-, green wire is A- and white wire is A+. Some HX711 modules specify the name of the terminals of load cell and some HX711 modules specify the colours of the wires, such a model is illustrated in the circuit diagram.

The DATA pin of HX711 is connected to pin #3 of Arduino and Clock pin of the HX711 is connected to pin #2 of Arduino.

How to Mount the Load cell:

How to Mount the Load cell


The load cell has four screw holes, two at both sides. Any one side must be stationary for best accuracy; it may be mounded to a wood with reasonable weight.

A thin wood or thin plate can be used to hold the measuring weight as illustrated above.

So when you place a weight, the load cell bend so does the strain gauge and change its resistance which is measured by HX711 module and fed to Arduino.

Once the hardware setup is complete, let’s upload the code and calibrate.

Calibrating the circuit:


There are two programs; one is the calibration program (finding the calibration factor). Another code is weight measurement program, the calibration factor found from the calibration program code need to be entered in weight measurement program.

The calibration factor determines the accuracy of the weight measurement.

Download the HX711 library here: github.com/bogde/HX711


Calibrations Program code:


//-------------------- --------------------//
#include <HX711.h>
const int out = 3;
const int clck = 2;
HX711 scale(out, clck);
float CalibrationFactor = -96550;
char var;
void setup()
{
Serial.begin(9600);
Serial.println("------------- Weight Scale Calibration --------------");
Serial.println("Press Q,W,E,R or q,w,e,r to increase calibration factor by 10,100,1000,10000 respectively");
Serial.println("Press A,S,D,F or a,s,d,f to decrease calibration factor by 10,100,1000,10000 respectively");
Serial.println("Press 'T' or 't' for tare");
scale.set_scale();
scale.tare();
long zero_factor = scale.read_average();
Serial.print("Zero factor: ");
Serial.println(zero_factor);
}
void loop()
{
scale.set_scale(CalibrationFactor);
Serial.print("Reading: ");
Serial.print(scale.get_units(), 3);
Serial.println(" Kilogram");
Serial.print("Calibration Factor is: ");
Serial.println(CalibrationFactor);
Serial.println("--------------------------------------------");
if (Serial.available())
{
var = Serial.read();
if (var == 'q')
{
CalibrationFactor = CalibrationFactor +  10;
}
else if (var == 'a')
{
CalibrationFactor = CalibrationFactor - 10;
}
else if (var == 'w')
{
CalibrationFactor = CalibrationFactor +  100;
}
else if (var == 's')
{
CalibrationFactor = CalibrationFactor - 100;
}
else if (var == 'e')
{
CalibrationFactor = CalibrationFactor +  1000;
}
else if (var == 'd')
{
CalibrationFactor = CalibrationFactor - 1000;
}
else if (var == 'r')
{
CalibrationFactor = CalibrationFactor +  10000;
}
else if (var == 'f')
{
CalibrationFactor = CalibrationFactor - 10000;
}
else if (var == 'Q')
{
CalibrationFactor = CalibrationFactor +  10;
}
else if (var == 'A')
{
CalibrationFactor = CalibrationFactor - 10;
}
else if (var == 'W')
{
CalibrationFactor = CalibrationFactor +  100;
}
else if (var == 'S')
{
CalibrationFactor = CalibrationFactor - 100;
}
else if (var == 'E')
{
CalibrationFactor = CalibrationFactor +  1000;
}
else if (var == 'D')
{
CalibrationFactor = CalibrationFactor - 1000;
}
else if (var == 'R')
{
CalibrationFactor = CalibrationFactor +  10000;
}
else if (var == 'F')
{
CalibrationFactor = CalibrationFactor - 10000;
}
else if (var == 't')
{
scale.tare();
}
else if (var == 'T')
{
scale.tare();
}
}
}
//-------------------- --------------------//



How to Calibrate:



  • With completed hardware setup upload the above code.

  • Remove the thin plate or wood which is used for holding the weight including the two screws (other side of the load cell should be fixed to a base)

  • Open the Serial monitor.

  • Place a known weight on the load cell directly, 100 gram (say).

  • Press Q, W, E, R to increase calibration factor by 10,100,1000,10000 respectively.

  • Press A, S, D, F to decrease calibration factor by 10,100,1000,10000 respectively.

  • Press “Enter” after every increment or decrement of the calibration factor.

  • Increase or decrease the calibration factor until the correct weight of known weight material appears.

  • Tare function is to set the weight scale to zero, this is useful when you want to measure weight of water (say) without the weight of the bowl. Place the bowl first, press tare and pour the water.

  • Note the calibration factor and write it down after the know weight appears.

Now it can measure unknown weights.

Weight Measurement Program Code:


//---------------- ----------------//
#include <HX711.h>
const int out = 3;
const int clck = 2;
HX711 scale(out, clck);
float CalibrationFactor = -12000;  // Replace -12000 the calibration factor.
void setup()
{
Serial.begin(9600);
Serial.println("Press 'T' or 't' to tare");
scale.set_scale(CalibrationFactor);
scale.tare();
}
void loop()
{
Serial.print("Weight: ");
Serial.print(scale.get_units(), 3);
Serial.println(" Kilogram");
if (Serial.available())
{
char var = Serial.read();
if (var == 't')
{
scale.tare();
}
if (var == 'T')
{
scale.tare();
}
}
}
//---------------- ----------------//


float CalibrationFactor = -12000; 

Replace -12000 with the calibration factor that you found. It can be a negative number or a positive number. 

Upload the above code with your full hardware setup and your weight scale machine is ready.

Weight Scale Machine Using LCD Display


The above article explained an Arduino based weighing scale system using your PC, in the following section we will try to build a practical version of Weight scale machine by adding 16 x 2 LCD display, so that we don’t depend on a PC while measuring weights. In this post two versions are proposed, one with “I2C” 16 x 2 LCD and one without “I2C” 16 x 2 LCD display.

Here two choices are given so that readers can choose the design as per their convenient. The main difference between the two is wire connections; with I2C adapter module just 4 wires (Vcc, GND, SCL and SDA) are required for functioning of LCD display, whereas without I2C adapter you need several wires to connect between the Arduino and LCD display.

However both functions exactly the same; some prefer I2C over conventional one and some prefer the vice versa so here are the both designs.

Let’s take look at the conventional LCD design:

Circuit diagram:

arduino, 16 x 2 LCD display and 10K potentiometer for adjusting LCD display contrast.


In the above schematic we have the arduino, 16 x 2 LCD display and 10K potentiometer for adjusting LCD display contrast.

3.3 V can be fed from Arduino to LCD display for backlighting. A push button is provided to bring the weight reading to zero, this function will be explained in detail at the end.

This is just connection between LCD and Arduino, the connection between load cell and load cell amplifier to Arduino is shown in the previous section.

Code for LCD Weight Scale machine:


// -------- Program developed by R.GIRISH -------//
#include <LiquidCrystal.h>
#include <HX711.h>
const int rs = 10;
const int en = 9;
const int d4 = 8;
const int d5 = 7;
const int d6 = 6;
const int d7 = 5;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
const int out = 3;
const int clck = 2;
const int Tare = 4;
HX711 scale(out, clck);
float CalibrationFactor = -12000;  // Replace -12000 the calibration factor.
void setup()
{
lcd.begin(16, 2);
pinMode(Tare, INPUT);
digitalWrite(Tare, HIGH);
lcd.setCursor(0, 0);
lcd.print("  Weight Scale");
lcd.setCursor(0, 1);
lcd.print("    Machine");
delay(2000);
scale.set_scale(CalibrationFactor);
scale.tare();
}
void loop()
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Weight:");
lcd.print(scale.get_units(), 3);
lcd.print(" Kg");
delay(200);
if (digitalRead(Tare) == LOW)
{
scale.tare();
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Tare ......");
lcd.setCursor(0, 1);
lcd.print("Setting to 0 Kg.");
delay(1000);
}
}
// -------- Program developed by R.GIRISH -------//




Now let’s see how to use this weight scale machine with I2C adapter based LCD display.

Circuit Diagram Arduino and LCD display with I2C adapter :

Arduino and LCD display with I2C adapter


Here we just have an Arduino and LCD display with I2C adapter on the back. Now the wire connections are simplified and straight forward.

Illustration of I2C module:

I2C module


This module can be soldered directly on the back of a normal 16 x 2 or even 20 x 4 LCD display and follow the schematic diagram.

And again please refer the previous section for connection of load cell, load cell amplifier and Arduino.

Download the following Library for I2C based:

github.com/marcoschwartz/LiquidCrystal_I2C

github.com/PaulStoffregen/Wire

Code for I2C based Weight scale circuit:


// -------- Program developed by R.GIRISH -------//
#include <LiquidCrystal_I2C.h>
#include<Wire.h>
#include <HX711.h>
const int out = 3;
const int clck = 2;
const int Tare = 4;
HX711 scale(out, clck);
float CalibrationFactor = -12000;  // Replace -12000 the calibration factor.
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup()
{
lcd.init();
lcd.backlight();
pinMode(Tare, INPUT);
digitalWrite(Tare, HIGH);
lcd.setCursor(0,0);
lcd.print("  Weight Scale");
lcd.setCursor(0,1);
lcd.print("    Machine");
delay(2000);
scale.set_scale(CalibrationFactor);
scale.tare();
}
void loop()
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Weight:");
lcd.print(scale.get_units(), 3);
lcd.print(" Kg");
delay(200);
if (digitalRead(Tare) == LOW)
{
scale.tare();
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Tare ......");
lcd.setCursor(0,1);
lcd.print("Setting to 0 Kg.");
delay(1000);
}
}
// -------- Program developed by R.GIRISH -------//


NOTE:

You should enter the calibration factor in the code before you uploading either of the code to Arduino.

float CalibrationFactor = -12000; 

Obtaining calibration factor is explained in one the previous section above.

Tare function:


Tare function in a weight scale is to bring the readings to zero. For example if we have a basket in which the goods are loaded, then the net weight will be weight of the basket + weight of the goods.

If we press tare button with basket on the load cell before loading goods, the weight of the basket will be neglected and we can measure the weight of the goods alone.

If you have any questions regarding this Arduino based practical LCD weighing scale machine circuit, please express in the comment section you may get a quick reply.

Need Help? Please send your queries through Comments for quick replies!