Final Year Project
Final Year Project
EEE DEPARTEMENT
Year3/ETT/Day
my own work, that it has not been submitted for any degree or examination in any
other higher learning institution, and that all the sources I have used or quoted have
Signature …………………………
…………………………………
Date : ……January,
2021 11
CERTIFICATION
Signature………………………………….
11
DEDICATION
To our respective families MIRINDI and MURANDIKIRE, for showing us the value
of hard work, patience and pride in a job well done.
11
ACKNOWLEDGMENT
11
Thanks are due to the almighty lord, who is the master of time and circumstances;
Gratitude also goes to ours parents, families, and friends for their endless support,
A special thank you is extended to university authorities, different lecturers and colleagues.
11
ABSTRACT
11
TABLE OF CONTENTS
DECLARATION.........................................................................................................................................ii
CERTIFICATION......................................................................................................................................iii
DEDICATION......................................................................................................................................iv
ACKNOWLEDGMENT........................................................................................................................v
ABSTRACT..............................................................................................................................................vi
KEY WORD............................................................................................................................................vii
11
TABLE OF CONTENTS...........................................................................................................................viii
LIST OF FIGURES.....................................................................................................................................xi
I. GENERAL INTRODUCTION......................................................................................................1
A. Background................................................................................................................................1
B. Problem statement and justification............................................................................................2
C. Objectives...................................................................................................................................2
D. Significance and Anticipated Output..........................................................................................3
II. LITERATURE REVIEW...............................................................................................................4
A. Electronic Weighing Balance.....................................................................................................4
B. Microcontroller...........................................................................................................................7
III. RESEACH METHODOLOGY..................................................................................................9
A. materials and methods................................................................................................................9
B. System analysis........................................................................................................................10
1. Arduino Uno.........................................................................................................................10
2. Load cell...............................................................................................................................10
3. Hx711 Load Cell Amplifier Module.....................................................................................11
4. LCD DISPLAY....................................................................................................................11
C. Load Cell Assembly on Base....................................................................................................13
D. Circuit Explanation...................................................................................................................14
E. Working Explanation................................................................................................................15
F. Software used in this weight machine.......................................................................................16
IV. RESULTS AND DISCUSSIONS.............................................................................................17
A. Experimental results and analysis.............................................................................................17
B. System evaluation.....................................................................................................................17
1. Comparison of the developed system and a commercial one................................................19
V. CONCLUSION AND RECOMMENDATION............................................................................24
A. Conclusion................................................................................................................................24
B. Recommendations....................................................................................................................25
APPANDIX 1..........................................................................................................................................26
APPANDIX 2: References/Bibliography.................................................................................................27
Bibliography.....................................................................................................................................27
References........................................................................................................................................27
APPANDIX 3: Necessary code uploaded in the system.........................................................................28
11
LIST OF ABBREVIATIONS, ACRONYMS AND SIGNS
M-IDE:
MCS:
PIC:
GPR:
SFR:
UV:
MCS-51:
PM-51:
LIST OF FIGURES
A. Background
Demands of digital weighing machines are on the increase for businesses that deal on
measuring items because it gives the precise and exact measurements of weights of
objects. The digital weighing machine gives a high accuracy and efficiency in
measuring weights of items and this brings about satisfaction to the producer/seller and
the buyer. Sensing devices such as transducer load cells are employed in analog weight
scales. These weight scales do not utilize digital processors and they are read in an
analog manner. These analog weight scales utilize a rotating pointer which rotates.
There are disadvantages to the analog weighing indicator which are high power
consumption because the actuators are electro-mechanical in nature. The actuator
works with high current, low resolution which is caused by the fact that there are little
differences in the weight of various objects which are not easily detected and the
efficiency of the analog weight scale is low due to the rotating pointer which always
shakes or moves.
Electronic weighing systems are used in industries and business establishments for
weighing and segregating materials accurately for process sales. The main advantages
of an electronic weighing system when compared with mechanical weighing systems
are:
Good accuracy.
Analog and digital with print-out facility remote indication and parallel display.
The electronic weighing system comprises the basic load cell, suitable signal
conditioners and output indicators giving both the analog and digital output for further
processing. The signals from the load cell are amplified and fed to analog/digital
converter, which provide an output in the digital format for display processing etc. The
strain gauge-based load cell is the most popular weight transducer used in the
electronic weighing system.
Most of the existing electronic weighing balances use customized chips and are
therefore not flexible. They only perform certain designated tasks. Those that use
microprocessors do not have in-built memory modules, hence the need for external
support chips. They come with price tags. In most microprocessor-based weighing
balances, there is a compromise between range and resolution. On system
reprogramming is not easily done in the case of microprocessor-based systems. 14 The
use of a microcontroller in this research work offers greater flexibility, since bits in
memories replace wired connections. Reprogramming the system attains any
modification in the hardware design to improve the system.
C. Objectives
Design and build a signal conditioning circuitry for the load cell output.
Develop a program for interfacing the 10-bit ADC to the 8-bit microcontroller
and for implementing the analog-to-digital conversion.
Develop a program for the system using M-IDE Studio for MCS-51 and load
it, from a PC, into the micro controller via the PM51 programmer.
Design schematic, then PCB using Express PCB and finally mount the
components.
Calibrate the system.
The 8051 micro controller based electronic weighing balance, in this research work, is
for measuring and displaying mass on an LCD display. This research work utilizes the
technique of interfacing a 10-bit ADC to an 8-bit microcontroller. The system is able
to sense, measure and display mass ranging from 0 to 19 kg with a sensitivity of 40 g
per every volt of excitation voltage.
II. LITERATURE REVIEW
In order to display the mass as a decimal number, the 8-bit binary output has to be
converted to binary-coded decimal (BCD) digits and output them to the digital
display. The 8–bit port A on the 8156 is used to drive the digital display. The
decoder/driver circuitry accepts BCD data, converts them to seven-segment code, and
turns on the appropriate segments. The binary data that the microprocessor receives
from the ADC are not in a form that can be used by the display. For example, if the
mass is 20 kg, the ADC will output 000101002. This has to be converted to
00100000BCD before being output to the display. This conversion could be done with
MSI ICs specifically designed for binary to BCD conversion. Another way is to write
a software sub routine to perform the conversion.
A third way is to use a look-up table. The table look-up technique is very useful for
nonlinear and other complex data conversion. Its disadvantage is that it uses a lot of
very valuable memory to hold the table entries. In this application, since the results are
linear and have a one-to-one correlation, a simple software algorithm can be written to
do the conversion.
the load cells worked as sensors. When load was applied on the load column,
it was compressed while its length changed. The column acted like a primary
transducer because the force applied was converted to change in length. The length
change, was not directly measured while the strain gauge connected to the column for
the load got compressed. While the load column acted as a primary transducer, the
strain gauge acted as a secondary transducer because it recorded the displacement of
the load column. While the strain gauge got compressed, its length changed depending
on the magnitude of force applied to the top of the load cell. The resistance of the
strain gauge changed when there was a change in its length. Resistance change was
measured in terms of output voltage change and could be amplified using a differential
amplifier. When the voltage became negative, it was made positive by the inverter
therefore, the load cell gave a voltage level which was equivalent to the applied
weight.
focused on the use of digital filtering techniques which was used to remove low
frequency noise during measurement from the static weighing system. This design had
a high-resolution measurement. A PGA was also included in the analog to digital
converter coupled with the high resolution; this eliminated the need for a signal
conditioning circuit. The analog to digital converter was interfaced directly with a
precision sensor and was accessed by the microcontroller which enhanced
measurement. This designed system had an accurate and high precision in output.
weighing scale. The load cell/resistive strain gauge were used to measure weight.
Pressure was converted into various voltage levels. The voltage levels in this design
were converted into digital data in the PIC16F690 microcontroller. This digital data
was then displayed on a 16*2 liquid crystal display. The aim of this design was to give
room for low cost, high precision user friendly functionalities which were all achieved.
system which is high resolution, portable and low cost. The designed system could be
used in laboratory, for commercial and domestic purposes. This system has
miniaturized circuits which made use of a microcontroller. It is made up of an 8-bit
8051 microcontroller which had a memory module for storing data from analog to
digital converter. A program was designed to interface the serial 10-bit ADC to the 8-
bit microcontroller thus achieving High resolution without compromising range. The
developed weighing system displayed the mass placed on the single point load cell on
the LCD, senses and measures.
Got analogue weighing machine and converted it to a digital weighing
machine. This was achieved using the spring extension in the analog weighing
machine was converted by a voltage divider circuit (transducer) into voltage. The
transducer (voltage divider) output was fed to the microcontroller which was
responsible for converting analog voltages to its digital equivalent using the analog-
digital converter embedded into the microcontroller. The microcontroller was
programmed to display the mass and the corresponding measured weight on the LCD
simultaneously. The readings of the weighing system produced were compared to that
of a standard weighing system. The result showed a mean deviation of 1.44Kg
between the readings of the modified scale and the analogue scale which served as the
control. A simple product moment correlation coefficient was used to compare the two
readings and the result obtained showed that there was a near perfect correlation of
0.9998 between the readings taken from both scales.
energy. The advantages of this system are the implementation of efficient energy,
miniaturized parts, great accuracy and efficiency, low cost. The system operates on AC
and DC supply. This system developed measures weights ranging from 0-40kg.
Developed a hybrid digital weighing scale which is energy efficient and can be
used for weight measurements. The system detects minute weights placed over it,
accurately reads and measures it kilograms and displays it on the LCD module. The
system developed converted pressure into appropriate voltage levels. The voltage level
was filtered and converted into digital data in the microcontroller which was displayed
on an LCD.
B. Microcontroller
The Reduced Instruction Set Computer (RISC) has 35 instructions and each instruction
performs more elementary operations. Consequences of this are a smaller silion area,
faster execution and reduced program size with fewer accesses to main memory. In the
Harvard architecture the data and instructions use different path and storage areas. This
type of machine can read and write instructions to and from memory at the same time
and results in a faster machine. Since the device has separate buses for instructions and
data it is possible for instructions to be sized differently than data items. Being able to
vary the number of bits in each instruction op-code makes possible the optimization of
program memory and the use of single-word instructions that can be fetched in one bus
cycle. The PIC architecture has a two-stage instruction pipeline, since the fetch and
current instruction and execution of the previous one can overlap in time, one
complete instruction is fetched and executed at every machine cycle (pipelining).
The PIC clocking system is designed so that an instruction is fetched, decoded, and
executed every four clock cycles where the clock is either internal or external. In this
manner a PIC equipped with a 4MHz oscillator clock beats at a rate of 0.25 micro
seconds. Since each instruction executes at every four clock cycles, each instruction
takes 1 us when the pre-scalar is not used.
In the PIC16F690 microchip controller there 18 general purpose I/O pins are available
where one pin is only input that is the master clear pin, 3 ports which include port A
which is 6 pins wide, port B which is 4 pins wide and port C which is 8 pins wide
making the device have 18 pins and 2 pins for powering the device.
This microcontroller has three types of memory- ROM, RAM and EEPROM.ROM
memory is used to permanently save program being executed that is why it is often
referred to as program memory. Since ROM is made of FLASH technology, its
contents can be changed by providing special programming voltage. Similar to
program memory, the contents of EEPROM are permanently saved even after the
power going off. The third memory is the RAM which consists of two parts: the
general-purpose registers (GPR) and the special function registers (SFR).
Peripheral devices in the pic16f690 microchip controller include the timer which is
used as timers or counters. The asynchronous receiver transmitter contains all the
clock generators, shift registers and data buffers necessary to perform an input or
output serial data transfer independent of device program execution.
III. DESIGN AND IMPLEMENTATION
The architecture and program flowchart of the system is shown in figures below.
START
INITIALIZATION
DISPLAY ON LCD
YES
NO
IS THE LIMIT
EXCEEDED?
1. Arduino Uno
The Arduino Uno was used control center for the project. The Arduino was
programmed in Arduino c++. All activities for the developed system are carried out in
the Arduino Uno. These activities include the activities carried out by the load cell,
Hx711 load cell amplifier and the display on the 16x2 LCD.
2. Load cell
The load cell which is also known as a transducer converts mechanical energy (weight)
to an electrical output. The magnitude of the electrical output is directly proportion to
applied force. The strain gauge in the Load cells deforms when pressure is applied on
it. Strain gauge generates electrical signal during deformation because its effective
resistance changes during deformation. The load cell weighs up to 40kg of load. The
load cell is shown in figure 4 below.
X→125*
X→125µm
1g→125µm
Maximum weight→40kg
Hx711 Load cell amplifier module is a 24 high precision analog to digital converter
which amplifies low electric output from the load cells, amplifies and converts the low
electric output of the load cell gotten from the mechanical energy (weight) and
converts it to a digital form. The digital form is transmitted into the Arduino Uno to
generate the weight. When the load cell amplifier is connected to the microcontroller,
changes in the resistance of the load cell will be read by the microcontroller with some
calibrations. This causes very accurate weight measurements. The diagram for the load
cell amplifier module used is shown in figure 5 below.
4. LCD DISPLAY
The LCD display is an electronic display module used to display the output of the
scale result of the developed system.
The LCD discussed in this section has 16-Pins.The function of each pin is
given in Table below.
Table 1: Summary of the 16X2 LCD pin-outs
PIN SYMBOL I/O DESCRIPTION
1 Vss -- Ground
3 Vee -- Contrast
6 E I Enable
A base is also required to fix the load cell over it by using nuts and bolts. Here we
have used a hard ply board for the frame for placing things over it and a light wooden
board as Base. This is required as load cell bends slightly when some weight is placed
over it.
That is a typical load cell arranged in a wheat stone bridge format. The output is
clubbed into 4 wires. The load is applied at the free end. The strain gauges are applied
on all 3 sides to pick up compression and expansions which is nothing but load signal
which is processed and measured for weight measurements. The color code of the 4
wires that comes of it has uniform meaning – Red, white, black & green.
D. Circuit Explanation
Connections for this project are easy and the schematic is given below. 16x2 LCD pins
RS, EN, d4, d5, d6, and d7 are connected with pin numbers 8, 9, 10, 11, 12, and 13 of
Arduino respectively. HX711 Module’s DT and SCK pins are directly connected with
Arduino's pins A0 and A1. Load cell connections with the HX711 module are already
explained earlier and also shown in the below circuit diagram.
Figure 6: Schematic Diagram
E. Working Explanation
However, to change the zero-set reading, like weighing milk (in a container) you
would not be interested to measure the container weight and then deduct it etc. So, you
put the container on the scale and press the push-button. The container weight will be
added to the zero-set reading and then a new zero reading will be shown. Now just
pour milk and read the weigh reading. To remove the container from the zero-set
reading just remove the container and press the push button one more time.
Table 4.1 below shows simulated results when the design was run on proteus. It shows
the variation of the displayed value of the weight as the voltage is varied from 0 to 5
volts as well as the resistance drops consequently.
When the voltage to the microcontroller input was at zero, the displayed value was
also at zero while the visual alarm was ON to show that the weight was within the
specified limit. Behold 100 gm the visual alarm goes off indicating that the weight
level is behold the specified minimum limit.
2. System evaluation
• Number of main ICs. In terms of the number of components, the developed
PIC16F690 Microcontroller Based Electronic Weighing Balance (MCBEWB)
uses the least. The microcontroller chip has adequate in-built Flash Memory,
EEPROM, RAM and I/O ports. Any microprocessor based electronic weighing
balance would require an external RAM, an external EPROM and an I/O
device among other support chips. This renders the latter extremely expensive.
• Space. In terms of space, the developed system required least space for both
the digital circuitry and the analog circuitry. This is attributed to the fact that
minimal number of chips was used and to crown it all, the system was
implemented on PCB boards. Owing to the many external chips used, in
BEWBs and SRLEWBs, a lot of space is required for circuit implementation.
• Range and Resolution. The developed electronic weighing balance has tried
to address both resolution and range. It is the best in as far as striking a balance
between range and resolution goes. This is a modest system with a reasonable
range while at the same time being sensitive enough. This is quite rare in
virtually all-electronic weighing systems.
• Display Capability. In as far as display capability is concerned; the developed
system enjoys the widest capability. Using the ASCII code, it can display all
alphanumeric data/information. It can display special characters. BEWBs and
SRLEWBs can only display numeric data/information. Information in letters or
symbols is usually engraved alongside the LCD display.
e) Missing Codes
A quality ADC should generate an accurate output for any input voltage
within its resolution, that is, it should not skip any successive digital codes.
But some ADCs cannot produce an accurate digital output for a specific
analog input. For example, a particular 3-bit ADC does not provide an
output representing the number four for any input voltage. This type of error
affects both the accuracy and the resolution of the ADC.
f) Noise
An ADC can compromise accuracy when excessive electrical noise
interferes with the measured signal, whether that signal is in millivolts or
much larger. For example, many ADCs that reside on cards and plug into a
PC expansion bus can encounter excessive electrical noise that seriously
affects their accuracy, repeatability, and stability. But an ADC does not
have to be connected directly to the bus within the computer. An ADC
mounted in an external enclosure often solves the problem.
When an ADC inside a computer has to be located, its noise level is
checked.
Connecting the ADC‟s input terminal to the signal common terminal should
produce an output of zero volts. If it still reads a value when shorted, the
noise is being generated on the circuit card and will interfere with the
desired input signal. More critical diagnostics are necessary when using an
external power supply because noise also can arise from both the power
supply and the input leads.
Electrical noise in the system could also result from ground loops. Theses
loops often occur when two or more devices in a system, such as a
measurement instrument and a transducer, are connected to ground
terminals at different physical locations. Slight differences in the actual
potential of each ground point generate a current flow from one device to
the other. This current, which often flows through the low potential lead of a
pair of measurement wires generates a voltage drop that appears as noise
and measurement inaccuracy at the signal conditioner or ADC input.
The electrons in the conductors possess varying amounts of energy by virtue
of the temperature of the conductors. The slight fluctuations in energy about
the values specified by the most probable distribution are very small, but are
sufficient to produce small noise potentials within the conductors.
These random fluctuations produced by thermal agitation of the electrons are called
the thermal, or Johnson, noise.
An Electronic Weighing Indicator system was developed for digital measurement and
the functions of the components were explained in the course of this paper. This
system was built to read weight measurement digital form. The system developed
consisted of a 40kg load cell which read mechanical energy (weight) between 0 to
40kg. The load cell amplifier module reads the output from the load cell and converts
the data from analog to digital form which is then fed to the microcontroller. The
microcontroller processes the data, apart from coordinating the activities of the entire
system. The processed data is the sent from the microcontroller to the LCD module
which is displayed for the user to read.
A. Conclusion
Studio for MCS-51. It was „burnt‟ into the microcontroller via the PM-51
programmer. In comparison with commercially available electronic weighing
balances, the developed microcontroller based electronic weighing balance is low-cost,
flexible and portable. The fabricated system is able to measure mass in the range of 0
to 19 kg to a sensitivity of 40 g per volt of excitation voltage.
B. Recommendations
Submitted by
Supervisor:
KAYIJAMAHYE Patrick
Kigali, January, 2021
APPANDIX 2: References/Bibliography
Bibliography
References
1. Dr. Pradeep B. Dahikar, Mr. Kamlesh S. Patle “Design of an Embedded platform for Digital
weighing system to enhance measuring capabilities,” International Journal of Innovative
Research in Computer and Communication engineering. Volume 1 Issue 8 october 2013 pp.
1881-1887
2. Kimani Peter Ng’ang’a “Microcontroller Based weighing Machine,” final year project,
Electrical and Electronic Engineering of the University of Nairobi. 22 may 2014
3. Munyao kitavi “Design and fabrication of a microcontroller based electronic weighing
machine in high mass regime,” m.sc thesis, Kenyatta University, August 2009
APPANDIX 3: Necessary code uploaded in the system
#include <LiquidCrystal.h>
#include "HX711.h"
//LiquidCrystal lcd(8, 9, 10, 11, 12, 13);
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
#define DT A0
#define SCK A1
#define sw 7
long sample=0;
float val=0;
long count=0;
void setup()
{
Serial.begin(9600);
pinMode(SCK, OUTPUT);
pinMode(sw, INPUT_PULLUP);
lcd.begin(16, 2);
lcd.print(" Weight ");
lcd.setCursor(0,1);
lcd.print(" Measurement ");
delay(10000);
lcd.clear();
calibrate();
}
void loop()
{
count= readCount();
int w=(((count-sample)/val)-2*((count-sample)/val));
Serial.print("weight:");
Serial.print((int)w);
Serial.println("g");
lcd.setCursor(0,0);
lcd.print("Weight ");
lcd.setCursor(0,1);
lcd.print(w);
lcd.print("g ");
if(digitalRead(sw)==0)
{
val=0;
sample=0;
w=0;
count=0;
calibrate();
}
}
void calibrate()
{
lcd.clear();
lcd.print("Calibrating...");
lcd.setCursor(0,1);
lcd.print("Please Wait...");
for(int i=0;i<100;i++)
{
count=readCount();
sample+=count;
Serial.println(count);
}
sample/=100;
Serial.print("Avg:");
Serial.println(sample);
lcd.clear();
lcd.print("Put 100g & wait");
count=0;
while(count<1000)
{
count=readCount();
count=sample-count;
Serial.println(count);
}
lcd.clear();
lcd.print("Please Wait....");
delay(2000);
for(int i=0;i<100;i++)
{
count=readCount();
val+=sample-count;
Serial.println(sample-count);
}
val=val/100.0;
val=val/100.0; // put here your calibrating weight
lcd.clear();
}