pressed, we will jump to a subroutine or function to handle
the opening or closing of the door. In Figure 4, you can
see a close-up of the control board and how the LED, servo,
switches, and sensors are connected to it.
The servo and phototransistors are connected to the
servo headers. The pushbuttons and LEDs are connected to
the breadboard via solid wire. In Figure 4, the 10K resistors
at the top left are the pull-ups for the phototransistors,
while the 10K resistors just to the right are the pull-ups for
the active-low pushbuttons. The 220 ohm resistor is used to
limit current to the bi-color LED and the two 1K resistors on
the bottom right are used to limit current to the IR LEDs
used in the limit switches. See the schematic for more
details.
The pushbuttons are pretty straightforward. They’re
configured as active-low, which means that normally the
I/O pin reads high, and when you push the button it goes
low. This is the more common configuration. The optical
limit switches are essentially two beam-break detectors
consisting of an IR LED and a phototransistor. A 10K
resistor normally pulls the collector of the phototransistor
high. However, the IR LED saturates the phototransistor
44 SERVO 09.2016
Schematic diagram.
Figure 3. Door project demo unit.
Notes
All connections are to Board of Education (#28850)
BOE powered by Li-Ion pack (#28989)
Servo voltage jumper in either position