This is only a preview of the May 1999 issue of Silicon Chip. You can view 33 of the 96 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Articles in this series:
Items relevant to "The Line Dancer Robot":
Items relevant to "An X-Y Table With Stepper Motor Control; Pt.1":
Items relevant to "Three Electric Fence Testers":
Items relevant to "Heart Of LEDs":
Items relevant to "Build A Carbon Monoxide Alarm":
Articles in this series:
Purchase a printed copy of this issue for $10.00. |
Here’s A Great
School or Club Project:
The Line
Dancer
This cute little robot is quite
single‑minded: it will follow
a black line on a white
surface and if it meets an
obstruction it will come
to a stop.
And to add visual
interest, it has a six‑LED
“scanner” which flashes
back and forth and a
two‑LED flasher as well.
Best of all, it uses simple
electronics and readily
available mechanical
parts.
By ANDERSSON NGUYEN
16 Silicon Chip
P
owered by four AA batteries,
the Line Dancer is an ideal
high school electronics or
industrial arts project, giving experience in Perspex work, metal work,
electronics soldering, construction
and even printed circuit manufacture
if desired.
The Line Dancer is roughly cylindrical in shape and has three wheels,
two at the back to drive it and a trailing
castor at the front to allow it to go
around corners. Above the drive system is the circular PC board carrying
the electronics and above that again
is the battery holder.
The two driving wheels are individually driven by miniature motor/
gearbox assemblies. The collision
avoidance system uses ultrasonic
trans
d ucers which are driven at
40kHz.
Fig.1 shows the simplicity of the
circuit driving the Line Dancer. The
line sensing circuit works on the
principle of reflected light. There are
two motors, one for each rear wheel
and each is controlled by its own
light- sensing circuit.
So let’s look at the right motor and
its sensor circuit first. When its sensor,
photodiode D14, is positioned over a
white (light-reflecting) background, it
picks up light from the high intensity
LED7 and this causes D14 to conduct.
Note that the photodiode (D14) is of
a type used in IR remote controls but
without the IR filters and it reacts to
white light. As you can see, the pho-
to-diode is reverse‑biased and in the
absence of light, it is non-conducting.
When it picks up light from LED7, it
conducts and so the voltage at the
base of Q3 drops to around 0.3V or
less, which turns off Q3.
Therefore the collector of Q3 and
pin 8 of NAND gate IC4c is high. Assuming for a moment that the other
input (pin 9) to IC4c is also high, pin
10 of IC4c will be low and this will
cause transistor Q2 to conduct and
drive the right motor.
The circuitry for the left drive motor, involving LED8, photodiode D15
and transistors Q4 & Q5, together with
NAND gate IC4b, works in exactly the
same way.
The sensors and their respective
illuminating LEDs are mounted on
either side of the robot and hence are
on either side of the black line. Supposing that the robot is “on track”, that
is the black line is essentially in the
middle, then both sensors receive reflected light from the light background
and so both motors are running and
the Line Dancer crawls forward.
Now, when the robot encounters
a curve in the black track, or deviates to one side (as it will inevitably
do, particularly on long stretches of
straight track) as a result of unequal
motor speeds, one of the LEDs will
cut onto the track, reducing its reflection. The photodiode sensor then
stops conducting, becomes effectively
a high resistance and the associated
transistor (Q3 or Q5) switches on.
As a result, the input to its respective NAND gate becomes low and the
motor drive transistor switches off
and its motor stops.
Since the opposite motor continues
to move forward, the robot is forced
to rotate to the opposite side, taking
the turned‑off photodiode away from
the black track whereby both motors
can run again.
When turning 90° around a curve,
this process usually occurs several
times, depending on the radius of
curvature. On long straight stretches,
the robot will tend to zigzag a little
as a result of slightly unequal motor
speeds.
Collision avoidance
The circuit responsible for obstacle
detection revolves around an ultrasonic receiver/transmitter pair. The
transmitter is driven by a 555 timer
operating at around 40kHz.
When the Line Dancer encounters
an obstacle, the 40kHz signal from the
ultrasonic transducer is reflected by
the obstacle to the ultrasonic receiver.
Its output signal is amplified by
transistor Q1 which drives a diode
pump circuit consisting of diodes D10
& D11 and capacitors C3 & C4.
The resulting DC signal across C4 is
fed to op amp IC2 which is connected as a Schmitt trigger. The Schmitt
trigger’s switching thresholds are set
by resistors R4 & R8 and so if the DC
voltage at pin 2 is a few volts or more,
the output at pin 6 will switch low,
Front (above) and rear (right) views of the Line Dancer. Only the rear wheels are driven, their drive proportional to the
amount of light reflected from the underneath surface. If one photodiode detects more light than its partner it says “Hey!
I'm going off course” and applies more power to its motor, bringing the Line Dancer back onto the black line.
MAY 1999 17
pulling low pins 6, 9, 12 & 13 of IC4,
the NAND gate package. This disables
gates IC4b & IC4c, stopping the drive
to both motors. It also drives IC4d
which is connected as an inverter and
this pulls pin 13 of IC1 high, stopping
it from operating.
LED scanner
IC1 is a 4017 decade counter wired
as a 6‑LED scanner. Its clock signal is
provided by IC4a, the remaining 2‑
input NAND gate, which is wired as
a Schmitt trigger oscillator running
at about 10Hz. It clocks IC1 which
counts up to 10 in the normal way,
with each of its 10 outputs going high
in succession.
LED1 and LED6 are wired directly
to the “0” and “5” outputs respectively but LEDs 5, 4, 3 & 2 are each wired
via a pair of diodes to two respective
outputs of IC1.
This results in the LED array flash-
ing back and forth to give the “scanning” effect as IC1 counts from 0 to 9.
Three diodes in the circuit remain
to be mentioned. D12 and D13 serve
to decrease voltage to the motors
because they are nominally rated at
4.5V, while diode D9 is connected in
series with the positive supply lead
from the 6V battery pack. It provides
protection against a wrongly wired
battery.
Two flashing LEDs complete the
Fig.1: the motor drive system for this robot is simple. Provided photodiode D14 picks up reflected light from LED7, Q2
drives the right motor. The same applies to photodiode D15 and LED8 which control Q4 and the left motor.
18 Silicon Chip
picture and they are connected directly across the +5.4V rail.
Construction
This is a real hands‑on project and
you will need to make a lot of the
parts yourself. For this reason, we
have included quite a few diagrams
and photographs showing how the
Line Dancer is put together.
Let’s begin with the PC board
assembly. The component overlay
for the PC board is shown in Fig.2.
Check the board carefully for broken
or shorted tracks and undrilled holes
before you start inserting components.
Mount the wire links, resistors and
diodes first, followed by the capacitors and transistors.
Next, mount the ICs, remembering
the CMOS items (IC1,IC3) are static
sensitive. Their positive and negative
pins should be soldered first, followed
by the others.
Watch the orientation of the scanner
LEDs. They are not all oriented the
same way. LEDs 7 & 8 and photo-diodes D14 & D15 are mounted on the
underside of the PC board with the
tip of each LED/photodiode pair being
32mm from the underside of the PC
board, as shown in cross‑sectional
diagram, Fig.3.
Now they are not likely to be supplied with sufficiently long
leads to achieve this so you will
need to extend them. You can
do this for each LED and photodiode by connecting each lead
via a 10Ω or similar low value
resistor and this can be seen
in the photos of the prototype.
LED9 and LED10 are used
to illuminate the top Perspex
sheet in the robot assembly and
should be installed later, along
with the ultrasonic receiver and
transmitter transducers.
100mm lengths of miniature
hookup should be soldered to
the PC board for the ultrasonic
transducers, LEDs, motors and
battery supply.
Look, mum, a
wheelie! Maybe the
Line Dancer hasn't
quite got enough
power to stand
on end – but if it
could, this is what
you would see.
What you don't see
in this pic are the
sleeves shielding
the two
photodiodes – these
have been removed
for clarity.
+5.4V at pin 16 of IC1, pin 7 of IC2,
pins 4 & 8 of IC3, pin 14 of IC4 and
at the emitters of Q2 and Q4.
If you have an oscilloscope or frequency meter, connect it to pin 3 of
IC3 and adjust trimpot VR1 to obtain
a frequency of 40kHz.
If these test instruments are not
available, the circuit is adjusted for
best operation by “feel”; ie, adjust
trimpot VR1 so that the LED scanner
stops when your hand is brought
within about 50 or 60mm from the
ultrasonic transducers. Trimpots VR2
& VR3 should be adjusted to have a
resistance of about 45kΩ.
Motor gearbox assembly
The two motor and gearbox assemblies can be purchased ready‑
assembled from any Jaycar Electronics store (Cat. YG‑2725). These are a
relatively cheap variety of gearbox
but any other hobby motor/gearbox
which runs on 3-4.5V will suffice.
An appropriate speed reduction ratio
should be selected.
The Jaycar gearboxes have long
Initial checks
With the board complete,
connect the ultrasonic transducers and angle them as
shown in the photos.
Connect a 6V battery pack
or DC supply and check the
voltages around the circuit.
You should be able to measure
Fig.2: the component overlay for the PC board. Note that LEDs7 & 8 and photodiodes
D14 & D15 are connected to the board via 10Ω resistors in each leg. (See text).
MAY 1999 19
These two photos, from front and back, show Line Dancer
with the battery pack and acrylic plate "1" removed (left)
and the acrylic plate "2" removed (above). These will assist
both PC board assembly and final construction.
shafts on both sides and these need to
be cut to the required length. This is
done by clamping the shafts in a vice.
For each gearbox, one side is cut to
within 2mm of the gearbox, the other
cut to protrude 15mm.
The two gearboxes must not be cut
identically but instead as a mirror
image of each other; ie, the lefthand
gearbox should have its 15mm shaft
on the lefthand side and the righthand
gearbox should have its 15mm shaft
on the righthand side.
The wheels need to be cannibalised
from a cheap toy such as a “World‑4‑
Kids” Cat. 373845 which has the same
wheel shaft diameter as the gearbox.
Removing the wheels takes considerable force and they can then be glued
to the gearbox shafts with Araldite.
To ensure that the shafts don’t slip
within the wheels, they should have
grooves cut in them. Ensure that both
wheels are equidistant from their
respective gearbox and leave them
aside to set.
You can’t!
Plainly, the only approach is to
build your own. In the prototype, this
was made from two sliding door roller
wheels, 20mm in diameter, available
at hardware stores.
Both are ball bearing type, one of
which comes complete with a thread-
ed shaft on one side with matching
nut. The other simply has a through
hole for a shaft.
A wheel bracket can be made using
sheet aluminium or a strip of brass
(see Fig.4). The bracket was then
attached to the first roller wheel and
secured with the nut. The second
roller wheel forms the actual front
wheel and was secured to the bracket
using a bolt, nut and some washers.
The bracket is fixed to the swivel
Front wheel castor
A castor has to be made to serve
as the robot’s front wheel. For those
who don’t know what a castor is, it
is a wheel which swivels on its base,
typically used under bed ensembles,
mobile cabinets and other furniture.
The only problem is finding one
small enough to suit the Line Dancer.
20 Silicon Chip
Fig.3 : this diagram shows how the Line Dancer is a stacked assembly of three
Acrylic or Perspex pieces which carry the motor/gearboxes, PC board, battery
pack and so on.
Here is the Line Dancer fully “opened up”, showing how the motors and
ultrasonic transducers are attached to plate “3”. The holes in the plate
are for the sensor photodiodes and LEDs to poke through. Note (above) the
small tube shields slipped over the photodiodes (removed in right photo).
bearing slightly off‑centre with a nut
and screw through the hole in the
bracket. The drawing of Fig.4 is only
meant as an example and you may
construct your castor in any manner
which is suitable.
Remember however, that if the
wheel is not completely free to swivel,
then operation may impaired.
The dimensions of the three plates
(pieces of Perspex or Acrylic) for the
Line Dancer assembly are shown in
Fig.5. They should be roughly cut
out with a bandsaw or coping saw.
The pieces can then be trimmed to
size with a bench disc sander. Holes
should be drilled where indicated.
Deviations in the locations of holes
will result in the parts not fitting
together during assembly. The two
elongated holes in Plate 1 are made
by drilling two adjacent holes, then
opening them out with a small file.
Six untapped metal spacers, three
15mm long and three 20mm, were cut
from hobby brass tubing using tube
cutters. If you can’t get this tubing,
you can always stack groups of 6mm
untapped spacers to get the desired
results, as these can be purchased
cheaply in quantities of 100. You
will need to use the spacers to stack
the three Perspex plates as shown in
Fig.3.
The gearbox/motor/wheel assemblies are glued to the largest of the
Perspex pieces (Plate 3) using contact
adhesive. The front wheel is similarly
attached, being extra careful not to get
glue into the rotating components.
The PC board is fixed to the secA piece of tubing 8mm long is fitted
ond Perspex sheet (Plate 2) using over each of the photodiodes, which
the 15mm spacers and 32mm screws are hanging down from the underside
and nuts. This is then attached to
of the PC board. The tubing helps to
the third Perspex sheet, threading limit the effect of extraneous light.
the photo-diodes and LEDs through The LEDs and photodiodes are then
the holes. Nuts on the underside are bent to the appropriate angle with
used to hold these pieces in place. respect to each other to optimise the
The nut which is to
go in between the two
motors will require a
steady hand and a pair
of tweezers.
The ultrasonic receiver and transmitter
are glued at the front of
Plate 3, on either side
of the LED scanner.
They are positioned
at an angle of approximately 80° to each other, as shown in Fig.6.
Glue LED19 & LED20
to Plate 1 in the elongated holes. The wires
from the PC board can
now be connected to
these, along with the
motors and ultrasonic
transducers.
A switch (S1) is
mounted on Plate 1
and power connections to the battery
holder are made via
this switch.
The battery holder
Fig.4: the front castor was made using small
is attached to Plate
wheels from a sliding door roller set, available
2 with double‑sided
from hardware stores.
tape.
MAY 1999 21
Fig.6: the ultrasonic transducers should be positioned at an
angle of 80° to ensure that the collision avoidance system
works.
reflection of light into the sensors. Remember the basic rule of
optics: Incident angle = Reflected angle.
To further shield the photodiodes from ambient light, you
need to fit a plastic skirt to the underside of the base plate
of Perspex. This can be fashioned from a couple of pieces of
80mm diameter PVC pipe and then glued to the Perspex piece.
Alternatively, you could use a 90mm PVC end cap, instead of
making the skirt and the bottom Perspex piece. Note that the
skirt should have about 5mm of clearance above the table top
or working surface.
Before operation, tidy up all your wiring. You will need to
mark out a large circular or roughly rectangular track using
plain black electrical insulating tape on a smooth, light surface,
preferably a white floor or large table.
The radius of curvature of the track should not be less than
30cm and rightangle turns are not negotiable.
Troubleshooting
Fig.5: use this diagram to cut and drill the three
Acrylic or Perspex pieces for the robot. In this
project, we have used the terms “Acrylic” and
“Perspex” as though they are interchangeable.
While different products, either can be used for
the Line Dancer (as could some other plastics).
22 Silicon Chip
All things being equal, the Line Dancer should function well.
However, under certain circumstances it may not behave as it
should. For example, if the Line Dancer is initially adjusted to
operate in a relatively poorly lit room and then operated in a
brightly lit room, it may well cut across the tracks and wander
off into oblivion. Trimpots VR2 or VR3 should then be adjusted
to compensate for the brighter lighting conditions.
If you attempt to use the Line Dancer in sunlight, it will
probably not work reliably. It’s really an indoor creature and
it misbehaves in intense lighting.
The use of modulated infrared LEDs and IR sensors, along the
lines of the Infrared Sentry project published in last month’s
Resistor Colour Codes
No. Value 4-Band Code (1%)
1 1.5MΩ brown green green brown
1 1MΩ brown black green brown
1 47kΩ yellow violet orange brown
1 33kΩ orange orange orange brown
6 10kΩ brown black orange brown
1 4.7kΩ yellow violet red brown
3 1kΩ brown black red brown
1 470Ω yellow violet brown brown
5 270Ω red violet brown brown
4 10Ω brown black black brown
Parts List
5-Band Code (1%)
brown green black yellow brown
brown black black yellow brown
yellow violet black red brown
orange orange black red brown
brown black black red brown
yellow violet black brown brown
brown black black brown brown
yellow violet black black brown
red violet black black brown
brown black black gold brown
REMOVE
THIS SECTOR OF PCB
1 Line Dancer PC board, code 11385991
1 SPDT miniature toggle switch
4 AA cells
1 4 AA‑cell holder
2 gearbox/motors, Jaycar YG‑2725 or equivalent
2 wheels from toy car to match gearboxes (World‑4‑Kids 373845)
1 miniature castor (see text and Fig.4)
3 20mm untapped spacers
3 15mm untapped spacers (see text)
6 3mm x 32mm screws
9 3mm nuts
1 piece light gauge aluminium or brass strip, 12mm x 50mm
1 clear Acrylic or Perspex sheet, 30 x 11cm
2 pieces plastic tubing, 10mm x 5mm ID
Semiconductors
1 4017 counter (IC1)
1 CA3130 op amp (IC2)
1 555 timer (IC3)
1 4093 quad 2‑input NAND Schmitt trigger (IC4)
3 BC548 NPN transistors (Q1,Q3,Q5)
2 BD140 PNP transistors (Q2,Q4)
10 1N4148, 1N914 diodes (D1‑8,D10,11)
3 1N4004 diodes (D9,D12,D13)
6 yellow high brightness LEDs (LED1‑6)
4 1000mCd red LEDs (LED7‑10)
2 green flashing LEDs (LED11,12)
2 IR photodiodes (D14,D15)(Jaycar ZD‑1950 or equiv)
1 ultrasonic transmitter/receiver pair
(Dick Smith Electronics L‑7055 or equivalent)
Resistors (0.25W, 1%)
1 1.5MΩ
1 1MΩ
1 47kΩ
1 4.7kΩ
3 1kΩ
1 470Ω
1 20kΩ trimpot (VR1)
2 50kΩ trimpots (VR2,VR3)
1 33kΩ
5 270Ω
6 10kΩ
4 10Ω
Capacitors
1 100µF PC electrolytic
1 4.7µF tantalum electrolytic
1 0.47µF MKT polyester or monolithic
1 0.1µF MKT polyester or monolithic
1 .001µF ceramic
Miscellaneous
Araldite adhesive, tinned copper wire, hookup wire, solder etc.
Fig.7: actual size artwork for the PC board.
issue, would have alleviated this problem but it would
have made this circuit a lot more complicated.
If the Line Dancer cuts across the track only at certain
places, check the amount of light from other sources
falling on those areas. Also check that the track curvature is not too sharp and check that both VR2 and
VR3 are appropriately set. The use of one and a half
tape track widths in some circumstances may help
with “track cutting”.
Check that the LEDs and photodiodes are within
7mm of the surface and that they are angled correctly.
This is crucial to the operation and minor deviations
will result in failure to follow the track.
Track cutting can further be limited by the use of
an additional diode in series with the negative lead to
the motors, ie; in series with diodes D12 & D13. This
reduces the motor voltage and speed, and the reduced
momentum means that there is less likelihood of the
Line Dancer running away from the black track.
If you have trouble finding a light coloured surface
on which to operate the Line Dancer, the use of white
insulating tape on either side of the black track will
SC
make it work.
MAY 1999 23
|