Force Measurement Using Load Cell
___________________________________________________________________________
Automotive Electrical and Electronics
MAUE503L
Title:
Force measurement using load cell.
Aim:
To programming the Arduino module with a standalone code for calibrating the
force using a load cell
Apparatus:
• Arduino Uno
• Jumper cables - Type: Male to Male and Male to Female
• HX711 Breakout board
• Load cell (5kg)
Theory
Arduino:
In order to create and upload computer code to the physical board, the Arduino
system includes of a software application called the IDE (Integrated Development
Environment) that runs on your computer. The actual programmable circuit board
is sometimes referred to as a microcontroller.
1
Force Measurement Using Load Cell
___________________________________________________________________________
HX711 Breakout board:
The HX711 break-out board interfacing with the load cell and Arduino Uno.
Hx711 has different gain values which are selectable 32, 64 and 128. Any of the
mentioned gains can be selected and used in the programming.
Load cell (5kg):
A load cell or a Strain Gauge is basically a transducer which generates an
electrical signal whose magnitude is proportional to the force applied. The
various load cell types include,
2
Force Measurement Using Load Cell
___________________________________________________________________________
1) Hydraulic load cell:
The hydraulic load cell uses the conventional piston and cylinder arrangement.
The piston doesn’t come actually in contact with the cylinder wall in the
normal sense, but a thin elastic diaphragm or bridge ring, of steel is used as
the positive cell, which allows small piston movement. Mechanical stop
prevents the seal from being overstrained. The cell is filled with oil. When the
force act on the piston, the resulting oil pressure is transmitted to some
pressure sensing device like Bourdon gauge, electrical pressure transducers
can also be used to obtain an electrical output. If the load cell is completely
filled with oil, very small transfer or flow is required. Piston movements may
be less than 0.05 mm at full capacity. This feature is responsible for good
dynamic response for the system. However, the overall response is largely
determined by the response of the pressure sensing element. A problem with
hydraulic cell using conventional piston and cylinder arrangement is that the
friction between the piston and cylinder wall and required packing and seals
is unpredictable.
2) Pneumatic load cell:
This cell uses a diaphragm of a flexible material and is designed to
automatically regulate the balancing pressure. The air pressure is supplied to
one side of the diaphragm and is allowed to escape through position
controlling bleed valve. Pressure under the diaphragm is therefore controlled
both by the source pressure and bleed valve position. The diaphragm tries to
take up the position that will result in just the proper air pressure to support
the load. This naturally assumes that the supply pressure is large enough so
that its value multiplied by effective area will at least equal to the load.
3) Piezoelectric load cell:
In this type of cell, piezoelectric crystal issued for dynamic force
measurement. Such transducers are very sensitive and used over a wide range.
They are used for measuring impact type of dynamic load
3
Force Measurement Using Load Cell
___________________________________________________________________________
HX711 Connection with Arduino and Load cell Circuit Diagram:
As we can see, the four wires of the Load cell or Strain Gauge are
connected with the HX711. The four wires of the load cell should be connected
in the correct way otherwise this will not work. The red wire of the Strain gauge
or Load cell should be connected with the E+ pin of the HX711 break out board.
The black wire of the Load cell has to be connected with the E- terminal of the
HX711 board. The white wire will be connected with the A- pin of the HX711,
while the green wire of the Load cell or Strain Gauge is connected with the A+
of the HX711.
On the right side of the HX711 breakout board, the four terminals are
clearly labelled with Gnd, DT, SCK, and VCC. The ground of the HX711 is
connected with the Arduino’s Ground. The DT is connected with the Arduino’s
pin number 3. The SCK of the HX711 is connected with the Arduino’s pin
number 2. Finally, connect the VCC of the HX711 break out board with the
Arduino’s 5 Volt.
For the Easy interfacing, you can solder some jumper wires with the
contacts of the HX711 break out board for this you can use male to male type
jumper wires. After the soldering makes sure you check the short circuit using
the digital multimeter.
4
Force Measurement Using Load Cell
___________________________________________________________________________
Code of Arduino:
/*
------------------------------------------------------------- ------------------------
HX711_ADC
Arduino library for HX711 24 -Bit Analog-to-Digital Converter for Weight Scales
Olav Kallhovd sept2017
-------------------------------------------------------------------------------------
*/
/*
This example file shows how to calibrate the load cell and optionally store the
calibration
value in EEPROM, and also how to change the value manually.
The result value can then later be included in your project sketch or fetched from
EEPROM.
To implement calibration in your project sketch the simplified procedure is as
follow:
LoadCell.tare();
//place known mass
LoadCell.refreshDataSet();
float newCalibrationValue = LoadCell.getNewCalibration(known_mass);
*/
#include <HX711_ADC.h>
#if defined(ESP8266)|| defined(ESP32) || defined(AVR)
#include <EEPROM.h>
#endif
//pins:
const int HX711_dout = 4; //mcu > HX711 dout pin
const int HX711_sck = 5; //mcu > HX711 sck pin
5
Force Measurement Using Load Cell
___________________________________________________________________________
//HX711 constructor:
HX711_ADC LoadCell(HX711_dout, HX711_sck);
const int calVal_eepromAdress = 0;
unsigned long t = 0;
void setup() {
Serial.begin(57600); delay(10);
Serial.println();
Serial.println("Starting...");
LoadCell.begin();
//LoadCell.setReverseOutput(); //uncomme nt to turn a negative output value to
positive
unsigned long stabilizingtime = 2000; // preciscion right after power -up can be
improved by adding a few seconds of stabilizing time
boolean _tare = true; //set this to false if you don't want tare to be p erformed in the
next step
LoadCell.start(stabilizingtime, _tare);
if (LoadCell.getTareTimeoutFlag() || LoadCell.getSignalTimeoutFlag()) {
Serial.println("Timeout, check MCU>HX711 wiring and pin designations");
while (1);
}
else {
LoadCell.setCalFactor(1.0); // user set calibration value (float), initial value 1.0 may
be used for this sketch
Serial.println("Startup is complete");
}
while (!LoadCell.update());
calibrate(); //start calibration procedure
}
void loop() {
6
Force Measurement Using Load Cell
___________________________________________________________________________
static boolean newDataReady = 0;
const int serialPrintInterval = 0; //increase value to slow down serial print activity
// check for new data/start next conversion:
if (LoadCell.update()) newDataReady = true;
// get smoothed value from the dataset:
if (newDataReady) {
if (millis() > t + serialPrintInterval) {
float i = LoadCell.getData();
Serial.print("Load_cell output val: ");
Serial.println(i);
newDataReady = 0;
t = millis();
}
}
// receive command from serial terminal
if (Serial.available() > 0) {
char inByte = Serial.read();
if (inByte == 't') LoadCell.tareNoDelay(); //tare
else if (inByte == 'r') calibrate(); //calibrate
else if (inByte == 'c') changeSavedCalFactor(); //edit calibration value manually
}
// check if last tare operation is complete
if (LoadCell.getTareStatus() == true) {
Serial.println("Tare complete");
}
7
Force Measurement Using Load Cell
___________________________________________________________________________
void calibrate() {
Serial.println("***");
Serial.println("Start calibration:");
Serial.println("Place the load cell an a level stable surface.");
Serial.println("Remove any load applied to the load cell.");
Serial.println("Send 't' from serial monitor to set the tare offset.");
boolean _resume = false;
while (_resume == false) {
LoadCell.update();
if (Serial.available() > 0) {
if (Serial.available() > 0) {
char inByte = Serial.read();
if (inByte == 't') LoadCell.tareNoDelay();
}
}
if (LoadCell.getTareStatus() == true) {
Serial.println("Tare complete");
_resume = true;
}
}
Serial.println("Now, place your known mass on the loadcell.");
Serial.println("Then send the weight of this mass (i.e. 100.0) from serial monitor.");
float known_mass = 0;
_resume = false;
while (_resume == false) {
LoadCell.update();
if (Serial.available() > 0) {
known_mass = Serial.parseFloat( );
if (known_mass != 0) {
8
Force Measurement Using Load Cell
___________________________________________________________________________
Serial.print("Known mass is: ");
Serial.println(known_mass);
_resume = true;
}
}
}
LoadCell.refreshDataSet(); //refresh the dataset to be sure that the known mass is
measured correct
float newCalibrationValue = LoadCell.getNewCalibration(known_mass); //get the new
calibration value
Serial.print("New calibration value has been set to: ");
Serial.print(newCalibrationValue);
Serial.println(", use this as calibration value (calFacto r) in your project sketch.");
Serial.print("Save this value to EEPROM adress ");
Serial.print(calVal_eepromAdress);
Serial.println("? y/n");
_resume = false;
while (_resume == false) {
if (Serial.available() > 0) {
char inByte = Serial.read();
if (inByte == 'y') {
#if defined(ESP8266)|| defined(ESP32)
EEPROM.begin(512);
#endif
EEPROM.put(calVal_eepromAdress, newCalibrationValue);
#if defined(ESP8266)|| defined(ESP32)
EEPROM.commit();
#endif
EEPROM.get(calVal_eepromAdress, newCalibrationValue);
Serial.print("Value ");
9
Force Measurement Using Load Cell
___________________________________________________________________________
Serial.print(newCalibrationValue);
Serial.print(" saved to EEPROM address: ");
Serial.println(calVal_eepromAdress);
_resume = true;
}
else if (inByte == 'n') {
Serial.println("Value not saved to EEPROM");
_resume = true;
}
}
}
Serial.println("End calibration");
Serial.println("***");
Serial.println("To re-calibrate, send 'r' from serial monitor.");
Serial.println("For manual edit of the calibration value, send 'c' from serial
monitor.");
Serial.println("***");
}
void changeSavedCalFactor() {
float oldCalibrationValue = LoadCell.getCalFactor();
boolean _resume = false;
Serial.println("***");
Serial.print("Current value is: ");
Serial.println(oldCalibrationValue);
Serial.println("Now, send the new value from serial monitor, i.e. 696.0");
float newCalibrationValue;
while (_resume == false) {
if (Serial.available() > 0) {
newCalibrationValue = Serial.parseFloat();
10
Force Measurement Using Load Cell
___________________________________________________________________________
if (newCalibrationValue != 0) {
Serial.print("New calibration value is: ");
Serial.println(newCalibrationValue);
LoadCell.setCalFactor(newCalibrationValue);
_resume = true;
}
}
}
_resume = false;
Serial.print("Save this value to EEPROM adress ");
Serial.print(calVal_eepromAdress);
Serial.println("? y/n");
while (_resume == false) {
if (Serial.available() > 0) {
char inByte = Serial.read();
if (inByte == 'y') {
#if defined(ESP8266)|| defined(ESP32)
EEPROM.begin(512);
#endif
EEPROM.put(calVal_eepromAdress, newCalibrationValue );
#if defined(ESP8266)|| defined(ESP32)
EEPROM.commit();
#endif
EEPROM.get(calVal_eepromAdress, newCalibrationValue);
Serial.print("Value ");
Serial.print(newCalibrationValue);
Serial.print(" saved to EEPROM address : ");
Serial.println(calVal_eepromAdress);
_resume = true;
}
else if (inByte == 'n') {
Serial.println("Value not saved to EEPROM");
11
Force Measurement Using Load Cell
___________________________________________________________________________
_resume = true;
}
}
}
Serial.println("End change calibration value ");
Serial.println("***");
}
Observation Table:
SR. Load (gm) Voltage (mV)
NO
1 1000 1
2 1100 1.2
3 1200 1.4
4 1300 1.5
5 1350 1.6
6 2000 2.6
7 2150 2.9
8 2200 3
12
Force Measurement Using Load Cell
___________________________________________________________________________
Result:
Weight (gm)
2500
2000
1500
1000
500
0
0 0.5 1 1.5 2 2.5 3 3.5
Slope:
Slope = (y2-y1)/(x2-x1) = (1350-1200) / (1.6-1.4) = 750
Slope= (2150-2000) / (2.9-2.6) = 500
Conclusion:
From the experiment we conclude that the load is directly proportional to voltage.
As the load is increases the voltage also gets increase.
13