CHAPTER 26 ■ SMOOTHER, SMALLER, CHEAPER
Automatically Detecting Line Type
The original Sandwich includes a physical toggle switch to follow either light lines or dark lines. But, the
smart Sandwich simply looks at whether the center sensors are brighter or darker than the outer sensors at
the start of a course. A lighter center indicates the robot should follow a light line.
Driving Smoothly
Similar to the circuit revisions described at the beginning of this chapter, the smart Sandwich can power
both motors when the total sensor voltages on both sides are near enough to each other to assume the line is
centered beneath the robot. In fact, if the robot sees that each individual sensor has approximately the same
voltage, then the line is not beneath any of the sensors, and the motors should be powered off because the
robot is no longer on the course.
Saving Power
Instead of a bulky, expensive power switch, a tiny pushbutton toggles the smart Sandwich between sleeping
and waking states. Because the microcontroller controls the rest of the robot circuitry, it can turn off everything
to save power. The sleeping microcontroller itself uses only a few microamps of power. Although the robot isn’t
fully turned off like it would be through a physical switch, it can sleep for years without draining the battery.
When awake, the microcontroller supplies power to the side LEDs and motors as needed. More
importantly, the microcontroller supplies power to the line-following white LEDs and sensors via a
transistor (Q9), similar to how it powers the motors.
Because the brains control the power, this robot can go to sleep automatically when idle to save battery life.
Shrinking Costs
So, how much would you pay for this increase in functionality and decrease in size? If you are like most
consumers, you’d say “less!”
The lithium polymer battery is about the same cost as a rechargeable 9V battery. The added capacitors,
resistors, and transistor are offset by the decrease in cost of the surface-mount parts. So, for the sake of
clarity, Table 26-1 focuses on the most significant cost differences.
Table 26-1. Major Cost Differences Between Original Sandwich and Modern Sandwich
Description Original Price Modern Price Savings
Motors (pair) $35.90 $6.90 $29.00
Printed circuit board $12.00 $5.00 $7.00
Multiturn potentiometers (pair) $3.02 $0.00 $3.02
Light/dark line switch $2.19 $0.20 $1.99
Power switch $1.95 $0.20 $1.75
Brain chip $0.25 $1.01 -$0.76
Photosensors (four) $0.60 $3.32 -$2.72
The total savings is $39.28. Wow!