This is only a preview of the March 2022 issue of Practical Electronics. You can view 0 of the 72 pages in the full issue. Articles in this series:
|
When you really
DON’T want to be
interrupted . . .
I’m
busy.
Go
away!
OK, it’s a bit tongue-in-cheek . . . but it could have other, more serious,
uses. The Busy Loo Warning flashes a bright LED light on the door when you,
ahem, don’t want someone barging in. When you leave and open the door
the light goes out! It’s a simple idea with a real simple circuit – but it makes
a superb beginner’s project.
T
he idea for this little project
came about when avid reader
John Chappell was sitting, reading his latest copy... and the loo door
burst open, with obvious embarrasement all around.
So maybe he had taken a bit longer
than normal; maybe he was so engrossed in the magazine that he didn’t
hear anyone yelling out... but it started
him thinking how to avoid the delicate
situation in the future.
One problem was that the door lock,
umm, didn’t. So without replacing the
lock, how to let others know that the
best seat in the house was, umm, occupied – without the embarrasement!
Light bulb LED moment
Of course, that was the answer: a
bright, flashing LED that would let
others know not to barge in.
If it was made somewhat automatic
– ie, it turned off when the outhouse
door opened to let him out, so much
18
the better. And this really simple circuit is the outcome.
When the pushbutton (S1) is pressed,
both the LED mounted on the door and
the internal LED start flashing.
Why two LEDs? One is the ultrabright warning LED mounted on (or
through) the door to warn others that
it is occupied. The second (internal)
LED merely confirms that the circuit
is operating.
Overkill? Perhaps – but at the cost of
a 5p LED and a 2p resistor, it doesn’t
add much cost to the project.
When the loo door opens, a magnetic
reed switch resets the circuit and the
LEDs turn off. It really is that simple!
As we said earlier, it makes a great
beginner’s project. Parts are as cheap
as chips; it’s battery operated (and
the battery will last for yonks) and it
doesn’t use any of those pesky surface-
Original by John Chappell
mount devices that beginners have so
much difficulty soldering.
Total assembly time shouldn’t be
much more than an hour.
The circuit
It’s shown in Fig.1 – and as you can
see, there’s not much to it!
It’s based on a 4093B CMOS quad
2-input Schmitt trigger NAND gate
chip (IC1). Now if all those words
scare you, don’t worry: see the panel
‘What is a NAND gate?’ and all will
be revealed.
The four NAND gates are configured
in different ways. IC1a is an inverter:
when its inputs are low, the output is
high (and vice versa).
With the door closed, the magnet
pulls the ‘normally open’ reed switch
closed, which in turn means IC1a’s
inputs are both low – so the output
is high.
IC1b and IC1d form a latch with the
inputs to IC1d normally high. Think
Practical Electronics | March | 2022
What is a NAND gate?
You’re looking at the entire project! On the left is a reed switch and magnet
which turn the LED off when the door is opened. At right is the door-mounted
ultrabright LED, while the internal LED in this case is integrated with the
pushbutton ‘start’ switch
of a latch just like a door latch: it’s
normally at rest but needs someone
to actuate it.
In this case, when the push button
(‘Start’) switch is pressed, the latch
is reset by forcing pin 12 of IC1d low
which forces the output, pin 11, high.
This also enables IC1c, with its 47kΩ
resistor and 10µF capacitor, to start
oscillating, with its output going high
and low at a rate set set by the time it
takes the tantalum capacitor to charge
and discharge – in this case the rate is
about one second.
As it goes low, the two LEDs connected in series between its pin 10
output and +9V become forward biased and therefore light up.
You can change the flash rate by
changing the resistor and/or capacitor.
Increasing either (or both) will slow
the rate down and, as you would expect, decreasing will speed the rate up.
When the door opens, the reed switch
opens (when the magnet moves away),
IC1a inputs go positive because of the
100k resistor connected to 9V and the
circuit reverts to its dormant state.
Power
The whole circuit is powered by a
single 9V battery which, due to the
intermittent drain, should last for
almost as long as its shelf life. For
the same reason, no on/off switch is
provided or needed. (Of course, if you
decide to read War and Peace during
your ‘visits’ you might not get quite
that life).
The battery snap leads can connect
to a header set, or feed under the board
and up through the hole at bottom left
before soldering to their respective
pads from the board top. This gives
some strain relief to prevent the rather
thin leads breaking off.
A 1N4004 silicon diode is included
in series with the battery to prevent
damage if you try to connect the battery
back-to-front (surprisingly easy to do!)
l
Fig.1: the circuit consists
of one quad Schmitt NAND gate,
designed to flash an ultrabright
LED mounted on the door. It is
actuated by S1, the ‘Start’ switch
and automatically turned off
when the door is opened.
Practical Electronics | March | 2022
Inside the 4093B chip there are four
identical gates, each one operating
completely independently of the others
(but with a single power supply). That’s
why it’s called a ‘quad’.
First, we’ll look at an AND gate. Think
of a gate as you would a gate in a fence.
It can be either open or closed. With two
gates, BOTH have to be in the same state,
open or closed, to have any effect. With
an AND gate, if both inputs are high, the
output will be high. If either is low, the
output will be low. That’s why it’s called
an AND gate.
But the 4093 has extra circuitry in
each gate which ‘inverts’ the output.
So instead of both inputs going ‘high’
resulting in a ‘high’ at the output, both
inputs going high result in a ‘low’ at the
output (and vice versa). This makes it
a NAND gate, an abbreviation for NOT
AND. The little circle at the gate output
tells you that it is a NAND gate (an AND
gate won’t have the circle).
Before we leave the AND/NAND gate,
you’ll often see another type of simple
gate, the OR/NOR. With this gate, as
its name implies, either input – one
OR the other – can be high to bring the
output high.
But if it’s a NOR gate, as distinct from
an OR gate, the output will be inverted
(just like the difference between NAND
and AND gates).
Finally, where does the ‘Schmitt Trigger’
part come from?
In most gates, the transition between
the high and low states is fairly wide – it
needs to be below a certain voltage to
be low (close to 0V) and above a certain
voltage to be high (much closer to the
supply voltage). Voltages between the
low and high states are not defined.
However, this is often undesirable, so
circuitry is included inside the gate which
makes the low to high or high to low transition much more defined due to ‘hysteresis’.
This is called a ‘Schmitt trigger’.
l
A single 10µF capacitor bypasses
(or filters) the 9V supply. While a
tantalum capacitor is specified in the
parts list, you will probably note from
the photos that a standard 10µF 16V
19
Fig.2: the PCB component
overlay will help you
place the components in
the right positions. Watch
the polarity of IC1, the
diode and LED and both
of the capacitors. This
PCB is different from
the photo at right in that
it has ‘extensions’ on it
to allow it to snap into
place in the Jiffy box.
These can be cut off if
not needed.
The PCB photo is
reproduced larger than
life size. It is of an early
prototype and there
are some differences
between the overlay
and this board – for
example, S1 and LED1
are both housed in the
same bezel (you can use
this type or a separate
LED and switch). Also
in this case, the battery
connector is ‘hard
wired’ to pads on the
board and using the
hole at lower left for
strain relief.
electrolytic was used. Either is fine –
but the other 10µF capacitor (on pin8
of IC1c) should be a tantalum.
Construction
There are only ten components to
solder to the PCB and only five of
these are polarised: the 4093B IC,
of course, the on-board LED, the
1N4004 diode and the two capacitors. Fit the resistors first – if you
can read resistor colour codes (see
the parts list) that’s great, but we do
recommend you always check with
your multimeter set to ohms, just to
confirm their value.
In the case of the tantalum capacitors, the ‘+’ marked on their
body goes to the ‘+’ mark on the PCB.
(‘Ordinary’ electrolytics have the ‘–’
leg marked; this of course goes to the
‘–’ mark on the PCB).
Similarly, make sure the stripe on
the diode aligns with the stripe on the
PCB. Finally, note the notch on the end
of the quad gate IC: it goes closest to
the right edge of the board.
The anode of the internal LED is the
longer of the two leads – again, it goes
to the ‘A’ marked on the PCB.
S1, the ‘start’ switch, should be
soldered direct to the PCB.
The reed switch and external LED
both connect via thin insulated wires
to their respective screw terminals on
the PCB (reed switch to CON1; LED
to CON2). Watch the LED polarity –
make sure the anode connects to the
A marking on CON2.
Before drilling the case and mounting the completed PCB, connect the
9V battery and check operation. Hold
the door magnet close to the reed
switch, then press S1. Both LEDs
should start flashing; move the magnet away from the reed switch and
they should stop flashing.
If none of this happens, check your
component placement, orientation and
soldering. With so few components,
there is very little else that could go
wrong. If all else fails, measure the battery voltage when the circuit should be
on. It should be at or very close to 9V.
Mounting the PCB
The board sits upside-down in the
jiffy box – the board is designed to
snap into the captive guides on the
box sides. You’ll need to drill holes
in the bottom of the case (which becomes the top!) for the ‘start’ switch
(and internal LED).
If the start switch is soldered directly to the PCB, you need to be quite
accurate with the hole placement.
Another hole is needed in the top of
the case (which becomes the bottom!)
for the wires to go off to the reed switch
and to the door LED.
The battery snap
wires are quite thin,
so they go through
a strain-relief hole
in the PCB before
soldering to their
respective pads. As
mentioned in the
text, the capacitor
at lower right is
specified in the parts
list as tantalum but
here, a standard
electrolytic is
adequate. The other
capacitor (the yellow
component) should
be tantalum due to
their lower leakage.
20
Mounting the door hardware
The exact location of the warning LED
is entirely up to you – whatever gives
the best visibility.
That might be actually through the
door, or it could be on the door jamb.
A wide variety of LED bezels is available, some of which are designed to
work through a door or jamb.
Or you might simply glue the flat
base of an ultrabright LED to the outside of the door, with a couple of fine
holes for its leads/wires.
The reed switch and its magnet need
to be placed so that when the door is
Parts L i s t –
B u s y L oo W arni ng
1 PCB, 38.5 x 49mm; code 16112201,
available from the PE PCB Service
1 UB5 Jiffy case, 83 x 54 x 31mm
[eg, Jaycar HB6025]
1 reed switch set (reed switch and
magnet – often sold for alarm
systems – eg, Jaycar LA5027)
1 small momentary contact
pushbutton switch (S1) #
2 mini PCB mount connectors
1 4093 quad Schmitt NAND gate (IC1)
1 1N4004 diode (D1)
1 ultrabright red LED [eg, Jaycar
ZD0102]
1 standard red LED #
Suitable mounting for internal and
external LED
1 9V battery snap
1 9V battery
Capaci tors
2 10µF 16V tantalum
R es i s tors (0.25W, 1%)
2 100kΩ
1 47kΩ
1 1kΩ
# we used a pushbutton switch with
an integrated LED; provision is
made on the PCB for this or for
separate switch and LED.
Practical Electronics | March | 2022
are others which are intended for
completely concealed mounting –
the reed is recessed into the jamb
and the magnet mounts inside the
door. (eg Jaycar LA5075).
Fig.2: the PCB
mounts upside-down
in the case, held in
place by the notches
in the case edge. The
component at left (on
the red/black wires)
is the ultrabright
LED, which mounts
on the door.
closed, the magnet comes very close to
the reed switch (without hitting it!). It’s
probably best to have the reed switch
on the door jamb and the magnet on
the door. There are handy reed switch
sets which come in plastic holders
with screw holes, intended for alarm
systems (eg, Jaycar LA5027). There
Two types of reed switch, both suitable for this
application. The type at left (Jaycar LA5072) is
designed for surface mounting (hence the mounting
holes) while the type above (Jaycar LA5075) is fully
concealed, mounting in holes drilled in a wooden door
(or window) frame. There are two halves – the reed switch
itself (on the right in both cases) and the actuating magnet. The
switch is normally open, closing when the magnet is brought into close proximity.
Using it
That is simplicity itself! When you
go into the loo, you simply press
the momentary action (ie, normally
open) ‘Start’ switch (S1). This starts
both LEDs flashing (the internal LED
assures you that you don’t have a
flat battery).
It stays that way until you open the
door to leave. As the magnet moves
away from the reed switch (S2) it
opens, turning off the circuit – ready
for the next occupant.
The ‘automatic’ reed switch
turnoff is included because of the
high likelihood that someone will
forget to manually turn it off, resulting in a queue at the door of an
unoccupied facility!
We could have made it fully automatic (ie, LEDs start flashing as
soon as you entered) but deemed the
extra complication not worthwhile.
But for experimenters, it wouldn’t
be hard to do.
Teach-In 8 CD-ROM
Exploring the Arduino
This CD-ROM version of the exciting and popular Teach-In 8 series has
been designed for electronics enthusiasts who want to get to grips with
the inexpensive, immensely popular Arduino microcontroller, as well
as coding enthusiasts who want to explore hardware and interfacing.
Teach-In 8 provides a one-stop source of ideas and practical information.
The Arduino offers a remarkably effective platform for developing a
huge variety of projects; from operating a set of Christmas tree lights
to remotely controlling a robotic vehicle wirelessly or via the Internet.
Teach-In 8 is based around a series of practical projects with plenty of
information for customisation. The projects can be combined together
in many different ways in order to build more complex systems that can
be used to solve a wide variety of home automation and environmental
monitoring problems. The series includes topics such as RF technology,
wireless networking and remote web access.
PLUS: PICs and the PICkit 3 – A beginners guide
The CD-ROM also includes a bonus – an extra 12-part series based around the popular
PIC microcontroller, explaining how to build PIC-based systems.
Reproduced by arrangement with
SILICON CHIP magazine 2022.
www.siliconchip.com.au
EE
FR -ROM
CD
ELECTRONICS
TEACH-IN 8
£8.99
FREE
CD-ROM
SOFTWARE
FOR
THE TEACH-IN
8
SERIES
FROM THE PUBLISHERS OF
INTRODUCING THE ARDUINO
• Hardware – learn about components and circuits
• Programming – powerful integrated development system
• Microcontrollers – understand control operations
• Communications – connect to PCs and other Arduinos
PLUS...
PIC n’MIX
PICs and the PICkit 3 - A beginners
guide. The why and how to build
PIC-based projects
Teach In 8 Cover.indd 1
04/04/2017 12:24
PRICE
£8.99
Includes P&P to UK if
ordered direct from us
SOFTWARE
The CD-ROM contains the software for both the Teach-In 8 and PICkit 3 series.
ORDER YOUR COPY TODAY at: www.electronpublishing.com
Practical Electronics | March | 2022
21
|