Sie sind auf Seite 1von 38

A

Report On
HEIGHT AND WEIGHT MEASURING
MACHINE



Electrical Engineering
Presented by:
Jingshu Zhao
Sanjaya Gurung
Height And Weight Measuring Machine
1
Abstract

The project Height And Weight Measuring Machine is designed for taking two measurements
of an object: Height and Weight. Two different sensors are used for these two different
applications. The light sensor or more precisely saying the Photo Resistor, also widely known as
Light Dependent Resistor (LDR) is implemented for the measurement of height and Force
Sensing Resistor (FSR) is used for measuring the weight. In this project, height measurement
circuit is designed to take the measurement from 0 - 4 inch with a resolution of 1 inch and
obviously the circuit can be extended very easily to have larger range of measurement with better
resolution. The designed circuit for weight measurement can measure the weight from 0 98 N
(0 10 kg) with a resolution of 1 N. The circuit can be used for the measurement of weight of a
person just by replacing the current FSR by some other larger FSR or weight sensor having
larger saturation point. Beside the hardware part, simulation of comparator circuit and some
software written in C++ for the calculation of weight/voltage, voltage/weight conversion and
A/D conversion are discussed.
Keywords
LDR, FSR, Potentiometer adjustment, Saturation point, Stand-Off resistance, Break force,
A/D Conversion, Binary-to-BCD Conversion, BCD-to-7 Segment Decoding, Comparator etc.
Height And Weight Measuring Machine
2
Table of Contents:
Topics Page No.
1. Introduction 3
2. Block Diagram ............. 4
2.1 Measurement of Height .... 4
2.2 Measurement of Weight .... 5
3. Principles . 6
3.1 Height Measurement 6
3.1.1 Overview . 6
3.1.2 Op-Amp as a Comparator 7
3.1.3 Circuit Implementation in Height Measurement . 9
3.1.4 Simulation 10
3.2 Weight Measurement . 12
3.2.1 Overview . 13
3.2.2 Calibration and Weight Calculation 13
4. Components . 15
4.1 For Height Measurement .. 15
4.1.1 Light Dependent Resistor . 15
4.1.2 Operational Amplifier .. 16
4.1.3 NOT Gate .. 17
4.1.4 AND Gate . 18
4.1.5 Seven Segment Display 19
4.1.6 Light Emitting Diode 20
4.1.7 Resistor .. 20
4.2 For Weight Measurement .. 21
4.2.1 Force Sensing Resistor 21
4.2.2 Analog to Digital Converter 22
4.2.3 Binary to BCD Converter 23
4.2.4 BCD to 7-Segment Decoder 24
4.2.5 Voltage Divider 27
4.2.6 Capacitor .. 28
5. Truth Table .. 29
6. Design Limitation ... 30
7. Programs written in C++ 31
8. Gantt Chart .. 35
9. Conclusion 36
10. References 37
Height And Weight Measuring Machine
3
1. Introduction
The principle for the measurement of height is chiefly based on LDR. An LDR is a light sensor
whose resistance is inversely proportional to the intensity of the light falling on it. That is, the
resistance increases with the decrease of light intensity falling on its surface. Based on this
characteristic of LDR, the appropriate comparator circuit is designed to switch the two level
outputs (high and low). The high level voltage is propagated to the output when the resistance of
the LDR goes above some threshold and the low level voltage is propagated to the output when
the resistance of the LDR falls below some threshold. Thus obtained output voltage is calibrated
to the general unit of height (inch). The circuit for displaying the converted output is designed
using 7-segment-display. For the weight measurement, the force sensor (FSR) is used which
produces the output voltage accordingly as it is pressed. The resistance of the sensor varies
inversely to the magnitude of the force or weight applied to it. Depending upon the amount of
force or weight exerted on it, therell be variation of output voltage. The analog output voltage
produced then is digitally converted and calibrated to its own engineering unit (N) with the use
of ADC, Binary-to-BCD Converter and BCD-to-7 segment decoder and the output is shown in 7-
segment display.
Height And Weight Measuring Machine
4
2. Block Diagrams
2.1 Measurement of Height:
Object whose height is to be
measured is placed in upright
position blocking some light to
LDRs which are kept vertically
1 inch apart
Resistances of the blocked LDRs
increase as some of the light is
blocked by the object
Comparator compares the input
voltage level (i/p to non-inverting
terminal) with the reference
voltage level (i/p to inverting
terminal) of the comparator
Only the corresponding topmost
7-segment display (among the
output displays of blocked
LDRs ) glow as it is driven by
+Vee
If the voltage level at non-
inverting terminal > voltage at
inverting terminal, +Vee
propagates to the output of the
comparator
Height And Weight Measuring Machine
5
2.2 Measurement of Weight
Object whose weight is to be
measured is placed on the
platform beneath which the
weight sensor is kept
Some voltage is produced at the
output of the sensor when the
load is placed on it as theres a
decrease in its resistance
Thus obtained analog output
weight is then converted to
digital (binary) form by Analog
to Digital Converter
The output digital bit stream of
ADC is fed into Binary-to-BCD
Converter which produces the
output bits in BCD form
The BCD output is then fed into
BCD-to-7 segment Decoder
from which the produced output
is in 7 segment format
The output calibrated weight of
the object is displayed in 7
segment display
Calibration is done considering
the feedback of displayed
weight by adjusting the
potentiometer and fixing at its
suitable value
Height And Weight Measuring Machine
6
3. Principles
3.1 Height Measurement
3.1.1 Overview
Output high when
light is blocked
Output low when
light is not blocked
LDR
Fixed
Resistor
Comparator
V
ref
The circuit overview for the measurement of height is shown in above Fig.3.1.1. When the object
is placed in front of the light sensor, its resistance increases and the output will be high
accordingly and the output will be low when theres no object placed in front of the sensor.
Fig.3.1.1 Overview
Height And Weight Measuring Machine
7
3.1.2 Op-Amp as a Comparator
The above circuit of fig. 3.1.2 explains how the Op-Amp. works as a comparator and how its
output varies from low to high and high to low as there is a variation in resistance of LDR.
The fixed resistance (R
1
) and the LDR (R_ldr) are connected in series with a supply (V
cc
) of 10V
as shown in above figure. The voltage at the point between these two resistors V
1
is fed to the
non-inverting input of the comparator. The reference voltage (Vref) is set to 5V, the +V
ee
is set
to +9V and V
ee
to -9V.
The voltage V
1
is given by
R
1
= 4.7 KO (say)
Now,
5.053V V
1
7.914V
Dark
Resistance
Fig.3.1.2 Comparator circuit
cc
ldr
ldr
V
R R
R
V
|
|
.
|

\
|
+
=
1
1
V
R K
R
V
ldr
ldr
10
7 . 4
1

|
|
.
|

\
|
+ O
=
Height And Weight Measuring Machine
8
Case 1:
When the resistance of the LDR increases as the light is blocked by the object
Lets assume the R_ldr increases to reach some value equal to 4.8 KO, then
Here, we see, V
1
> V
ref
, so +Vee propagates to the output and hence the output will be high
Case 2:
When the resistance of LDR decreases as the light falls on its surface
Lets assume the R_ldr decreases to reach some value equal to 4.6 KO, then
Now,
Here, we see, V
1
< V
ref
, so -V
ee
propagates to the output and hence the output will be low
V
V
K K
K
V
053 . 5
10
8 . 4 7 . 4
8 . 4
1
=

|
.
|

\
|
O + O
O
=
V
V
K K
K
V
946 . 4
10
6 . 4 7 . 4
6 . 4
1
=

|
.
|

\
|
O + O
O
=
Height And Weight Measuring Machine
9
3.1.3 Circuit Implementation in height measurement
4
3
2
1
NOT_2
AND_1
NOT_3
NOT_4
AND_2
AND_3
Circuit_1
Circuit_2
Circuit_4
Circuit_3
The above Fig.3.1.3 shows a complete circuit diagram for the measurement of height. In this
project, the circuit is designed for measuring the height up to 4 inch only. There are 4 similar
individual circuits each operating in the same way as the circuit discussed in section 3.1.2 does.
For displaying only the topmost reading of height and thus turning off the lower ones, NOT gate
and AND gate are used which is discussed in detail below.
As already explained in section 3.1.3, we all know how the light sensor is used to get the desired
functionality of comparator circuit. The circuit set up for height measurement is shown in above
Fig.3.1.3. The labels 1, 2, 3 and 4 indicate the output height displays for 4 individual circuits.
When an object of height 1 inch is placed vertically in front of the circuit, it prevents the light
from falling on the lowest (first) LDR as a consequence of which the resistance of the sensor
becomes high and then output display 1 glows while all other remaining displays remain off
since light is not blocked to these sensors. Now when an object of height 2 inch is placed, then
Fig.3.1.3 Complete circuit diagram for height measurement
Height And Weight Measuring Machine
10
the output display 2 glows and all other upper remaining displays remain off. Now, since the 2
inch object will also block the light to the first sensor, the output display 1 should also glow
which is not desired. So in order to make it turn off, the output display 1 is not directly connected
to the output of its comparator circuit (comp_1), instead it is first fed into one of the inputs of
AND gate (AND_1). Another input of this AND gate is coming from the output of the NOT gate
(NOT_2) whose input is the output of the comparator of circuit 2 (comp_2). In this way, when
the 2 inch object is placed in front of the circuit, the output of the NOT_2 will become low since
output of comp_2 is high as light to its LDR is also blocked. Thus the output of AND_1 will be
low since one of the inputs is low and hence the display 1 will be turned off. The output display
2 is the output of AND_2, AND gate whose two inputs are output of comp_2 itself and the
output of NOT_3 whose input is the output of comp_3. At the time when 2 inch object is placed,
since the 3
rd
sensor is not blocked by the object, the output of comp_3 is low and hence the
output of NOT_3 is high and also the output of comp_2 is high which results the output of
AND_2 to go high.
Similarly, when an object of 3 or 4 inch is placed in front of the circuit, only the topmost display
glows and remaining displays will be turned off.
3.1.4 Simulation
For the simulation of the project, using the software called LTSpice, the variation of output of
the comparator circuit is seen.
Fig.3.1.2 clearly shows that the output will be high whenever the resistance of LDR increases
resulting V
1
greater than that of V
ref
. On the other hand, whenever the resistance of LDR
decreases resulting V
1
less than that of V
ref
, the output will be low. These two scenario are
clearly shown in the simulation shown below. Each of the two plots given below is showing
voltage levels at V
1
, V
ref
and output.
Height And Weight Measuring Machine
11
i) High Output
ii) Low Output
V
1
V
ref
V
1
Output Voltage (+V
ee
)
V
ref
Output Voltage (-V
ee
)
Height And Weight Measuring Machine
12
3.2 Weight Measurement
3.2.1 Overview
8-bit ADC
Sensing area
Input Weight
Analog Output
6-bit Bin to
BCD Converter
MSB
LSB
FSR
BCD to 7-Segment
Decoder
Voltage Divider
1
2
3
O
u
t
p
u
t

W
e
i
g
h
t
The circuit overview for the measurement of weight is shown in above Fig.3.2.1. When an object
is placed on the sensor (FSR), some analog voltage is produced at the output of voltage divider
(Potentiometer). The produced analog voltage is then fed into the 8-bit A/D Converter which
converts the decimal (analog) voltage signal into the equivalent 8-bit binary (digital) form. The
8-bit digital output is then is fed into the Binary to BCD Converter. Since 8-bit Bin/BCD
Converter could not be found at the time, three 6-bit Bin/BCD Converters are used instead of
single 8-bit to get full deflection from 0V 4.95V or 0N 255N. The outputs of those three
Bin/BCD Converters in BCD form are then fed into three BCD to 7-Segment Decoders each of
whose outputs are connected to their individual 7segment displays. These three 7-segment
displays display the final output varying from 0 to 255. But since the sensor FSR range is only
0N 98N, the most significant bit (MSB) remains 0 throughout the whole measurement.
Fig.3.2.1 Overview
Height And Weight Measuring Machine
13
3.2.2 Calibration and Weight Calculation
The analog voltage Vin is given by:
From the above circuit of Fig.3.2.2 and above expression of Vin, it is clear that when FSR
decreases Vin increases and vice versa provided that the potentiometer is fixed. If the value of
potentiometer is changed, Vin will be changed. So Vin depends both on potentiometer and FSR.
This is very much useful for the calibration. We have to do very fine adjustment of potentiometer
for the accuracy of the machine.
Now for calibration, first of all potentiometer is adjusted so that Vin = 0V when no load or force
is applied on the sensor and Vin = 4.95V when full load (255N) is applied on the sensor. For
this, the potentiometer is adjusted to reisstance vaue so that the term converges
to almost zero at no load and to 4.95V at full load.
Note:
Stand-off resistance of FSR is very high ( > 1MO)
Potentiometer is fixed at ~ 5KO
Vcc
FSR Pot
Pot
Vin
|
.
|

\
|
+
=
V
FSR Pot
Pot
Vin 5
|
.
|

\
|
+
=
Fig 3.2.2 Potentiometer adjustment
|
.
|

\
|
+ FSR Pot
Pot
Height And Weight Measuring Machine
14
Now, with
Vin = 0V weight = 0N and
Vin = 4.95V weight = 255N,
We have,
Below is the table listing some weight values and their corresponding voltages
Now, a known weight (say 10N) is placed on the sensor and Vin is observed to see if it is
194.1mV. If it is not, potentiometer should be adjusted to get this value. For fine accuracy, try
calibrating with higher weights such as 50N, 60N etc. It is seen that when the maximum weight
98N is placed, the corresponding analog voltage Vin should show the deflection of 1.902V.
Sensor i/p (weight) Sensor o/p (Vin)
0 N 0 mV
1 N 19.41 mV
10 N 194.1 mV
98 N 1.902 V
255 N 4.95 V
mV V N 41 . 19
255
95 . 4
1 =
|
.
|

\
|
=
Height And Weight Measuring Machine
15
4. Components
The various kinds of chips and sensors are used in this project which is discussed in detail below.
First the components used in the height measurement are discussed and those which are used in
the weight measurement are discussed afterwards. The links are also provided for deeper look to
those components.
4.1 For Height Measurement
4.1.1 Light Dependent Resistor (LDR)

The Light Dependent Resistor (LDR), also known as Photo Resistor is a light sensor whose
resistance decreases with the increase of light intensity falling on its surface. The sensing area of
LDR is composed of Cadmium Sulfide (CdS). The graph showing its resistance Vs the intensity
of light is given below:
sensing area
ensity light
R
int _
1

R

(

)
Intensity of Light
Fig.4.1.1 Resistance of LDR Vs Intensity of Light
Dark resistance > 2 MO
Light resistance < 100O
more on http://www.biltek.tubitak.gov.tr/gelisim/elektronik/dosyalar/25/LDR_NSL19_M51.pdf
Height And Weight Measuring Machine
16
4.1.2 Operational Amplifier (Op-Amp)
The Op-Amp LM741 is used as a comparator, not as an amplifier. It is used to compare the two
voltage levels at inverting input terminal (Pin2) and non-inverting terminal (Pin3). There are
total of 8 Pins in LM741. Pin1 and Pin5 are offset null and have not been used (left open). Pin2
is an inverting input where V
ref
= 5V is given. Pin3 is a non inverting input terminal where V1
(voltage across LDR) is given. Pin4 is V
ee
supplied with -9V. Pin6 is the output terminal of the
comparator. Pin7 is +V
ee
supplied with +9V. Pin8 in NC and not connected to anything (left
open).
If voltage level at Pin3 > voltage level at Pin2, +V
ee
at Pin7 propagates to the output Pin6
If voltage level at Pin3 < voltage level at Pin2, -V
ee
at Pin4 propagates to the output Pin6
Fig.4.1.2 LM741: Pin Configuration
more on http://www.national.com/ds/LM/LM741.pdf
Height And Weight Measuring Machine
17
4.1.3 NOT Gate (Inverter)
The NOT Gate used is 7404, Hex Inverter. The chip can invert all six incoming signals
simultaneously. Altogether there are 14 Pins in the IC 7404. Pin1, Pin3, Pin5, Pin9, Pin11 and
Pin13 are six input terminals and Pin2, Pin4, Pin6, Pin8, Pin10 and Pin12 are their corresponding
output terminals. Pin7 is for grounding (GND) and Pin14 is for supply (V
cc
).

Truth Table
H: High Voltage Level
L: Low Voltage Level
Input Output
X X'
0 (L) 1 (H)
1 (H) 0 (L)

Fig.4.1.3 (a) Hex Inverter 7404: Pin Configuration
X X
Fig.4.1.3 (b) NOT Gate Symbol
more on http://www.standardics.nxp.com/products/fast/datasheet/74f04.pdf
Height And Weight Measuring Machine
18
4.1.4 AND Gate
The AND Gate used is 7408, Quad Two Input. The chip can be used for all 4 AND operations
simultaneously with two inputs. Like NOT Gate discussed above, this 7408 has also 14 Pins.
Pin3 is the output of two inputs Pin1 and Pin2. Similarly, Pin6, Pin8 and Pin11 are the three
individual outputs of inputs Pin4 and Pin5, Pin9 and Pin10 & Pin12 and Pin13 respectively. Pin7
is connected to GND and Pin 14 is connected to V
cc
.
Truth Table
Output
X Y XY
0 0 0
0 1 0
1 0 0
1 1 1
X
Y
XY
Fig.4.1.4 (a) Quad Two input AND Gate 7408: Pin Configuration
Fig.4.1.4 (b) AND Gate Symbol
more on http://www.standardics.nxp.com/products/fast/datasheet/74f08.pdf
Input
Height And Weight Measuring Machine
19
4.1.5 Seven Segment Display
The Seven Segment Display is comprised of 7 individual LEDs. The display used in this project
is Common Anode type. That means the +ve legs of all the 7 LEDs are connected to a common
point (here Pin3) and each of the ve leg is connected to one of the pins (here Pin1, Pin2, Pin5,
Pin6, Pin8, Pin9 and Pin10). Pin3 is connected to V
cc
= 2V with a resistor in series. Pin7 and
Pin11 are left open (not used). Below is the table showing the numbers from 0 9 in the display
and corresponding segments used.
For the display of 0, only Pin9 or segment g is connected to Vcc and rest of all connected to
GND. Similarly for 9, only Pin5 (segment e) and Pin6 (segment d) are connected to Vcc
and rest are connected to GND.
Pin1 Pin10 Pin8 Pin6 Pin5 Pin2 Pin9
Nos. a b c d e f g
0 0 0 0 0 0 0 1
1 1 0 0 1 1 1 1
2 0 0 1 0 0 1 0
3 0 0 0 0 1 1 0
4 1 0 0 1 1 0 0
5 0 1 0 0 1 0 0
6 0 1 0 0 0 0 0
7 0 0 0 1 1 1 1
8 0 0 0 0 0 0 0
9 0 0 0 1 1 0 0
Fig.4.1.5 Seven Segment Display
more on http://www.inesc-macau.org.mo/people/dmc/DSys2/Experiment/Lab03/7-segment.pdf
Height And Weight Measuring Machine
20
4.1.6 Light Emitting Diode (LED)
The Light Emitting Diode (LED) is a diode which emits light when forward biased. The LED
starts emitting light when the voltage across the diode exceeds the threshold voltage which is
0.7V. It is one of the excellent indicators used very widely in the whole world in applications
such as microwave, TV, Radio, Computers etc. The maximum voltage supply for LED is 5V and
3V is a nominal voltage. The life span of a typical LED is about 11 years.
4.1.7 Resistor
Resistor is an electronic component which resists or limits the flow of current flowing through
the circuit by producing a voltage drop between its terminals folowwing the Ohms law V = I.R
whrere V is the voltage drop across its two terminals, I is the current flowing through the resistor
and R is the resistance of the resistor. It is one of the essential components in electronic world.
more on http://my.ece.ucsb.edu/bobsclass/2B/Labs/Datasheets/QED222.pdf

+ve leg
(Anode)
-ve leg
(Cathode)
Fig.4.1.6 Light Emitting Diode
Fig.4.1.7 Resistors
more on http://www.the12volt.com/resistors/resistors.asp

Height And Weight Measuring Machine
21
4.2 For Weight Measurement
4.2.1 Force Sensing Resistor (FSR)
The Force Sensing Resistor (FSR) is a force sensor whose resistance decreases with the increase
of force or load exerting on its sensing area. The sensing area of FSR is composed of polymer
thick film. The graph showing its resistance Vs the magnitude of force is given below:
The 1.5 inch FSR is used in this project. 1.5 means the sensing area of the FSR is 1.5 1.5.

F
R
1

|
.
|

\
|
O k
1
Force or weight (g)
C
o
n
d
u
c
t
a
n
c
e
R
e
s
i
s
t
a
n
c
e
( ) O k
Perfect
Linearity
Error due to repeatability
Saturation
Point
Fig.4.2.1 1.5 & 0.5 Force Sensing Resistors
1.5
1.5
0.5
Force
R
1

Fig.4.2.1 Resistance of FSR Vs Force


more on http://www.trossenrobotics.com/images/productdownloads/FSR%20data.pdf
Stand-Off resistance > 1 MO
Full load resistance < 200O
Height And Weight Measuring Machine
22
4.2.2 Analog to Digital Converter (A/D Converter)
For A/D conversion, ADC0804 is used. Its an 8-bit A/D converter which takes analog input
signal and converts it into digital output displaying 0 - 255. A/D conversion is necessary and one
of the most important parts of this project. The pin configuration and connection setup is shown
in above Fig.4.2.2
ADC0804 has total of 20 Pins. Pin1 and Pin2 are shorted to GND. Pin3 and Pin5 are shorted. A
10KO resistor is connected between Pin4 and Pin19. Also Pin4 is connected to a ceramic
capacitor of 150pF whose another terminal is connected to GND. Pin6 is for analog input (Ain)
which is connected to the FSRs output (here). Pin7, Pin8 and Pin10 are grounded. Pin9 is for
V
ref
/2. Pin11 through Pin18 are the digital output pins. Pin20 is connected to V
cc
or V
ref
.
FSR
A
in
V
ref
/ 2
5V
5V
2.5V
9 6
Fig.4.2.2 ADC0804: Pin Configuration
more on http://socrates.berkeley.edu/~phylabs/bsc/PDFFiles/ADC0804.pdf
Height And Weight Measuring Machine
23
4.2.3 Binary to BCD Converter


The 74185A is a 6-bit Binary to BCD Converter which intakes 6-bit binary inputs and produce 6-
bit BCD outputs. Pin 1 through Pin5 are the 5-bit BCD outputs and the remaining one bit BCD
output is the LSB of the binary input. The Most Significant Bits (MSB) Pin6, Pin7 and Pin9 are
not used for 6-bit Bin/BCD Conversion. Pin10 through Pin14 are the 5-bit binary inputs and the
remaining Least Significant Bit (LSB) is the LSB of A/D output. Pin15 is grounded. Pin16 is
connected to Vcc. With this single 74185A, the maximum BCD number that can be achieved is
11 1001 (= 39).
For 8-bit conversion, 8-bit Bin/BCD Converter is required. Instead of using single 8-bit
Bin/BCD Converter, three 6-bit Bin/BCD Converters (74185A) can be used. So the three 6-bit
74185A are used to get full conversion from 0 255. The connection setup for the 8-bit
conversion using three 6-bit 74185A is given below:
LSB
Binary
LSB
BCD
Fig.4.2.3 (a) 6-bit Bin/BCD Converter 74185A: Pin Configuration
6-bit Binary Inputs
6-bit BCD Outputs
Height And Weight Measuring Machine
24
The above figure shows how the 8-bit Binary to BCD conversion can be accomplished using
three 6-bit Bin/BCD Converters. For the conversion, the LSB remains same throughout the
conversion. So, as shown in above Fig.4.2.3 (b), the LSB of the binary output from A/D
converter is used as the LSB of the final 8-bit BCD output after three stages of Bin/BCD
conversions.
The first 74185A intakes 5 first MSBs (B
7
- B
3
) of 8-bit output of A/D Converter. The bits B
1
, B
2
and the first three LSB outputs (Y
1
,Y
2
, Y
3
) of first 74185A are the 5 inputs for the second
74185A. The MSB of the third 74185A (Pin14) is grounded. The 4 inputs of the third 74185A
are the combination of first three MSB outputs (Y
6
, Y
5
, Y
4
) of the first 74185A and the first
MSB output (Y
6
) of the second 74185A. In this way, the final 8-bit BCD output achieved is
(going from MSB to LSB) the combination of all the five bit output of the third 74185A (Y
5

Y
1
), the outputs (Y
4
Y
1
) of the second 74185A and the LSB of the A/D converter output.
Fig.4.2.3 (b) 8-bit Bin/BCD Conversion using three 74185A
LSB
Binary
LSB
BCD
LSB of Binary = LSB of BCD
MSB LSB
MSB
Binary
1
3
2
more on http://eshop.engineering.uiowa.edu/NI/pdfs/00/65/DS006561.pdf
Height And Weight Measuring Machine
25
4.2.4 BCD to 7-Segment Decoder
The DM74LS47 is a BCD to 7-Segment Decoder which intakes an input data of four line (8421)
BCD (output of Bin/BCD Converter: 74185A) and decodes the BCD input data into 7 segments
(a g) which are the inputs to the 7-Segment Display. DM74LS47 has a total of 16 pins. Pin7,
Pin1, Pin2 and Pin3 are the 4 line BCD input bits LSB to MSB respectively. Pin3, Pin4 and Pin5
are not used (left open). Pin8 is shorted to GND. Pin9 Pin15 are the 7 segments outputs. Pin16
is connected to V
cc
= 5V.
7
4
4
7
Fig.4.2.4 (a) BCD to 7-Segment Decoder DM74LS47: Pin Configuration
Height And Weight Measuring Machine
26
The above Fig.4.2.4 (b) shows the inter-connection between Bin/BCD Converter 74185A,
BCD/7-Segment Decoder DM74LS47 and 7-Segment Display. For the display from 0 255, the
three 7-segment displays are connected to 7-segment outputs of the three individual DM74LS47
which are connected to the BCD outputs of 8-bit converter made by three 74185A.
Referring to the Fig.4.2.3 (b) and Fig.4.2.4 (b), Y
3
Y
2
Y
1
in green color which are the outputs of
second 74185A and B
0
in blue color, the LSB of A/D converter are fed into the input of the
DM74LS47 connected to the LSB Display. Y
3
Y
2
Y
1
in red color and Y
4
which are the outputs of
third and second 74185A respectively are fed into the input of the DM74LS47 connected to the
display for mid value (display between MSB and LSB). Y
5
Y
4
in red color are fed into the first
two LSB inputs of the DM74LS47 connected to the display for MSB. The first two MSB input
pins (Pin2 and Pin6) of DM74LS47 connected to MSB display are grounded.
5V
MSB
LSB
Fig.4.2.4 (b) Interconnection of DM74LS47 with 74185A and 7-Segment Display
more on http://web.mit.edu/6.s28/www/datasheets/DM74LS47.pdf
Y
3
Y
2
Y
1
B
0
Y
3
Y
2
Y
1
Y
4
Y
5
Y
4
Outputs of 3
rd
74185A
Outputs of 2
nd
74185A
LSB of A/D converter
Height And Weight Measuring Machine
27
4.2.5 Voltage Divider (Potentiometer)
Potentiometer, also widely known as potential divider or voltage divider, is an electro-
mechanical transducer which can be used a variable resistor (rheostat) as well as a voltage
divider. It converts rotary or linear motion from the operator into a change in resistance. The
potentiometer can be used as a rheostat if only any of two terminals are used and it can be used
as a voltage divider of all the three terminals are used.
There are basically two parts: Adjusting element and Range selecting element. As shown in
Fig.4.2.5, by selecting any of the two terminals (range selection), and adjusting the value just by
rotating the adjusting element (value adjustment), the desired value of resistance can be achieved
within the range selected. For example, the potentiometer of 10KO means the full range
selection is 0 - 10KO and is obtained by selecting Pin1 and Pin3 as the two terminals of the
potentiometer and adjusting to full deflection just by rotating the adjusting element. Also, any
resistance value within this range can be obtained simply by rotating the adjusting element and
observing the resistance value using a multimeter. Half range (0 - 5KO) can be obtained by
selecting either Pin1 and Pin2 or Pin2 and Pin3.
Fig.4.2.5 Potentiometer (Voltage Divider)
Adjusting element
Range Selecting element
more on http://sound.westhost.com/pots.htm
Height And Weight Measuring Machine
28
4.2.6 Capacitor
A capacitor is an electrical/electronic device that can store energy in the electric field between a
pair of conductors (called "plates"). The process of storing energy in the capacitor is known as
"charging", and involves electric charges of equal magnitude, but opposite polarity, building up
on each plate.
There are basically two types of capacitors if categorized on the basis of its polarity.
i) Polarized Capacitor having polarity
ii) Unpolarized Capacitor ... no polarity
In this project, both types of capacitors are used for different purposes.
Fig.4.2.6 Capacitors
more on http://www.kpsec.freeuk.com/components/capac.htm
Height And Weight Measuring Machine
29
5. Truth Table
Fig.5 Truth Table showing outputs of 7-Segment Display, A/D Converter and Bin/BCD Converter
Height And Weight Measuring Machine
30
6. Design Limitation
As all designs have their own limitations depending upon the nature and the need of their design
application and implementation, this project has also some of its limitations in design. Some of
the limitations come from the design itself and some of them come from the components
incapability. The design limitations for both height and weight measurement are discussed
below.
Limitation in:
i) Height Measurement
ii) Weight Measurement
i) Height Measurement
The circuit is designed only for measuring the height of 0 to 5 inch. However it is not the real
limitation in design since the circuit can be easily redesigned to have an extended measurement.
The current design for the height measurement circuit has a resolution of 1 inch. It is not
designed to display the height lying between two whole numbers. For example, it cant measure
the height of decimal numbers such as 1.5 inch, 2.4 inch, 3.1 etc. It can only measure the height
in whole numbers. The maximum resistance of LDR (dark resistance) is greater than 2MO and
less than 100O in bright light.
ii) Weight Measurement
The weight sensor, FSR has its upper limit of 98N or 10 Kg. It means that it cant weigh more
than 10 Kg. It has also its lower limit which is 20g. It means that it cant sense the weight below
20g. The current design for weight measurement has the resolution of 1N. It cant take the
measurement below 1N step size, i.e., the machine cant display the weight in decimal number
such as 5.6N, 60.8N etc. The FSR stand off resistance is greater than 1MO and resistance at
saturation is less than 200O.
Height And Weight Measuring Machine
31
7. Programs written in C++
Few programs written in C++ are also listed here for the useful calculation of both Height and
Weight measurements.
Program 7.1
Program to observe when the output of the comparator goes HIGH/LOW
#include<iostream.h>
#include<conio.h>
int main()
{

float R_ldr,R1,V1,Vref,Vcc;
cout<<"\tSWITCHING OUTPUT (HIGH/LOW) OF THE COMPARATOR\n";
cout<<"\t---------------------------------------------\n\n";
for(int i=0;i<3;i++)
{
cout<<"Enter the value of Vcc(V): ";
cin>>Vcc;
cout<<"Enter the value of Vref(V): ";
cin>>Vref;
cout<<"Enter the value of resistance of LDR(ohm): ";
cin>>R_ldr;
cout<<"Enter the value of R1(ohm): ";
cin>>R1;
V1=(R_ldr/(R_ldr+R1))*Vcc;
cout<<"V1 = "<<V1;cout<<"V";
cout<<"\t\tVref = "<<Vref;cout<<"V";
cout<<"\n";
if(V1>Vref){
cout<<"\nSince V1>Vref, +Vee propogates to the output and
hence goes high resulting Display to glow.\n\n";
}
else
cout<<"\nSince V1<Vref, -Vee propogates to the output and hence goes low
resulting Display to stay in off state:\n\n";
}

getch();
}
Height And Weight Measuring Machine
32
Program 7.2
Program to convert analog signal into digital signal
#include<iostream.h>
#include<conio.h>
#define BIT_LENGTH 8
void adc(int decimal_value,unsigned char string[BIT_LENGTH]);
int main()
{
int decimal_value; unsigned char s[BIT_LENGTH];
cout<<"\t\t8-bit ANALOG to DIGITAL Converter\n";
cout<<"\t\t----------------------------------\n\n";
cout<<"\t/* Software to convert Decimal Number to Binary
Number.*/\n\n\n\n\n";
for(int j=0;j<5;j++)
{
cout<<"Enter any Decimal Number within [0 - 255]: ";
cin>>decimal_value;
if(decimal_value<=255)
{
if(decimal_value==255)
cout<<"This is the highest binary
output with 8-bit A/D Converter.\n";
adc (decimal_value,s);
cout<<"The eqvt Binary number is: ";
for (int i=0;i<BIT_LENGTH;i++)
cout<<(int)s[i];
cout<<"\n\n\n\n";
}
else
cout<<"ENTERED DECIMAL NUMBER IS OUTSIDE THE RANGE.\n\n";
}
getch();
}
void adc(int decimal_value,unsigned char string[BIT_LENGTH])
{
for(int i=0;i<BIT_LENGTH;i++)
string[BIT_LENGTH-1-i]=(decimal_value>>i)& 0x01;
}
Height And Weight Measuring Machine
33
Program 7.3
Program to convert Analog Input Weight to Analog Output Voltage
#include<iostream.h>
#include<conio.h>
int main()
{
float weight,volt,;
int max_weight=255;
float max_volt=4.95;
cout<<"\n\t\tANALOG INPUT WEIGHT TO ANALOG OUTPUT VOLTAGE CONVERTER\n";
cout<<"\t\t------------------------------------------------------\n\n\n";
for(int i=0;i<5;i++)
{
cout<<"Enter an Input Weight within [0 - 255N]: ";
cin>>weight;
if(weight<=max_weight)
{
volt=(max_volt/max_weight)*weight;
cout<<"Input Voltage = "<<volt;
cout<<"V";
cout<<"\n\n";
if(weight==max_weight)
cout<<"This is the maximum voltage
value\n\n\n";
}
else
if(weight>max_weight)
cout<<"ENTERED VALUE IS OUTDSIDE THE RANGE\n\n";
}

getch();
}
Height And Weight Measuring Machine
34
Program 7.4
Program to convert Analog Output Voltage to Output Weight
#include<iostream.h>
#include<conio.h>
int main()
{

float weight,volt,;
int max_weight=255;
float max_volt=4.95;
cout<<"\n\t\tANALOG OUTPUT VOLTAGE TO OUTPUT WEIGHT CONVERTER\n";
cout<<"\t\t------------------------------------------------\n\n\n";
for(int i=0;i<5;i++)
{
cout<<"Enter an Analog Output Voltage within [0 - 4.95V]: ";
cin>>volt;
if(volt<=max_volt)
{
weight=(max_weight/max_volt)*volt;
cout<<"Output Weight = "<<weight;
cout<<"N";
cout<<"\n\n";
if(volt==max_volt)
cout<<"This is the maximum weight that can be
displayed with an 8-bit ADC\n\n\n";
}
else
if(volt>max_volt)
cout<<"ENTERED VALUE IS OUTDSIDE THE RANGE\n\n";
}

getch();
}
Height And Weight Measuring Machine
35
8. Gantt Chart
Project Title Selection
Materials Search
Proposal preparation
Circuit design and simulation
Hardware set up
Project Presentation
Report Preparation
1 2 3 4 5 6 7 8 9 10

Week
Tasks
Height And Weight Measuring Machine
36
9. Conclusion
The different characteristics of the two sensors FSR and LDR are studied carefully and
implemented in our circuit design to build up the machine. In the course of the project, different
kinds of ICs are analyzed and implemented them practically in the circuit design. Finally, with
the appropriate circuit design and its hardware implementation, the height and weight measuring
electro-mechanical machine is successfully built.
Height And Weight Measuring Machine
37
10. References:
[1] Op Amps & Linear Integrated Circuits: Gayakward R.A.
[2] Electronic Devices and Circuits (6
th
Edition): Theodore F. Bogart, Jeffery S. Beasley,
Guillermo Rico
[3] http://www.biltek.tubitak.gov.tr/gelisim/elektronik/dosyalar/25/LDR_NSL19_M51.pdf
[4] http://www.national.com/ds/LM/LM741.pdf
[5] http://www.standardics.nxp.com/products/fast/datasheet/74f04.pdf
[6] http://www.standardics.nxp.com/products/fast/datasheet/74f08.pdf
[7] http://www.inesc-macau.org.mo/people/dmc/DSys2/Experiment/Lab03/7-segment.pdf
[8] http://my.ece.ucsb.edu/bobsclass/2B/Labs/Datasheets/QED222.pdf
[9] http://www.the12volt.com/resistors/resistors.asp
[10] http://www.trossenrobotics.com/images/productdownloads/FSR%20data.pdf
[11] http://socrates.berkeley.edu/~phylabs/bsc/PDFFiles/ADC0804.pdf
[12] http://eshop.engineering.uiowa.edu/NI/pdfs/00/65/DS006561.pdf
[13] http://web.mit.edu/6.s28/www/datasheets/DM74LS47.pdf
[14] http://sound.westhost.com/pots.htm
[15] http://www.kpsec.freeuk.com/components/capac.htm

Das könnte Ihnen auch gefallen