You are on page 1of 11

Weight Measurement Using a Load Cell and Arduino

Andoni L. Albao1, James Karol C. Biao2, Matthew Ivan P. dela Cruz3


Siej Marvey C. Go4, Ted Anthony C. Tarona5, Matthew O. Velasco6
Department of Electrical and Electronics Engineering
University of San Carlos Technological Center
Gov. M. Cuenco Ave., Cebu City, Philippines
1
andoni.albano7@gmail.com, 2james.bianokarol@gmail.com, 3mattdelacruz9@gmail.com
4
smcaballogo@gmail.com, 5tedanthony.tarona@gmail.com, 6matthew.velasco95@gmail.com
Abstract Weighing which means using a balance to
measure the weight of an object or to compare the weight
of two objects has been managed and developed for
thousands of years until now. In conjunction with this
management and development, different methods of
weighing and weighing instruments were developed as
time goes by. The weighing scale is the device developed
for years and is used in calculating the mass of an object.

I.INTRODUCTION

consists of four strain gauges forming a Wheatstone bridge


configuration.
Shown in figure 1 is the 3-kilogram strain gauge load cell
used. The four wire connected to the load cell have their
corresponding colors with different usage. The input values to
be inputted on the load cell were the masses up to 3-kilogram
and the output was the voltage. The output of this sensor was
obtained using the voltmeter.

Weight, usually the force on the object due to gravity, can


be determined in different methods, like using weighing scale.
Weight can be used as a parameter in a transducer in making
electrical signal. A transducer is an instrument or a device
used to convert pressure into electrical signal. There are
different kinds of transducer, one of it is a load cell, which is
used to create an electrical signal whose magnitude is directly
proportional to the force being measured. Load cells have
different types according to its operating principles which
include hydraulic, pneumatic and strain gauge load cells.
This projects mainly applies use of a strain gauge load cell,
Arduino microcontroller, and LCD to create a fully functional
weighing scale. Through a mechanical construction, the force
being sensed deforms a strain gauge. The strain gauge
measures the deformation as a change in electrical resistance,
A load cell usually consists of four strain gauges in a
Wheatstone bridge configuration. The electrical signal output
is usually a few millivolts and as a result requires
amplification by an operational amplifier before it can be
used. It is then possible to use this amplified electrical signal
with an Arduino microcontroller to decode and translate this
electrical signal, then use a LCD, to display approximately
how much an object weighs.
II. THE MEASUREMENT PROCESS
A. Sensor
A sensor gives an output that is a function of the input
applied to it. A strain gauge 3-kilogram load cell, which is used
in this project, is a transducer that is responsible for the
conversion of the weight sensor pressure transducer or force of
the load into electrical signal. The strain gauge load cell

Figure1. Physical Set-Up of a 3-kilogram Strain gauge


load cell

a.

Accuracy and Precision

Accuracy is the degree to which the result of a


measurement, calculation, or specification conforms to the
correct value or a standard. Refers to the closeness of a
measured value to a standard or known value. While, precision
is the closeness of two or more measurements to each other. It
is a refinement in a measurement, calculation, or specification,
especially as represented by the number of digits given.
The load cells electrical output was measured and tested
starting from no load up to 3000 grams of load. Data and
results were recorded. 5 trials of the same mass were made to
have an accurate and precise data.
b.

Range

The range of the instrument load cell used was from


0 grams excluding the weight of the platform up to 3000
grams. This means that the maximum value this instrument is
designed to measure is only 3000 grams, if the weight placed

on the platform will exceed 3000 grams it will just display the
maximum value.
c.

difference across the output terminals of the bridge


circuit.
Depending on the weight applied there would be a
corresponding potential difference. As the load varies
the potential difference also varies and this changes
was found out to have a linear relationship with each
other. This can be shown by most of the graphical
results in the initial testing and trials done which
shows a line that represents the characteristics of the
load cell used as well as its sensitivity.

Linearity and Sensitivity

The mass placed as load on the load cell is directly


proportional to the output voltage measured by the voltmeter
in millivolts. Since the voltage reading in the voltmeter will
increase as the load, it is represented by a straight line in the
graph. Since there is sensitivity that will occur during
measurement, the sensitivity is solved by dividing the scale
deflection over the value of measurand producing deflection.

b.

The schematic diagram for the built-in bridge circuit


of the strain gauge load cell is shown in figure 4. The
wirings for the input voltage and output voltage of
the load cell are color coded. For input voltage it
must be connected to color red and black taking red
as the positive input terminal. While the output
terminal of the bridge circuit is green, as the positive
output terminal, and white

scale deflection
Sensitivity=
value of measurand producing deflection
d.

Threshold and Resolution

The threshold was determined when the reading at


the voltmeter changed from 0.53 volts to 0.55 volts when 5
grams was first applied. The threshold is 5 grams. The
resolution was about 30 grams. This means that an additional
30 grams is needed to attain the next value and change the
reading in the voltmeter.
e.

Bias and drift

The platform has a specific weight which can affect


the reading of the voltmeter, that is why a bias is applied in
order to attain the exact weight of the load applied excluding
the weight of the platform. The weight of the platform is equal
to the bias voltage, which in application the bias voltage will
move from a certain point in the y axis back to the origin.

Figure 4: The Bridge Circuit


c.

The sensitivity drift, which defines the amount by


which an instruments sensitivity of measurement varies as
ambient conditions change, is almost negligible due to some
factors that affect the reading of the output in amplifier.

((

))

R LC
1k

V
1 k + R LC
1 k + R LC

)(

Eq. 1

Equation 1 defines the output voltage of the bridge


circuit. Always bear in mind that RLC is variable and
it varies with the applied load. 1k resistor is already
built-in with the load cell so there is nothing you can
do with that. The only thing you can vary is the load
in order to vary the resistance of RLC and with that,
it varies the output voltage of the bridge circuit.

Discussion
For most load cell to work, it must be connected to a
bridge rectifier circuit but our load cell used already
has a built-in bridge circuit internally. At first, the
bridge circuit together with the load cell has a
balance resistance and zero potential difference
across its output terminals but after a load is applied
the resulting pressure on the gauge causes the
resistance in the load cells sensor to change making
the resistance of the load cell to be unbalanced. The
result of this action would a certain potential

Equation

V out =

B. Variable Conversion Element Bridge Circuit


a.

Schematics

C. Signal Processing
a.

Instrumentation Amplifier Design and Calculations


and Discussions

The required gain was computed using the


equation:

A=

Vo
Vi

f(x) = 0x + 0.61

where VO = 5 V and Vi = 12 mV. So, a gain of 416.67


is needed in this application. The instrumentation
amplifier that was required must be based on a
general-purpose operational amplifier and none else.
The most common configuration is using the 3 opamp instrumentation amplifier as shown in the figure.
LM324 which is a general-purpose quad op-amp is
chosen. For this configuration, the gain can be
obtained using the equation:

A=1+

f(x) = 0x + 0.53

Volts

Volts

2R
Rg

The plot Volts vs Weight 1 is the


unamplified output in millivolts while the plot Volts
vs Weight 2 is the amplified output in volts. It can be
observed that the output is generally linear. Using
Microsoft Excel's linear interpolation function, the
equation of the plot was obtained. This equation is
very important as this dictates the accuracy of the
whole weighing scale. The equation is however rearranged so that the independent variable is the
voltage and dependent variable is the weight. The
equation now becomes:

With R = 1-M, the value of R g is 4.8k. However, a


variable resistor is preferred for R g so that the gain
can be physically adjusted. In this case a 50k trimmer
potentiometer is placed in series with a 2k resistor for
the gain resistor Rg.
b.

ADC
The ADC on the Arduino is a 10-bit ADC
meaning it has the ability to detect 1,024 (210)
discrete analog levels. The ADC reports a ratiometric
value. This means that the ADC assumes 5V is 1023
and anything less than 5V will be a ratio between 5V
and 1023.

c.

Discretization Process
Analog to digital conversions are dependent
on the system voltage. Because we predominantly
use the 10-bit ADC of the Arduino on a 5V system,
the equation for converting an analog signal to its
digital equivalent is:

ADC reading=

1023
analog voltage reading
5

The analog voltage reading is dependent on


the output voltage of the instrumentation amplifier in
which the latter is dependent on the voltage from the
load cell. The change in voltage in the load cell is
directly proportional to the change in the force
applied. The load cell was tested gradually based on
the resolution starting with no weight up to its
maximum weight capacity which is 3,000 grams
using known weights. For every step, the weight in
grams with its corresponding voltage reading was
recorded. The result is shown in the figure.

Weight=659.3 voltage347.37
d.

Discrete Errors
Error in the Analog-to-Digital Conversion
Since the analog voltage is converted into
digital from equation, a 5-mV change will change
the ADC value to 1 bit. Example, for an amplified
analog voltage reading of 1 volt is equivalent to 205
bits. However, with a very small change, 1.005 volts
is now equivalent to 206 bits. The corresponding
weight using equation is 315.2 grams. The digital
value in bits is then converted back to its analog
voltage equivalent. In this case 206 bits is equivalent
to 1.007 volts. The corresponding weight using
equation is 316.55 grams. That accounts 0.43%
relative error in the conversion process alone.
Random Errors
Due to the inherent quality of the general
purpose op-amp IC used, the instrumentation
amplifier circuit is very prone to noise that would

ride on to the signal being fed into the Arduino. It


was found out that, the digital readings fluctuate that
much. Even a 1-bit change would cause a 3.2
grams change in the reading. So to minimize this,
bypass and filter capacitors are added in the circuit.
Statistical methods like sample mean and standard
deviation were also implemented to stabilize
readings.
e.

Conversion table

Weight
(g)
0
10
40
70
100
130
160
190
220
250
280
310
340
370
400
430
460
490
520
550
580
610
640
670
700
730
760
790
820
850
880
910

Un-amplified
(mV)
0.60
0.70
0.80
0.90
1.00
1.10
1.20
1.30
1.40
1.50
1.60
1.70
1.80
1.90
2.00
2.10
2.20
2.30
2.40
2.50
2.60
2.70
2.80
2.90
3.00
3.10
3.20
3.30
3.40
3.50
3.60
3.70

Amplified
(V)
0.53
0.55
0.60
0.64
0.69
0.73
0.78
0.82
0.87
0.91
0.95
1.00
1.05
1.09
1.14
1.18
1.23
1.27
1.32
1.36
1.41
1.45
1.50
1.54
1.59
1.63
1.68
1.72
1.77
1.81
1.86
1.90

ADC
(bits)
108
113
122
131
140
149
159
168
177
186
195
205
214
223
232
241
251
260
269
278
287
297
306
315
324
333
343
352
361
370
380
389

940
970
1000
1030
1060
1090
1120
1150
1180
1210
1240
1270
1300
1330
1360
1390
1420
1450

3.80
3.90
4.00
4.10
4.20
4.30
4.40
4.50
4.60
4.70
4.80
4.90
5.00
5.10
5.20
5.30
5.40
5.50

1.95
1.99
2.04
2.08
2.13
2.17
2.22
2.26
2.31
2.35
2.40
2.44
2.49
2.53
2.58
2.62
2.67
2.71

398
407
416
426
435
444
453
462
472
481
490
499
508
518
527
536
545
554

1480
1510
1540
1570
1600
1630
1660
1690
1720
1750
1780
1810
1840
1870
1900
1930
1960
1990
2020
2050
2080
2110
2140
2170
2200
2230

5.60
5.70
5.80
5.90
6.00
6.10
6.20
6.30
6.40
6.50
6.60
6.70
6.80
6.90
7.00
7.10
7.20
7.30
7.40
7.50
7.60
7.70
7.80
7.90
8.00
8.10

2.76
2.80
2.85
2.89
2.94
2.98
3.03
3.07
3.12
3.16
3.21
3.25
3.30
3.34
3.39
3.43
3.48
3.52
3.57
3.61
3.66
3.70
3.74
3.79
3.83
3.88

564
573
582
591
601
610
619
628
637
647
656
665
674
683
693
702
711
720
729
739
748
757
766
775
785
794

2260
2290
2320
2350
2380
2410
2440
2470
2500
2530
2560
2590
2620
2650
2680
2710
2740
2770

8.20
8.30
8.40
8.50
8.60
8.70
8.80
8.90
9.00
9.10
9.20
9.30
9.40
9.50
9.60
9.70
9.80
9.90

3.92
3.97
4.01
4.06
4.10
4.15
4.19
4.24
4.28
4.33
4.37
4.42
4.46
4.51
4.55
4.60
4.64
4.69

803
812
821
831
840
849
858
868
877
886
895
904
914
923
932
941
950
960

2800
2830
2860
2890
2920
2950
3000

10.00
10.10
10.20
10.30
10.40
10.50
10.60

4.73
4.78
4.82
4.87
4.91
4.96
5.00

969
978
987
996
1006
1015
1023

f.

Arduino
The Arduino is the brain of the whole system. It
serves as an analog-to-digital converter. The analog
signal from the instrumentation amplifier is
converted into digital signal. Since the Arduino is a
programmable microcontroller, it can be programmed
so that the digital signal is converted to weight in
grams unit. The code is shown and explained further
in the succeeding sections.

g.

Schematic

h.

Arduino Code with comments


#include <LiquidCrystal.h> //load LCD library

LiquidCrystal lcd(12, 11, 5, 4, 3, 2); //specifies the


pins for LCD
const int loadcellpin = A0; //analog input
const int sample_cal = 30; //samples for calibration
int loadcellval;
//calibration value
int calibrate;
//average during calibration
int calibrate0;
//running average during
calibration
float voltage0;
float voltage;
float grams0;
float grams;
float grams1;
float variance;
float std_dev;
float std_error;

//voltage from calibration


//voltage during operation
//weight from calibration
//weight during operation
//corrected weight during operation
//sample variance
//sample standard deviation
//standard error of the mean

const int numReadings = 30; // readings to take


int readings[numReadings]; // the readings from the
analog input
int readIndex = 0;
// the index of the current
reading
int total = 0;
// the running total
int average = 0;
// the average
int inputPin = A0;
byte customChar[8] = { //create custom character for
+/0b00100,
0b00100,
0b11111,
0b00100,
0b00100,
0b00000,
0b11111,
0b00000
};
void setup() {
lcd.begin(16, 2); //intializae lcd
lcd.createChar(0, customChar); //creates custom
character

while (millis() < 5000) { //calibration time


lcd.setCursor(0,0);
lcd.clear();
lcd.print("Calibrating. . .") ;
}
for (int i = 1; i < sample_cal; i++) {
loadcellval = analogRead(loadcellpin);
calibrate = ((i - 1) * calibrate0 + loadcellval) / i;
//algorithm for calibration

calibrate0 = calibrate;

lcd.print(grams1,1 ); //displays the weight in grams


lcd.setCursor(6,0);
lcd.write(byte(0)); //displays +/lcd.setCursor(7,0);
lcd.print(std_error,1); //displays the standard
deviation
lcd.setCursor(11,0);
lcd.print("grams"); //displays "grams"

}
for (int thisReading = 0; thisReading <
numReadings; thisReading++) {
readings[thisReading] = 0; //initialize everything to
zero
}

delay(10);
// delay in between readings for
display output stability
}

}
void loop() {
total = total - readings[readIndex]; // subtract the
last reading:
readings[readIndex] = analogRead(inputPin); // read
from the sensor:
total = total + readings[readIndex]; // add the
reading to the total:
average = total / numReadings;
//variance
variance = ((readings[readIndex] - average) *
(readings[readIndex] - average)) / (numReadings - 1);
std_dev = sqrt(variance);//standard devation
std_error = std_dev / sqrt(numReadings);
readIndex = readIndex + 1; // advance to the next
position in the array:
if (readIndex >= numReadings) { // if we're at the
end of the array...
readIndex = 0; // ...wrap around to the beginning:
}
// This section is to set the scale to zero //
if (average < calibrate) {
//
average = calibrate;
//
}
//
if (calibrate > average) {
//
calibrate = average;
//
}
//
//////////////////////////////////////////////
voltage0 = calibrate * (5.0/1023); //voltage from
calibration
voltage = average * (5.0/1023); //voltage during
operation

i.

The algorithm and code for computing the mean


during calibration is:
for (int i = 1; i < sample_cal; i++) {
loadcellval = analogRead(loadcellpin);
calibrate = ((i - 1) * calibrate0 + loadcellval) / i;
//algorithm for calibration
calibrate0 = calibrate;
}
The flowchart for the mean algorithm is shown in
Figure. The algorithm and code for computing the
mean during operation is:
total = total - readings[readIndex]; // subtract the last
reading:
readings[readIndex] = analogRead(inputPin); // read
from the sensor:
total = total + readings[readIndex]; // add the
reading to the total:
average = total / numReadings;
readIndex = readIndex + 1; // advance to the next
position in the array:
if (readIndex >= numReadings) { // if we're at the
end of the array...
readIndex = 0; // ...wrap around to the beginning:
j.

Standard deviation algorithm and code and flowchart


The algorithm and code for computing the mean
during calibration is:

grams0 = 659.3 * voltage0 - 347.37; //weight from


calibration
grams = 659.3 * voltage - 347.37; //weight during
operation

variance = ((readings[readIndex] - average) *


(readings[readIndex] - average)) / (numReadings - 1);
std_dev = sqrt(variance);//standard devation

grams1 = grams - grams0; //corrected weight during


operation

The flowchart is shown in Figure.


k.

lcd.clear();
//clears the LCD to refresh
lcd.setCursor(0, 0);

Mean algorithm and code and flowchart

Standard error of the mean algorithm and code and


flowchart

The algorithm and code for computing the standard


error of the mean is:
std_error = std_dev / sqrt(numReadings);
The flowchart is shown in Figure.

l.

Calibration process

tube technology. LCDs consume much less power


than LED and gas-display displays because they
work on the principle of blocking light rather than
emitting it.

The calibration process is done by the program in the


Arduino. For the first 5 seconds, the program will get
the average of the voltage readings where there is no
load placed on the platform. This voltage produces
the offset or bias. This value is then subtracted to the
values obtained when there is weight. Meaning when
there is no weight, the LCD will display 0 grams.

An LCD is made with either a passive


matrix or an active matrix display grid. The active
matrix LCD is also known as a thin film transistor
display. The passive matrix LCD has a grid of
conductors with pixels located at each intersection
in the grid. A current is sent across two conductors
on the grid to control the light for any pixel. An
active matrix has a transistor located at each pixel
intersection, requiring less current to control the
luminance of a pixel. For this reason, the current in
an active matrix display can be switched on and off
more frequently, improving the screen refresh time.

D. Signal Presentation
a.

Discussion
In the project, a strain gauge load cell was
used. Initially, a different load cell was used
however it imposed a lot of issues regarding data
analysis. The strain gauge load cell had a maximum
capacity of 3.0 kg. The mechanism of this load cell
is that a mechanical element of which the force is
being sensed by the deformation of a strain gauge
on the element. The strain gauge is a device that
measures electrical resistance changes in response to
the force applied to the device. Most strain gauges
are made of very fine wire or foil set up in a grid
pattern in such a way that there is linear change in
electrical resistance when strain is applied in one
specific direction.

c.

Schematic

Since the output of the strain gauge load cell


is very low and cannot be detected so another device
was used that can either accurately measure super
small changes in resistance and can take the small
resistance change and turn it into something that can
be measured accurately. The Amplifier was used to
increase the output of the load cell.
By connecting the Amplifier to the Arduino,
it was possible to see and read the changes in the
resistance of the load cell, and with some calibration
and minor changes to the code, an accurate weight
reading was obtained.
The last stage is to connect the Arduino to
the Liquid Crystal Display (LCD). The pin numbers
must be taken into consideration and must be
connected properly. After checking if the pins are
connected properly, the Arduino software was
opened and a code was given and when
downloaded, the LCD screen became functional.
b.

III. PROTOTYPE DESIGN

LCD
LCD is the technology used for displays in
notebook and other smaller computers. Like lightemitting diode and gas-plasma technologies, LCDs
allow displays to be much thinner than cathode ray

a. Overall setup

b. Overall Schematic

c. PCB layout
The PCB layout for the instrumentation amplifier is
shown in Figure and for the LCD is shown in Figure.

IV. ACKNOWLEDGEMENT

V. REFERENCES
http://www.npl.co.uk/reference/faqs/what-is-the-history-ofweighing-(faq-mass-and-density)
http://www.omega.com/prodinfo/loadcells.html

https://www.ncsu.edu/labwrite/Experimental
%20Design/accuracyprecision.htm
https://create.arduino.cc/projecthub/teamarduinotronics/arduino-scale-b821ae

http://www.patarnott.com/atms360/terms.htm

You might also like