This is only a preview of the December 2009 issue of Silicon Chip. You can view 34 of the 112 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Items relevant to "Voltage Interceptor For Cars With ECUs":
Items relevant to "One-Of-Nine Switch Position Indicator":
Items relevant to "Capacitor Leakage Meter With LCD Readout":
Items relevant to "WIB: Web Server In A Box, Pt.2":
Purchase a printed copy of this issue for $10.00. |
Design by JOHN CLARKE
Words by LEO SIMPSON
One-of-nine
switch indicator
Originally conceived as a track-in-use indicator for model railway
layouts, this one-of-nine indicator can used with any selector
switch with up to nine positions. It can be used with a bank of reed
switches, as might be used on a locomotive turntable or traverser
on a model railway layout or with any switch with up to nine
positions. Then we realised it had many other uses . . .
A
ny railway modeller will be
familiar with the problem: you
have a locomotive turntable or
switch-yard and you are never sure
which track is actually selected, unless
you go and have a close look.
Or you could have the same problem
with a traverser which selects rolling
stock storage tracks. With a locomotive
turntable you may well be sure that a
track has been correctly “indexed” but
you still don’t know which one has
been selected. So the solution to that
problem is a reed switch associated
with each output track and a magnet
on the turntable to activate each reed.
The bank of nine (or less) switches
is wired effectively as a single-pole
rotary switch and then can be coupled
to this single-digit display. From there,
the concept can be applied to any situation where a rotary switch is used,
32 Silicon Chip
with one or two provisos which we
will come to later.
Normally open switches
More specifically, this Switch Indicator is designed to operate with
normally-open switches, such as reed
switches. With no switches closed, the
single-digit display will show zero (0).
With a switch closed, the display will
show the number of the switch.
This brings us to another important
point – the circuit is designed to operate correctly only if one switch is
closed at the one time.
The arrangement of the reed switches and magnets should be such that
as one switch opens the next switch
closes. In other words there should not
be a period when two reed switches
are closed.
If two or more switches are closed,
the display will show a blank or an
incorrect value which may be quite unrelated to the switches that are closed.
For example, a closed 4 and 6 switch
will show a 6, a closed 1 and 2 switch
will show a 3 while a closed 8 and 3
switch will show a blanked display.
Circuit description
The circuit for the Switch Indicator
comprises the switch inputs, a diode
matrix, a CMOS 4511 BCD to 7-segment decoder (IC1) and a single 7-segment common cathode LED display.
IC1 has four inputs labelled A, B,
C & D. These are normally held low
at 0V via the four 10k pull-down
resistors. When all four inputs are
low, IC1 decodes this condition as
zero and it drives the 7-segment display accordingly, to show a 0. This is
achieved by pulling its a, b, c, d, e &
siliconchip.com.au
There’s not much to
this versatile project – it simply
detects which switch position is high
and reads out the appropriate figure on the LED
display. An extension board (see overleaf) can show the
same digit some distance away.
f outputs high to drive the similarly
labelled segments of the display via
the 1.2kresistors. For the 0 display,
the central ‘g’ output remains low and
its segment is not lit.
For those not familiar with BCD
decoders and 7-segment displays, a
look at Table 1 will be helpful.
The four columns on the left side
of the table are labelled D, C, B & A,
corresponding to the BCD inputs of
the 4511 decoder. What we are talking
about is a 4-bit BCD code; BCD stands
for Binary-Coded Decimal. So if you
look at the top row of the ABCD columns you will see that it shows 0000
and this corresponds to a numeric
value of 0, as indicated at the top of
the extreme right column.
The other columns in Table 1 show
BCD INPUTS
SEGMENT OUTPUTS
DISPLAY
D
C B A
a
b
c
d
e
f
g
0
0
0
0
0
0
0
0
1
0
0
0
0
1
1
1
1
0
0
0
1
1
0
0
1
1
0
0
1
0
1
0
1
0
1
0
1
0
1
1
0
1
0
1
1
1
1
1
1
1
0
0
1
1
1
1
0
1
1
1
1
1
1
1
0
1
1
0
1
1
0
1
1
0
1
0
0
0
1
0
1
1
0
0
0
1
1
1
0
1
0
0
1
1
1
1
1
0
1
1
0
0
1
1
1
1
0
0
1
1
0
1
2
3
4
5
6
7
8
9
8
a
f
b
g
c
e
d
Table 1: here’s how the 4511 chip decodes the switch inputs, in BCD (binarycoded-decimal and lights the appropriate segments in the LED readout (1s light, 0s
extinguish). Any other BCD input results in all 0 s and therefore no segments lit.
Note that the “6” shown here is the standard 4511 output – but we’ve modified it
so that the “a” segment lights as well (see right . . . )
siliconchip.com.au
which of the seven segments of the
display are illuminated. Hence, the
top row of the table shows that all
segments except ‘g’ are illuminated.
Going back to the circuit of Fig.1,
if switch 1 is closed, the 9V supply
is connected to the anode of diode
D1 and this pulls the A input of IC1
high. This is equivalent to a BCD value
of 0001.
IC1 decodes this condition as a 1
and drives the b & c outputs high while
all other outputs are kept low. The b &
c segments for the display now light
to show the 1. This is shown in the
second row of Table 2.
Similarly, if a different switch is
We reckon our 6 (left) looks a lot better
than the standard 7-segment display 6
(right). All it costs is two diodes!
December 2009 33
REG1 7809
CON1
+9V
S1
A
D2
A
IN
A
GND
10 F
16V
K
S2
S3
OUT
D1
D18
10
ZD1
18V
1W
100 F
25V
K
K
A
K
K
D3
K
A
D7
K
D6
A
K
D8
S6
A
K
D9
A
10
OPTIONAL
REMOTE
DISPLAY
(CON4
CONNECTS
TO CON3
VIA IDC
CABLE)
K
A
DISP2
LT5543R
CON4
D5
S5
9
g
f
1 e
2
d
4 c
6
f
e
b
7 a
a
b
g
d
c
dp
k
3,8
K
D12
S7
A
K
D11
A
K
4
D10
A
S8
0V
D4
A
A
S4
+12V
CON2
3
K
D13
A
6
K
2
D15
S9
A
1
K
7
D14
A
5
K
BI
16
Vdd
Og
LT
Of
DD
Oe
DC
DB
7x 1.2k
14
9
DA
Ob
EL
Oa
10k
10k
10k
g
11
f
1 e
2
d
4 c
12
6
9
A
13
Vss
10k
10
15
10
IC1
Od
4511B
Oc
DISP1
LT5543R
CON3
A
7 a
D17
D16
8
K
b
f
e
a
g
d
b
c
dp
k
3,8
K
ZD1
7809
GND
SC
2009
SWITCH POSITION INDICATOR
A
IN
GND
A
OUT
Special drive for 6
The display for the number 6 requires some explanation.
As shown in Table 1, the 4511 decoder creates a 6 by driving the c, d, e,
f and g segments. This gives an abbreviated 6 (in our opinion), so we have
modified the circuit to also include the
top segment (‘a’) in the 6 display, using
diode D17. This lights the ‘a’ segment
whenever the ‘e’ segment is lit. Diode
D16 is included to prevent the low ‘a’
output line from IC1 from being driven
high via diode D17.
This display modification does not
affect any other numbers. This is because for other numbers where the ‘e’
34 Silicon Chip
segment is lit (ie, the numbers 0, 2, and
8), the ‘a’ segment is already lit – and
it doesn’t get any brighter if more than
one output drives it!
Other inputs on the 4511 include
pin 3, the Blanking Input (BI), pin 4,
Lamp Test (LT) and pin 5, Latch Enable
(LE). These functions are not used in
our design and so pins 3 & 4 are tied
high while pin 5 is tied low.
Power for the circuit can come from
just about any 12V DC supply (in fact,
anything from 11V to 18VDC at 80mA
or so will do). Diode D18 protects the
input capacitor and regulator from
reverse voltage connection while the
10 resistor and 18V zener gives
transient protection. A 100F capacitor filters the input to the 3-terminal
regulator, REG1. This regulator provides a 9V output for the reed switch
common connection and supply for
IC1. A 10F capacitor bypasses the
regulator output.
K
D18: 1N4004
A
Fig.1: switch positions S1-S9 are decoded by IC1, a BCD-to-7-segment decoder, the result
displayed on the 7-segment LED readout. The optional remote display can be used some distance away.
pressed, then the diodes associated
with that switch pull the respective
A, B, C or D lines high to select the
required digit to light. Table 1 shows
the A, B, C and D input conditions to
produce each number.
K
D1-D17: 1N4148
K
Remote readouts
So far, we’ve only looked at a single
LED display mounted on the main PC
board. But we’re sure (in fact we know
from experience!) that there will be
times when a remote display is also
needed.
Therefore, we’ve designed the system to be very flexible. You can use the
single display on the main PC board,
or you can add a second, smaller,
display-only PC board via a suitable
length of IDC ribbon cable and have
an extension readout (obviously this
always displays the same digit as on
the main board!).
Or you can even leave the display
off the main PC board and simply have
a single display a suitable distance
away.
How far away? Because the LED
segments only draw milliamps there
won’t be much voltage drop over a
ribbon cable, even several metres long.
siliconchip.com.au
D1
10k
1
4148
D2
10k
2
2
4148
D3
3
3
4148
D4
4148
D5
4
4
4148
D6
5
5
4148
D7
6
6
4148
D8
4148
D9
7
4148
D10
8
8
4148
D11
9
V+
9
4148
D12
4148
D13
10 F 100 F
4148
D14
10k
4148
D15
10k
7
+V
4148
D17
4148
1.2k
1.2k
1.2k
1.2k
LOCATING LUG UNDER
DISP1
1.2k
18V
ZD1
1.2k
1.2k
IC1 4511B
1
D16
H1
8x2 IDC
HEADER
(CON3)
10
D18
V+12V
21+
REG1
7809
V0V
0
CON2
19021190
OPTIONAL REMOTE
LED INDICATOR
BOARD
DISP2
YALPSID NIART
4148
R OTA CID NI G NIDIS K CART NIART
CON1
RIGHT ANGLE
IDC HEADER
29021190
(CON4)
LOCATING
LUG
16-WAY IDC CABLE
IDC LINE
CONNECTOR
(DISPLAY END)
IDC LINE
CONNECTOR
(MAIN BOARD
END)
Fig.2 (top) shows the component
layout for both the main PC board
and the (optional) remote or extender
board. The extender draws its power
from the main board and is connected
via the 16-way IDC cable, shown
immediately above in Fig.3.
We’re not stating a maximum distance
– it’s probably tens of metres or more –
but if the remote display is noticeably
dimmer than the main display, you’ve
reached the limit!
Construction
The Model Railway Storage Track
Indicator is constructed on a PC board
coded 09112091 and measuring 104 x
62mm. This can clip into the integral
mounting clips within a UB3 plastic
case if required. Alternatively, four corner mounting points are provided for
mounting in a different box or mounted
under a track layout. Fig.2 shows the
component layout on the board.
The remote LED display PC board
measures 35 x 43mm. This board is
coded 09112092. Its layout is also
shown in Fig.2
Begin construction by checking the
PC board for breaks in tracks or shorts
between tracks and pads. Check that
siliconchip.com.au
Parts list – Switch Position Indicator
1 PC board coded 09112091, 104 x 62mm
1 Display PC board coded 09112092, 35 x 43mm *
1 plastic UB3 box, 130 x 68 x 44mm
1 TO-220 mini heatsink 19 x 19 x 9.5mm
6 PC mount 2-way screw terminals with 5.08mm pin spacing
1 1m length 16-way IDC cable *
1 16-way PC mount IDC header *
1 16-way PC mount right angle IDC header *
2 IDC line sockets *
1 20-way IC socket strip
Items marked with
1 DIP16 IC socket
an asterisk (*) are for
1 M3 x 6mm screw
optional remote display
1 M3 nut
Semiconductors
1 4511 BCD to 7-segment decoder (IC1)
1 LTS543R common cathode LED display (DISP1) (or 2*)
1 7809 9V regulator (REG1)
1 1N4746 18V zener diode (ZD1)
17 1N4148 switching diodes (D1-D17)
1 1N4004 1A diode (D18)
Capacitors
1 100F 25V PC electrolytic
1 10F 16V PC electrolytic
Resistors (0.25W 1%)
4 10k (brown black orange brown or brown black black red brown)
7 1.2k (brown red red brown or brown red black brown brown)
1 10
(brown black black brown or brown black black gold brown)
December 2009 35
Here’s the display
showing switch position
6 along with the extender
board which obviously
has to show the same
thing! You can elect to
have the main display
only, the extender display
only (by leaving out the
main board LED readout)
or indeed both displays,
as we have shown here.
the hole sizes are correct for each
components to fit neatly.
The screw terminal holes are
1.25mm in diameter compared to the
0.9mm holes for the IC, resistors and
diodes. REG1 should have a 3mm
mounting hole for the metal tab and
the corner mounting holes should also
be 3mm in diameter.
The first components to insert are
the diodes and resistors. The diodes
must be mounted with the orientation
as shown. Diode D18 and ZD1 have a
larger body size compared to the other
diodes (D1-D17).
When inserting the resistors, use the
resistor colour codes shown alongside
the resistors in the parts list to check
the resistor values (both 4-band and
5-band types are shown). A digital
multimeter can also be used to measure each value as it is inserted.
REG1 mounts on a small heatsink
with its leads bent at right angles to insert into the PC board holes. Make sure
the leads are bent at the correct length
so the regulator tab can be secured to
36 Silicon Chip
the PC board using a screw through
the mounting hole in the PC board. Do
this before soldering its leads.
The screw terminals can be mounted
next, noting that the 10-way section is
made from five 2-way sections locked
together, before they are inserted into
the PC board.
IC1 can either be soldered directly
into the board or you can solder in
a 16-pin DIP IC socket – either must
be oriented with the notch as shown.
Two 5-way socket strips are used for
the LED display.
If you intend using the separate display board, you will need to mount a
16-way IDC PC-mount header for the
interconnecting cable. This header has
its notch closest to the display.
Install the two capacitors next,
ensuring they are oriented correctly.
If the display is to be mounted on
the main PC board then this can be
inserted now. The decimal point is
oriented to the lower right as shown.
That completes the main PC board
assembly but if the remote display is
required, the display PC board will
also require assembly.
It too should also be checked for
breaks in tracks or shorted tracks
and that hole sizes are correct. The
right angle mount 16-way IDC header
mounts as shown and the display
can be mounted on two 5-way socket
strips.
The 16-way IDC cable is made as
shown in Fig.3, using a length of 16way IDC cable and the two IDC sockets
at each end. They are attached to the
ribbon cable by clamping the socket
halves around the cable in a vise.
Make sure the cable is oriented correctly, with the red stripe side located
at the pin 1 edge of the IDC sockets. Pin
1 is indicated with a triangle shaped
arrow embossed on the location lug
side of the socket.
Testing
Apply power and check that the
display shows a 0. If it does not, check
that there is 9V between pin 16 and
8 of IC1. If there is no voltage here,
siliconchip.com.au
2
REED SWITCH 3
3
REED SWITCH 4
REED SWITCH 5
REED SWITCH 6
REED SWITCH 8
REED SWITCH 9
4148
4148
4148
5
4148
4148
4148
7
4148
8
4148
9
V+
USING SEPARATE
REED SWITCHES
4148
4148
4
6
REED SWITCH 7
4148
18V
V21+
4148
V0
4148
4148
1
3
2
3
4
+9V
(R)
5
9
8
7
0V
4148
4148
4148
4148
4148
4148
4148
7
4148
8
4148
USING A SINGLE
ROTARY (OR SLIDER) SWITCH
4148
4148
5
9
V+
4148
4148
4
6
6
+12V
19021190
CON1
2
(POWER)
CON2
4148
1
Fig.4 (left) shows how
you would wire a
set of reed switches,
such as would be used
on a model railway
turntable or traveller
with a magnet
strategically placed on
the moving section.
18V
V21+
4148
4148
4148
4148
V0
R OTA CID NI G NIDIS K CART NIART
1
REED SWITCH 2
4148
4148
R OTA CID NI G NIDIS K CART NIART
CON1
REED SWITCH 1
(POWER)
+12V
0V
CON2
19021190
Fig.5: the wiring for a conventional 9-position switch. This could be part of a dual or multi-pole switch, as long as the
poles remained isolated. This arrangement can be used for any number of applications requiring “in use” identification.
check for approximately 9V at the
output of REG1.
If the regulator does not deliver the
right voltage it may be faulty (or the
wrong type!) or installed incorrectly
(not easy to do!), diode D18 or Zener
ZD1 may be faulty or installed backto-front (much easier to do!) or there
may be a short circuit between the 9V
and common ground on the PC board.
Otherwise there is not much else that
can be wrong.
When the display is working, a connection between the 9V terminal on
CON1 and the 1 input should change
the display to show a 1.
siliconchip.com.au
Similarly a connection from the 9V
to the 2 input should have the display
showing a 2 and so on.
A transparent red acrylic or Perspex
filter can be used over the display to
improve the contrast (and therefore
visibility) of the number.
In use
If the circuit is used with reed
switches, Fig.4 shows how these are
wired. One side of each switch is common and connects to the 9V terminal.
The free end of each reed switch connects to the terminals on CON1. Not
all nine reed switches need to be used
- only the number of reed switches associated with the storage tracks need
to be connected. Unused inputs are
left disconnected.
Fig.5 shows the equivalent connection for a single-pole rotary switch.
We imagine that most applications
requiring switch position indicators
will in fact use a double-pole (or even
multi-pole) switch. Just be certain to
keep the original application and the
Switch Indicator wiring isolated from
each other!
Any other uses for the Switch
Indicator should follow this basic
approach.
SC
December 2009 37
|