Page 61 - The Unofficial Guide to Lego Mindstorms Robots
P. 61
50
Where's That Red Light Coming From, Anyhow?
Isn't it odd that the light sensor, an input device, has a red light on it? How did that happen?
And how is that possible with only two wires connecting the sensor to the RCX?
The basic role of the RCX's inputs is to measure the value of the sensor. For certain types of
sensors, like the light sensor, the RCX also provides power to the sensor. It does this by
very quickly alternating between providing power and taking a measurement. The RCX sends
power to the light sensor for about 3 ms (thousandths of a second) and takes a measurement
for about .1 ms. It repeats this cycle over and over. (These timings only apply to the standard
firmware. In an alternate firmware such as legOS, the timings are entirely different.) Inside the
light sensor, an electronic circuit smooths out the pulses and provides steady power to the red light.
Idler Wheels
Trusty's two main drive wheels determine whether he moves forward, backward, or turns. But without at least one more wheel,
Trusty can't balance and will tip forward or backward. Trusty's third wheel is a good example of an idler wheel. An idler wheel
provides support for the robot but doesn't constrain its motion. It does this by rotating freely on a vertical axis. The front
w heels on shopping carts are idler wheels, as are the casters under furniture. Ideally, an idler wheel can easily swivel in
resp onse to changes in the robot's direction. You've already seen Trust y's idler wheel in Figure 2-8.
Make your idler wheels sturdy! One of Trusty's early designs co uld follow a line just fine. But after about a minute of back-
and-forth turning, the idler wheel broke off the bottom, and Trusty was left lyin g on his back, twitching.
U sing Two Light Sensors
You can buy more light sensors for about $20US each (see the ''Online Resources" section at the end of this chapter). By
adding one more light sensor to Trusty, we can simplify his program and make his movement along the black line smoother.
Adding the Sensor
To add the second light sensor to Trusty, just move over th e one that's already there. You can leave the original one attached to
in put 2 and just add the second one to input 3. Figure 3-6 sh ows how to do this.