Robot Building for Beginners, Third Edition

(Marvins-Underground-K-12) #1
CHAPTER 26 ■ SMOOTHER, SMALLER, CHEAPER

Despite being transistors, most phototransistors are not externally connected to the base pin. Instead,
a light-sensitive region provides an internal signal to the base pin. As such, the transistor permits a varying
amount of current to flow depending on the amount of light it is seeing. A close-up photo (Figure 26-9)
shows that the lower-left pin (what would be the base pin) is not connected. That is, if you follow the paths
from each of the three external pads, you’ll notice the lower-left pin does not connect to the center of the
chip. Therefore, you can think of this light sensor as a simple two-pin device.


Figure 26-9. Close-up of a 1206 package phototransistor, approximately 4 mm long × 2 mm wide × 1 mm high


This small part was nearly impossible to solder with a soldering iron. The package is intended to be
attached using soldering paste on the pads underneath. I had to pre-tin the PCB pads (heat a little coating of
solder), gently place the part, and then reheat the end of the PCB pads to get the solder to attach.


Increasing Functionality


The modern Sandwich robot is controlled by a programmable microcontroller, rather than a fixed general-
purpose chip. A developer writes software to control the operations of pins and then downloads the program
to storage on the chip. This allows the robot to be capable of much more complex functionality. For example,
it can self-calibrate, choose a line-following mode, smoothly navigate, and power off when idle to save
battery life.


Calibrating Good Times


This smart Sandwich robot is programmed such that if you hold down a button at power-up, it causes
the robot to enter calibration mode. Next, place the robot over a black surface and press the button; then
repeat this over a white surface. The robot’s microcontroller reads all the sensors and records their values in
internal storage.
Knowing the voltage range of each individual sensor allows the robot to mathematically compensate
during line following. Even if the robot still used photoresistors, the ability to calibrate eliminates the need
for a human to test and sort sensors prior to soldering. Furthermore, this can correct for changes in sensor
quality as they age and can detect damaged (or accidentally covered) sensors that no longer change value
significantly in response to changes in lighting.

Free download pdf