ELM ELM334_08

ELM334
Garage Doorman
Description
Features
The ELM334 is an integrated circuit for remotely
monitoring the position of electrical contacts (on a
garage door, for example) and reporting the position
by way of coloured LEDs. A two-wire interface is all
that is needed to convey the position of the door to
two remotely located LEDs, and to also provide
pushbutton control for an electric opener if desired.
This circuit is able to monitor the state of one or
two position sensing switches, provide debouncing
of the signals, and to generate an alternating
(flashing) output when the position changes. In
addition, there is a separate pushbutton input that
may be used to control an electric garage door
opener, or possibly trigger an alarm.
Several examples of how the ELM334 might be
used are provided in the Example Applications
section.
•
•
•
•
•
•
•
Low power CMOS design
Wide supply range - 3.0 to 5.5 volt operation
Simultaneous monitoring of three inputs
Fully debounced inputs
Two wire interface to LEDs
Stuck button protection on the control output
Pulsed control output
Connection Diagram
PDIP and SOIC
(top view)
Applications
• Garage door monitoring and control
• Remote signalling and acknowledgement
• Remote alarm circuits
VDD
1
8
VSS
RLED
2
7
OpenSw
GLED
3
6
ClosedSw
PB
4
5
Control
Block Diagram
VDD
RLED
Debounce
Timers
2
Drive
Logic
GLED
OpenSw
6
ClosedSw
5
Control
VDD
Debounce
Timers
3
7
VDD
PB
ELM334DSC
4
Debounce
Timers
Pulse
Generator
Elm Electronics – Circuits for the Hobbyist
< http://www.elmelectronics.com/ >
1 of 7
ELM334
Pin Descriptions
VDD (pin 1)
This pin is the positive supply pin, and should always
be the most positive point in the circuit. Internal
circuitry connected to this pin is used to provide
power-on reset of the microprocessor, so an external
reset signal is not required. Refer to the Electrical
Characteristics section for further information.
RLED (pin 2), and GLED (pin 3)
These two outputs are for driving LEDs (through a
suitable current limiting resistance). Logic ensures
that only one output is active at a time, allowing the
two outputs to drive a single dual type LED (that is
red if energized in one polarity, and green if the
polarity is reversed). During powerup, the red LED
will be lit for 0.5 sec, followed by the green for
0.5 sec, as a LED test.
PB (pin 4)
A momentary low level on this pin will be debounced,
and then used to initiate a 0.5 second output pulse
on pin 5. If unused, it is preferrable to connect this
pin to V DD (but it may be left open-circuited, as there
is an internal pullup resistor).
Control (pin 5)
An active high level pulse will appear at this pin, in
response to a low level on pin 4. Only a single
0.5 sec pulse will be output, regardless of the length
of time that the pin 4 input remains low (as long as it
is greater than the 26 msec debounce time). The
state of the RLED and the GLED lines is not updated
if the pushbutton is being pressed.
ClosedSw (pin 6), and OpenSw (pin 7)
These two inputs are for monitoring the position of
the door (or other contacts). Since these switches
might be attached to some very simple switch
mechanisms, a long 0.5 sec debounce timer (pickup
and dropout) is used on each input. This allows the
LED outputs to possibly be used with logic circuits,
as well as driving LEDs.
The OpenSw input is not required for circuit
operation. If this input is not used, the LEDs will still
flash alternately when the door is opened, but after
30 seconds, the flashing will stop and the red LED
will light solidly. Please refer to the Circuit Operation
section for more details.
If either pin 6 or pin 7 are not used, it is preferrable to
connect them to VDD (but they may be may be left
open-circuited, as they both have internal pullup
resistors).
VSS (pin 8)
Circuit common is connected to this pin. This is the
most negative point in the circuit.
Ordering Information
These integrated circuits are available in either the 300 mil plastic DIP format, or in the 208 mil SOIC surface
mount type of package. To order, add the appropriate suffix to the part number:
300 mil Plastic DIP............................... ELM334P
208 mil SOIC..................................... ELM334SM
All rights reserved. Copyright ©1999, 2008 Elm Electronics.
Every effort is made to verify the accuracy of information provided in this document, but no representation or warranty can be
given and no liability assumed by Elm Electronics with respect to the accuracy and/or use of any products or information
described in this document. Elm Electronics will not be responsible for any patent infringements arising from the use of these
products or information, and does not authorize or warrant the use of any Elm Electronics product in life support devices and/or
systems. Elm Electronics reserves the right to make changes to the device(s) described in this document in order to improve
reliability, function, or design.
ELM334DSC
Elm Electronics – Circuits for the Hobbyist
< http://www.elmelectronics.com/ >
2 of 7
ELM334
Absolute Maximum Ratings
Storage Temperature....................... -65°C to +150°C
Ambient Temperature with
Power Applied....................................-40°C to +85°C
Voltage on VDD with respect to VSS............ 0 to +7.5V
Note:
Stresses beyond those listed here will likely damage
the device. These values are given as a design
guideline only. The ability to operate to these levels
is neither inferred nor recommended.
Voltage on any other pin with
respect to VSS........................... -0.6V to (VDD + 0.6V)
Electrical Characteristics
All values are for operation at 25°C and a 5V supply, unless otherwise noted. For further information, refer to note 1 below.
Characteristic
Minimum
Typical
Supply Voltage, VDD
3.0
5.0
VDD rate of rise
0.05
Maximum Units
5.5
V
V/ms
VDD = 5V, see note 3
1.0
Pushbutton
Debounce Period
Position Switches
26
512
msec
msec
pickup or dropout times
Control Output Pulse Width
512
msec
see note 4
Internal Pullup Resistance
400
KΩ
pin 4
20
KΩ
pin 6 or 7
0.5
4.5
mA
see note 2
Average Supply Current, IDD
Typical Output Voltages
(pins 2, 3, or 5)
2.4
Conditions
V
Current (sink) = 15 mA
V
Current (source) = 7.0 mA
Notes:
1. This integrated circuit is produced with a Microchip Technology Inc.’s PIC12C5XX as the core embedded
microcontroller. For further device specifications, and possibly clarification of those given, please refer to the
appropriate Microchip documentation ( http://www.microchip.com/ ).
2. This spec must be met in order to ensure that a correct power on reset occurs. It is quite easily achieved
using most common types of supplies, but may be violated if one uses a slowly varying supply voltage, as
may be obtained through direct connection to solar cells, or some charge pump circuits.
3. Integrated circuit only. Does not include any LED or drive currents.
4. This is the pin 5 output pulse width, once triggered by an active input on pin 4. The duration of the pulse
does not change if the pushbutton is released before this time passes, or if is held for much longer times.
ELM334DSC
Elm Electronics – Circuits for the Hobbyist
< http://www.elmelectronics.com/ >
3 of 7
ELM334
Circuit Operation
The ELM334 can be thought of as two inverters
that have some additional logic connected. The inputs
to the inverters are located on pins 6 and 7, while the
outputs are connected to pins 2 and 3. If pin 7 is
connected to a low level, then pin 2 goes high. If pin 6
is connected to a low level, pin 3 will go high. There
are several additions, however, that make these a little
more than simple inverters.
To make this IC more useful, we have added
‘debounce’ circuits to the pin 6 and 7 inputs. These are
similar to digital integrators - the input must be at one
level for a set time before the output can change. This
may not be necessary for simple LEDs, but if you want
to interface to a computer circuit or other logic, you will
require a clean signal such as this provides. To ensure
that the circuit works reliably even with very poor
quality switches, a debounce period of 0.5 seconds is
used.
In addition to the debouncing, there is logic
connected to these pins, so that both LEDs are not on
at the same time, etc. (the door is either closed or
open, but not both). Figure 1 shows the outputs that
can be expected for all combinations of the two inputs.
Typically, a dual red/green LED will be connected
between the two output pins, and this is what is meant
by the last column. You may connect separate LEDs
between each output and circuit common, but there is
no advantage to this, as it requires an extra wire for
remote indicators. (It is easier and cheaper to wire
separate LEDs ‘back to back’ as shown in the
Example Applications section.)
One other feature of the internal logic is a ‘lamp
test’ that is performed at each power up - the LEDs are
each turned on for 0.5 seconds so that you can be
sure that they are both working (red first, followed by
green).
The ELM334 also has a special pushbutton circuit
connected between pins 4 and 5. When a low level
input appears on pin 4, a 0.5 second pulse will be
output on pin 5. This is typically used to drive a relay
which interfaces with the garage door control circuit,
but it can also be connected to logic of your choice.
Only one pulse will be generated for each pushbutton
press, no matter how long the button is held for. The
input also provides a debouncing circuit so that a
mechanical pushbutton can be used.
That covers the basics of how the ELM334 IC
operates. The next section (Example Applications)
shows a few examples of how it may be used…
Pin 6
ClosedSw
Pin 7
OpenSw
Pin 2
RLED
Pin 3
GLED
Dual (R/G)
LED glows
L
H
L
H
Green
H
L
H
L
Red
L
L
L
H
Green
H
H
Alternates between red and green
for 30 seconds, then shows red
Figure 1. ELM334 LED Logic
ELM334DSC
Elm Electronics – Circuits for the Hobbyist
< http://www.elmelectronics.com/ >
4 of 7
Example Applications
The following pages show a few circuits that may
help you get started with the ELM334. They show
everything from a minimal circuit to a typical full
implementation that you may wish to try. We
encourage experimentation, and hope that you enjoy
doing so.
The first circuit (Figure 2) shows the absolute
minimum required to use the ELM334 IC. A single
(normally closed) contact is connected between pin 6
and circuit common, while a single green LED is
connected between pins 2 and 3. We do not use a
current limiting resistor in series with the LED, as the
ELM334 has fairly high output resistance when
operated with a 3V supply, and will limit the LED
current. Two ‘AA’ batteries in series provide the 3V
source to operate the circuit.
Normally, the door closed switch is closed when
the door is, and opens when the door does (this could
3V
green
1
8
2
7
3
6
4
5
be a magnetic switch, or a mechanical contact). When
the door opens then, the contact does too, and the pin
6 input goes high. With the pin 7 input low, the green
LED will turn off (see Figure 1 for the pin logic). If we
had connected a dual red/green LED, the red LED
would turn on when the door opens.
Figure 2 would likely work well if experimenting on
the bench, but really requires more circuitry to make it
more reliable for ‘real world’ operation. Figure 3 shows
the recommended additions to make a more reliable
circuit. Note that we have now shown a ground symbol
to represent the circuit common (battery negative), just
to simplify the schematic. This new circuit shows a
capacitor across the IC supply terminals, to prevent
noise generated internally by the ELM334 from
affecting the supply voltage, and thus the complete
circuit. We’ve also added a few resistors on both the
input and the output sides of the IC, mostly to protect it
from the effects of induced voltages and currents
which can cause a phenomenon called ‘latch-up’ in
some CMOS circuits. If the door closed switch or the
LED is more than a few feet away from the ELM334,
these extra resistors should be added.
Functionally, the circuit in Figure 3 operates in
exactly the same manner as the one in Figure 2.
door
closed
Figure 2. Absolute Minimum ELM334 Circuit
+3V
3V
0.1µF
green
100Ω
1
8
2
7
3
6
4
5
100Ω
+3V
5.1KΩ
2.2KΩ
+3V
door
closed
Figure 3. A Better Minimal ELM334 Circuit
ELM334DSC
Elm Electronics – Circuits for the Hobbyist
< http://www.elmelectronics.com/ >
5 of 7
Example Applications (continued)
Figure 4 carries the circuit of Figure 3 a little
farther, creating an alarm type circuit. We have used a
dual red/green LED this time, and also connected the
green LED output to the pushbutton input. In this way,
a momentary opening of the door switch will create a
pushbutton input, when the green LED goes off. Once
the green LED is off, it will remain that way, even if the
door contact should close (as internally a pushbutton
input always forces the green LED off, and the red
LED on). Note that there will be a 0.5 second pulse at
the Control output (pin 5) when the door first opens this might be used to trigger an audible alarm.
This monitor circuit could be used for a door of any
type, not just a garage door. Perhaps a shed, or a
storage bin. A contact such as from a thermostat could
also be connected to warn that a temperature has
gone above or below a set limit. To reset this circuit
requires turning the power off then on.
The circuits so far have used a battery to supply
power. The problem with this is that a pair of AA cells
will only last a week or two in such an application. To
avoid always having to monitor the monitor, it would be
good to power the circuit from a different supply that is
derived from the main AC service. Figure 5 on the next
page shows a circuit that assumes you are able to
obtain 12V from a source (most likely an AC adapter).
This allows generating a 5V supply for the ELM334
while also providing a higher voltage that is suitable for
driving a relay (from the Control output).
Operation of the LED portion of Figure 5 is very
similar to the previous circuits, except that we have
now added a switch to indicate that the door is fully
open. The position sensing switches (possibly
magnetic reeds) are connected to the 5.1KΩ pullup
resistors in order to provide a full logic swing input to
the ELM334 as they operate. The 2.2KΩ series
resistors provide some protection for the chip as the
wires to the switches are likely to be lengthy, and
susceptible to induced voltages and currents. After
processing, the appropriate voltages appear at pins 2
and 3, driving the LEDs through the 150Ω current
limiting resistors. Since the supply is now 5V, we have
increased the LED resistors slightly in order to
maintain roughly the same current.
The control portion of the circuit may appear to be
a little odd-looking at first. To understand its operation,
note that one of the two driven LEDs is always on,
whether flashing or solid. Due to the connection of the
two NPN transistors then, one of the NPNs is always
biased on, keeping the PNP on, and pin 4 of the
ELM334 at 5V. When the remote pushbutton is
pressed, the LED circuit is shorted out, and neither
NPN can conduct. The PNP thus shuts off, and pin 4
of the IC drops to 0V, its active level. With the PB input
active, a pulse is output at pin 5, causing the relay to
pick up for 0.5 seconds.
Although this circuit was designed to monitor
doors, there are likely to be many other applications
that it can be adapted to. Monitoring thermostats, or
light levels, or water levels, for example.
+3V
3V
0.1µF
+3V
100Ω
1
8
2
7
3
6
4
5
green
red
5.1KΩ
2.2KΩ
100Ω
door
closed
Figure 4. A Remote Monitor with Memory
ELM334DSC
Elm Electronics – Circuits for the Hobbyist
< http://www.elmelectronics.com/ >
6 of 7
Example Applications (continued)
334
ELM334DSC
Elm Electronics – Circuits for the Hobbyist
< http://www.elmelectronics.com/ >
7 of 7