up, not a discrete part on the 3pi circuit board.
A more complicated use for the digital inputs is in the reflectance sensors. Here is the circuit for the
3pi’s leftmost reflectance sensor, which is connected to pin PC0:
The sensing element of the reflectance sensor is the phototransistor shown in the left half of U4, which
is connected in series with capacitor C21. A separate connection leads through resistor R12 to pin
PC0. This circuit takes advantage of the fact the digital inputs of the AVR can be reconfigured as
digital outputs on the fly. A digital output presents a voltage of 5 V or 0 V, depending on whether it
is set to a 1 or a 0 by your program. The way it works is that the pin is set to an output and driven
high (5 V) to charge the output node. The pin is then set to an input, and the voltage falls as current
flows through the phototransistor. Here is an oscilloscope trace showing the voltage on the capacitor
(yellow) dropping as current flows through the phototransistor, and the resulting digital input value of
pin PC0 (blue):
The rate of current flow through the phototransistor depends on the light level, so that when the robot
is over a bright white surface, the value returns to 0 much more quickly than when it is over a black
surface. The trace shown above was taken when the sensor was on the edge between a black surface
and a white one – this is what it looks like on pure white:
Pololu 3pi Robot User’s Guide
© 2001–2019 Pololu Corporation
5. How Your 3pi Works
Page 21 of 85
Содержание 0J5840
Страница 24: ...Pololu 3pi Robot User s Guide 2001 2019 Pololu Corporation 5 How Your 3pi Works Page 24 of 85...
Страница 67: ...Source code Pololu 3pi Robot User s Guide 2001 2019 Pololu Corporation 10 Expansion Information Page 67 of 85...
Страница 77: ...Source code Pololu 3pi Robot User s Guide 2001 2019 Pololu Corporation 10 Expansion Information Page 77 of 85...