Upload
ioan-doroftei
View
234
Download
0
Embed Size (px)
Citation preview
8/17/2019 Line follwer robot using LM324.doc
1/11
Line follwer robot using LM324
Designing a simple and yet functional Line Follower Robot (LFR) is always a fascinating and challenging subject to
be learned, the LFR actually could be implemented in many ways start from a simple two transistors to a
sophisticated PID (Proportional, Integrate and Differential) which tae ad!antage of the programmable feature of
microcontroller to calculate the PID e"uation to successfully na!igate the blac trac line on a white bacgroundsurface#
Designing a non microcontroller based LFR is "uite challenging tass as we need to limit the electronic components
numbers so the LFR will not too complicated to be built by most a!erage robotics beginners or electronic hobbyists,
but at the same time we need to ha!e a good speed control mechanism in order for the LFR to na!igate the blac
trac line successfully# $he microcontroller based design LFR in the other hand is a popular choice because it
reduces a number of electronic components significantly while still pro!iding a fle%ible programmable control to the
LFR#
&n this tutorial we are going to build yet another LFR using just the standard analog components easily found on the
maret but use the same speed control method techni"ue found in many good microcontroller based Line Follower
Robot design# 's the result we could get a good precision analog line follower robot that comparable to the
microcontroller based Line Follower Robot design# &n this tutorial you will also learn many useful information of how
to use the operational amplifier#
The Line Follower Robot
http://4.bp.blogspot.com/-1cx2T7rtdLQ/UH5CNERplDI/AAAAAAAAABY/Bmxdc-JAjh4/s1600/op-amp_lfr_16.jpg
8/17/2019 Line follwer robot using LM324.doc
2/11
$his Line Follower Robot basically use a admium ulphide (d) photocell sensor or nown as Light Dependent
Resistor (LDR) and the high intensity blue Light *mitting Diode (L*D) to illuminate the area under the photocell
sensor to sense the blac trac line and the D motor speed control techni"ue to na!igate the blac line trac as
shown on this following picture+
$he easy method to na!igate the blac trac line is to turn & and &FF the left or the right D motor according to the
sensor reading (blac turn &FF and white turn &), but using this method will mae the LFR to mo!e in -ig-ag way#
.y proportionally control both left and right D motor speed according to the light intensity le!el recei!ed by the
photocell sensor (reflected bac by the blac trac line) we could mae the LFR easily na!igate this trac# $he
common techni"ue to control the motor speed efficiently is to use a pulse signal nown as the pulse width modulation
or P/0 for short#
P/0 basically is an & and &FF pulse signal with a constant period or fre"uency# $he proportion of pulse & time
to the pulse period is called a 1duty cycle2 and it e%pressed in percentage# For e%ample if the proportion of pulse &
time is 345 to the total pulse period than we say that the P/0 duty cycle is 345# $he P/0 duty cycle percentage is
corresponding to the a!erage power produced by the pulse signal6 the lower percentage produces less power than
the higher percentage#
http://4.bp.blogspot.com/-dJt5ymnesHI/UH5CqZEQdlI/AAAAAAAAAB4/aBytVEK8eKA/s1600/op-amp_lfr_03.jpghttp://4.bp.blogspot.com/-p3cyHC31Hbk/UH5Clm7PK7I/AAAAAAAAABo/8xdQKxFvgs4/s1600/op-amp_lfr_01.jpg
8/17/2019 Line follwer robot using LM324.doc
3/11
$herefore by changing the P/0 duty cycles we could change the a!erage !oltage across the D motor terminals,
this mean we could !ary the D motor speed just by changing the P/0 duty cycle# $herefore to mae the LFR
smoothly na!igate the blac trac line, we ha!e to adjust the P/0 duty cycle according to the photocell sensorreading# $he brighter light intensity le!el recei!ed by sensor (sensor is on the white surface) will result in higher P/0
duty cycle percentage and the darer light intensity le!el (sensor is on the blac line) recei!ed by photocell sensor will
result in lower P/0 duty cycle percentage#
.y con!erting each of the photocell sensor light intensity le!el reading to the corresponding !oltage le!el we could
achie!e this objecti!e by using what is nown as the 7oltage ontrol Pulse /idth 0odulation principal#
'ctually generating the P/0 signal is easier with microcontroller instead of discrete components because all you
ha!e to do is to program the microcontroller P/0 peripheral to do the tas# &n this tutorial we will learn of how to
build this LFR with 7oltage ontrol P/0 using the same woring principal found in many today8s modern
microcontroller but using just the analog electronic components#
ow let list down the necessary electronic and other supported components to build this awesome LFR+
9# Resistors+ ::4 (:), 9; (:), 93; (9), # &ptional 3 mm auto flash RC. L*D with
8/17/2019 Line follwer robot using LM324.doc
4/11
$he complete Line Follower Robot electronics schematic is shown on this following picture+
The Voltage Control PWM
$he main brain of this Line Follower Robot is lay behind the L0
8/17/2019 Line follwer robot using LM324.doc
5/11
$he !oltage control P/0 could be generated by first using the triangle signal generator which pro!ide the basic
P/0 pulse fre"uency and the necessary ramp !oltage (rise and down) to produce the P/0 signal# e%t by
continuously comparing this ramp !oltage according to the !oltage le!el produced by the photocell sensor using the
comparator circuit we could produced the e%act !oltage control P/0 as shown on this following picture#
$he !oltage control P/0 could be generated by first using the triangle signal generator which pro!ide the basic
P/0 pulse fre"uency and the necessary ramp !oltage (rise and down) to produce the P/0 signal# e%t by
continuously comparing this ramp !oltage according to the !oltage le!el produced by the photocell sensor using the
comparator circuit we could produced the e%act !oltage control P/0 as shown on this following picture#
http://3.bp.blogspot.com/-bMMHb4vufH4/UH5C8AxbwOI/AAAAAAAAACg/CvfOXXa4c_0/s1600/op-amp_lfr_09.jpghttp://4.bp.blogspot.com/-G8ktuFRFKp0/UH5C1WLNKZI/AAAAAAAAACQ/DxglYWnIaBk/s1600/op-amp_lfr_07.jpg
8/17/2019 Line follwer robot using LM324.doc
6/11
$he ramp signal is pro!ided by the two opamps (G9' and G9.) that generate the triangle wa!e signal while the
comparator for producing the P/0 to each D motor is pro!ided by the other two opamps (G9 and G9D) that
receipt its input from the !oltage di!ider circuit (7R and LDR) which pro!ide the !oltage threshold point and together
with the triangle wa!e to produce the re"uired P/0 pulse
$he P/0 principal e%plained abo!e is also used in many today8s modern microcontrollers P/0 peripheral6 but
instead of processing the analog signal it process the digital signal# $he ramp signal is replaced by the digital counter
($I0*R peripheral) that will count up from 4 to :33 and start from 4 again, while the threshold point !oltage is
pro!ided by threshold point register that hold the digital !alue (e#g# 944)#
0icrocontroller uses the digital comparator to compare these two digital !alues, when the digital counter counting up
and reach the threshold point (i#e# 944) then the P/0 peripheral will turn on to the output port and when it reach the
ma%imum !alue (i#e# :33) it will turn off to the output port# $herefore by changing the threshold point register !alue we
could change the P/0 duty cycle output# Hou could read more about microcontroller based P/0 on B.ridge0icrochip PI 0icrocontroller P/0 0otor ontroller and Introduction to '7R 0icrocontroller Pulse /idth 0odulation
(P/0)articles on this blog#
http://www.ermicro.com/blog/?p=706http://www.ermicro.com/blog/?p=706http://www.ermicro.com/blog/?p=224http://www.ermicro.com/blog/?p=224http://3.bp.blogspot.com/-MbEgToOfb0s/UH5C-tZQUkI/AAAAAAAAACo/D9l7x9rGh3g/s1600/op-amp_lfr_10.jpghttp://3.bp.blogspot.com/-q2oFI0ynIds/UH5C5i_yLmI/AAAAAAAAACY/sJmuX_NiCJ4/s1600/op-amp_lfr_08.jpghttp://www.ermicro.com/blog/?p=706http://www.ermicro.com/blog/?p=706http://www.ermicro.com/blog/?p=224http://www.ermicro.com/blog/?p=224
8/17/2019 Line follwer robot using LM324.doc
7/11
/hen designing the electronic circuit is a good habit to prototype it first, the prototype circuit enables us to fine tune
the electronics design and gi!e us the picture (signal wa!e) of how the circuit really wors# $he following picture is the
Line Follower Robot circuit prototype on a breadboard complete with sensor (L*D and LDR pairs) and the C0:
geared D motor from olarbotics#
The Triangle Wave Generator Circuit
ow as you understand the principal of how the Line Follower ircuit wors than let8s tae a loo at the triangle wa!e
generator circuit# In order to mae it easy to understand I redraw the electronic schematic circuit separately as shown
on this following picture+
$o generate the triangle wa!e we need to use the chmitt $rigger circuit (also called a comparator with hysteresis)
that act as & and &FF switch to the Integrator circuit input# $he integrator uses the R3 and : to produce the
necessary triangle linear ramp (up and down) on its output#/hen the power up we assume the G9' output is BICB (7cc)6 the : capacitor will start to charge through the R3
resistor# .ecause the R3 and : is connected to the G9. in!erting input (V), therefore the G9. output will start to
http://2.bp.blogspot.com/-QMmvc40aPPM/UH5DFiqQHUI/AAAAAAAAAC4/-8GJpSLS4LA/s1600/op-amp_lfr_12.jpghttp://2.bp.blogspot.com/-RTtkjv3SJHc/UH5DCOvVq0I/AAAAAAAAACw/0MOwlszfoiA/s1600/op-amp_lfr_11.jpg
8/17/2019 Line follwer robot using LM324.doc
8/11
ramp down# $he G9' non in!erting input (V!) get the positi!e feedbac from R< and R=, when the G9. output
!oltage reach the threshold !oltage below 7ref than it will turn the G9' output to L&/ (4)# $his bottom threshold
!oltage could be calculated as follow+
7th (R= (7outu9a J 7outu9b) ? (R= K R) K 7outu9b 4#= 7cc
9#= J 4#< 7outu9b K 7outu9b 9#A
Voutu"b #$ %&' Volt
$herefore the G9. output will ramp down to about 4#@ !olt than the G9' output will turn &FF# e%t the : capacitor
will discharge through R3 and the G'9. output will start to ramp up and it start to increase the !oltage across the R=
(7th J threshold !oltage) until the 7th !oltage abo!e the 7ref !oltage then the G9' output will turn to BICB and the
whole cycle will repeat again# $his upper threshold !oltage could be calculated as follow+
7th (R= (7outu9a J 7outu9b) ? (R= K R) K 7outu9b M 4#= 7cc
4#< 7outu9b K 7outu9b M 9#A
Voutu"b ($ 2&' Volt$herefore the triangle !oltage will ramp up from 4#@ !olt to :#@ !olt then ramp down to 4#@ !olt repeatedly# $he
fre"uency of the triangle wa!e could be calculated as follow+
Fre"uency (9 ? (= % R3 % :)) % (R
8/17/2019 Line follwer robot using LM324.doc
9/11
's the robot mo!e on the blac trac line the LDR will continuously capture the reflected light and con!ert this light
intensity into the corresponding !oltage and feeding it to the in!erting input (V) of G9 (left sensor) and G9D (right
sensor)#
$he 944; trimpot and LDR basically is the !oltage di!ider circuit when the LDR detect the blac trac line i t will
recei!e less light intensity (LDR resistance increase) and the !oltage (V) will increase6 this will decrease the P/0
duty cycle output and as the result the geared D motor will turn slowly or stop# /hen the LDR on the white surface it
will recei!e ma%imum light intensity (LDR resistance decrease) and the !oltage (V) will decrease6 this will increase
the P/0 duty cycle output and as the result the geared D motor will turn fast#
Hou could simply e%change the comparator V! and V input source to mae the Line Follower Robot detect the white
line on the blac surface instead of normal blac l ine on the white surface# .y using two DPD$ (Double Pole Double
$hrow) switches you could achie!e this beha!ior as shown on this following picture+
$he geared D motor dri!er uses the .@
8/17/2019 Line follwer robot using LM324.doc
10/11
$he Line Follower Robot construction could be constructed freely but the easiest one is to use the discarded D?D7D
R&0 as shown on this following pictures+
I glue the two DR&0 together in order to mae more room and attached the two D motors,
8/17/2019 Line follwer robot using LM324.doc
11/11
na!igate a "uite comple% blac trac line# $his pro!e that a good analog Line Follower Robot design sometimes could
outperform many microcontrollers based Line Follower Robot#
.uilding the Line Follower Robot (LFR) is one of my fa!orite projects as I enjoy designing and maing this ind of
robot, it also gi!es much joy and fun to my ids as well# I hope this project wil l gi!e you as much joy as I did6 building,
watching, and playing with this analog Line Follower Robot#