Experiment 33: Moving in Steps
292 Chapter 5
the chip functions as an inverter, so that when the input goes high, the output
goes low and sinks current. This is of course just what we need for our stepper
motor that has a common positive connection.
The ULN2001A is only an amplification device, so you have to precede it with
a counter that runs from 1 to 4 and then repeats. You can stick with your 555
timers, as you’ve already assembled them, or substitute almost any CMOS oc-
tal or decade counter that sends its output pulses to a series of pins. Just use
the output from the fifth pin as the “carry” output to restart the counting se-
quence. I suggest a CMOS counter simply because it will run on 12 volts, so
you can use the same power supply that suits your stepper motors.
If you switch to CMOS counters, you will still need a pair of 555 timers send-
ing pulses to the counters. The timers will be free-running in astable mode,
and your photoresistors will control their speed. Figure 5-120 shows the
configuration.
One last item: you’ll need a 12-volt battery. You can of course put eight AA cells
together, but I think you should consider a rechargeable pack from a source
such as http://www.all-battery.com, which has a section entirely devoted to “ro-
bot batteries.”
If you put it all together, you should find that when you place your robot cart in
a very dimly lit room, it will turn toward the beam from a bright, well-focused
flashlight. To get reliable results, you may have to recess each of the photo-
resistors in little tubes, so that they receive much more light when they face
your flashlight than when they face away from it. Figure 5-121 is a 3D render-
ing of the concept.
Another idea is to rewire your cart so that it actually runs away from the light.
Can you imagine how this might be done?
Just one more thought: if you use infrared photoresistors, you can control your
cart with beams from infrared LEDs, in normal room lighting. If you and a cou-
ple of friends all have infrared transmitters, you can get your cart to run from
one of you to the next, like an obedient dog.
This takes us about as far as I’m going to go into robotics. I urge you to check
out the sites online if you want to pursue the topic further. You can also buy a
wide variety of robot kits, although of course I feel that it’s more fun to invent
or develop things for yourself.
All that’s left now is to perform one last introduction: to a device that should
make your life much easier, even though the device is much more complicated
than anything we have dealt with so far.
Photo-
Resistors
Stepper
Motors
555 Timer
Counter
Amplifier
555 Timer
Counter
Amplifier
Figure 5-120. A more efficient way to drive
the motors is to use just one timer to set
the speed of each, with a counter and
amplifier (such as a Darlington array chip)
sending the pulses down the wires. The
principle is still the same, though.
Figure 5-121. This 3D rendering shows a
possible configuration of the light-seeking
cart, with two photoresistors enclosed in
small tubes to restrict their response to
light.