Datasheet
Chapter 6 • Light-Sensitive Navigation with Phototransistors
180 • Robotics with the BOE Shield-Bot
Disconnect the battery pack and programming cable from your Arduino, and set
the BOE Shield’s switch to 0.
Remove the whisker circuits, but leave the piezospeaker circuit in place.
Build the circuit shown, using the 2 kΩ resistor.
Double-check to make sure you connect the phototransistor’s emitter lead (by
the flat spot) to the resistor, and its collector to 5V.
Also double-check that the phototransistor’s leads are not touching each other.
Example Sketch: PhototransistorVoltage
The PhototransistorVoltage sketch makes the Serial Monitor display the voltage measured at
A3—one of the Arduino’s five analog input channels that are accessible through the BOE
Shield. In the circuit you just built, a wire connects A3 to the row where the
phototransistor’s emitter and resistor meet. The voltage at this part of the circuit will
change as the light level sensed by the phototransistor changes. The Serial Monitor screen
capture below shows some example voltage measurements.
Flat Spot,
Shorter Pin