June
1998, Issue 95
Gotchya!
Alarming
the Alarm System
by
Steve Ciarcia & Jeff Bachiochi
Alarm-System Data Logger
Figure
2 is the schematic of the alarm-system data logger (ASDL).
The circuitry was added to Domino’s proto1 board, as
shown in Photo 2. The first task was mating the 12-V
level alarm signals with Domino’s TTL input levels.
|

(Click
here to enlarge)
|
Figure
2 The Prototype ASDL system is physically
assembled using a Domina development board with
an LCD and keypad attached. |
|

(Click
here to enlarge)
|
Photo
2The prototype ASDL system is physically assembled
using a Domino development board with an LCD and
keypad attached. |
There
are lots of ways to do this, but one cute way
is to use MC1489 RS-232 input level shifters. These
inexpensive inverters can withstand ± 30-V inputs while
interfacing directly with TTL on the output side. Six
keypad lines connect to the processor.
The
next detail is determining when a key is pressed. We
had two alternatives. We could create a falling-edge
key-press interrupt by NORing the three column inputs
together. Or, we could take advantage of the fact that
pressing any key caused the beeper to sound.
Ultimately,
Jeff chose to use the signal applied to the beeper as
a key-press interrupt. The three column lines, two phase
outputs, and on/off button are read anytime there’s
an interrupt. Together, they determine the physical
key combination.
Normal
entry and exit profiles run a total of 10 key presses
a day. This plus a 7-byte time and date stamp amounts
to fewer than 20 bytes of data-logging space required
per day.
Our
plan isn’t to check this thing daily but to have a record
of events available when we need it. If we have a good
chunk of data storage space available, how often we
dump the records will never really be an issue. Six
months of data fits easily in less than 5 KB of memory.
We have about 24 KB available.
Program
development started with writing the time and date to
the LCD. Instead of using a couple I2C peripheral chips
to connect the 4 ´ 20 LCD and 4 ´ 6 keypad as typically
described for Domino, Jeff chose to minimize external
hardware and scan the command keypad in software.
Using
this number of I/O bits for the keypad necessitated
using the LCD in 4-bit mode rather than the typical
8-bit parallel interface. The 4-bit mode requires two
nibble writes to the LCD for each printed character,
which entails eight physical operations for each character—set
up the control register, raise the strobe line, set
up the data register, drop the strobe line. The process
repeats for the second data nibble.
The
program executes a short initialization routine and
then prints day of the week (DOW), month/day/year, and
hour/minute/second on the LCD. Using the row and column
positioning capability of the LCD (a control register
routine), only new data needs to be updated. This makes
a great idle screen that also indicates the system is
running.
If
the displayed time and date is incorrect, as it would
be on initial powerup, the user enters the present DOW,
month, day, year, hour, minute, and second. Maintaining
the time during a power outage is a simple matter of
adding a 4.5-V back-up battery to the real-time clock.
Since
the alarm system is normally battery-backed and may
be needed during a power outage, we decided to battery-back
the whole Domino2 circuit. Besides keeping the RTC alive,
it maintains any collected data that hasn’t been printed
yet. Figure 3 gives an overall view of how the complete
system was integrated.
|

(Click
here to enlarge)
|
Figure
3 The ASDL attaches in parallel with the existing
alarm keypad. The Domino2 based monitor registers
and records keypad activity and outputs the data
to an LCD and printer on command. |