Datasheet

Chapter 6 Light-Sensitive Navigation with Phototransistors
196Robotics with the BOE Shield-Bot
Optional Advanced Topic: Voltage Decay Graphs
The next graph shows the BOE Shield-Bot’s left and right QT circuit voltage responses while
the BothLightSensors sketch is running. The device that measures and graphs these voltage
responses over time is called an oscilloscope.
The two lines that graph the two voltage signals are called traces. The voltage scale for the
upper trace is along the left, and the voltage scale for the lower trace is along the right. The
time scale for both traces is along the bottom. Labels above each trace show when each
command in BothLightSensors executes, so that you can see how the voltage signals
respond.
The upper trace in the graph plots the capacitor’s voltage in the pin 8 QT circuit; that’s the
left light sensor. In response to
digitalWrite(8, HIGH), the voltage quickly rises from 0
V to almost 5 V at about the 1 ms mark. The signal stays at around 5 V for the duration of
delay(1). Then, at the 2 ms mark, the rcTime call causes the decay to start.
The
rcTime function measures the time it takes the voltage to decay to about 2.1 V and
stores it in the
tLeft variable. In the plot, it looks like that decay took about 1 ms, so
the
tLeft variable should store a value close to 1000.
The lower trace in the graph plots the pin 6 QT circuit’s capacitor voltagethe right light
sensor. This measurement starts after the left sensor measurement is done. The voltage
varies in a manner similar to the upper trace, except the decay time takes about 2 ms. We
would expect to see
tRight store a value in the 2000 neighborhood. This larger value
corresponds to a slower decay, which in turn corresponds to a lower light level.
tRight
≈ 5 V
2.1 V
≈ 5 V
2.1 V
0 V
digitalWrite(8, HIGH)
tLeft = rcTime(8)
delay(1)
tRight = rcTime(6)
digitalWrite(6, HIGH)
0 V
delay(1)
tLeft