the calibration pushbutton. If the button is pressed, the
calibration method is entered. Here, the duration of the
button press is captured, and again a series of
comparisons is carried out:
• If the button press is less than one second or more
than 20 seconds, the calibration method is exited
and control returns to the main program.
• If the button press is between one and five seconds,
the distance reading is stored in nearmark and in
EEPROM, and the calibration routine is exited.
• If the button press is between five and 20 seconds,
the distance is stored in farmark and in EEPROM,
and the routine is exited.
In practice, the actual calibration procedure is pretty
straightforward:
First step: Drive your car slowly into the garage and
stop where you consider the beginning of the comfort
zone to be. Then, press the calibration pushbutton for
more than five but less than 20 seconds. This saves the
location in EEPROM and in the farmark program variable.
Second step: Pull the car forward to where you want
the end of the comfort zone to be. Now, press the
calibration pushbutton for at least one second, but not
more than five seconds. This records the nearmark
location.
That’s all there is to it!
Hardware
For an enclosure, I went with the neat clear plastic
multiboard project box offered by Parallax that is designed
to fit the Propeller USB project board. There is plenty of
room on the board to accommodate the small number of
components required. Figure 4 is a picture of the board
populated with all components.
I needed to bring two external cables into the box
from the remotely-located optical sensor and the three-wire cable to the pinger. There are several knockout
sections of various sizes convenient for feeding cables into
the box. I had to cut a hole in a side panel to mount a DC
power coax jack, and another hole to give me access to
the USB port on the project board (in case I wanted to
modify the firmware after assembling everything).
I mounted the two LED lamps on the front panel of
the enclosure where they fit very nicely, as shown in
Figure 5. The final configuration of the complete garage
sentinel system as set up in my garage is shown on the
first page of the article
In that photo, you can also see that I put the pinger in
a small separate box at the end of a short cable since I
had to put it low enough to “see” the front of the car. Of
course, the box with the LED lamps had to be high
enough for the driver to see it.
To power this project, I used a wall wart type of
external power supply, capable of supplying about 200
mA at nine volts DC. One word of caution which applies
to any home-built project using this type of power supply:
Be sure to check the open circuit voltage (i.e., the
unloaded output voltage) at least once before
connecting your wall wart to the device you are
building.
Some of these supplies can put out nearly twice their
rated voltage without a load, and if you turn on the supply
before connecting it to your project, the brief over-voltage
before it settles down could be extremely bad news to
your system.
38 August 2015
ITEM DESCRIPTION VALUE MODEL
R1 1/4 watt resistor 2.2K ohms
R2 1/4 watt resistor 12K ohms
R3 1/4 watt resistor 220K ohms
R4 1/4 watt resistor 10K ohms
R5, R6 1/4 watt resistor 390 ohms
R7 1/4 watt resistor 1.8K ohms
R8 1/4 watt resistor 47K ohms
D1 Schottky diode 1N5818
D2 Silicon diode 1N4148
Q1, Q3, Q4 NPN transistor 2N4401
Q2 P-channel MOSFET IRF9520
S1 NO pushbutton switch
P1, P2, P3, P4 Male pin header 2 pins
P5 Male pin header 4 pins
Red high-intensity LED
Amber high-intensity LED
Propeller USB project board Parallax P/N 32810
Ultrasonic range sensor Parallax P/N 28015
Cadmium sulfide photoresistive optical sensor Parallax P/N 350-00009
Multiboard enclosure, clear plastic Parallax P/N 721-32212
Power supply (wall wart) 9-16 VDC 100 mA
or greater
PARTS
LIST