This is only a preview of the August 2010 issue of Silicon Chip. You can view 31 of the 104 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 "Remote-Controlled Digital Up/Down Timer":
Items relevant to "Build A Large Ultrasonic Cleaner":
Items relevant to "Electrolytic Capacitor Reformer & Tester":
Purchase a printed copy of this issue for $10.00. |
By NICHOLAS VINEN
Remote-Controlled
Digital Up/Down Timer
This remote-controlled digital timer has a bright 20mm-high
7-segment red LED display & can count up or down from one
second to 100 hours in 1-second steps. Its timing period can
either be set and controlled using the remote control or it can
be automatically controlled via external trigger/reset inputs. An
internal relay and buzzer activate when the unit times out.
T
HIS NEW DIGITAL TIMER is a
very flexible project. We can think
of many uses for it but we are sure
there are a lot more that we haven’t
even considered.
We’ve done lots of timers before
but this one has the convenience of
remote control. Its timing period can
be programmed using the numerical
keypad button on the remote, while
the remote’s Power/Standby button
provides a Reset function.
34 Silicon Chip
The simplest way to use it is like
a kitchen timer. In this mode, it can
count up or down for the timing period, as entered via the keypad on the
remote. Pressing the remote’s Channel
Up button make the unit count up to
the programmed time, while pressing
the Channel Down button makes it
count down.
When the time runs out, the LED
display flashes and a buzzer sounds
for a preset period (the default is one
minute) or until the reset button is
pressed. You can either use the Power/
Standby button on the remote to reset
the unit or an external reset button.
The internal relay also switches at
the end of the timing interval. This
relay can directly control a DC device
(30V DC or 24V AC max.) or it can
indirectly control a mains-powered
device via a separate external mainsrated relay (see panel). Note, however,
that this unit is definitely NOT RATED
siliconchip.com.au
OUT
A
100nF
470Ω
10k
E
B
f
PD2
IC1
ATTINY
2313
K
D3
2
10k
A
8
K
100nF
3
TRIG
IN
1
PD4
D4
PA2/RST
A
PD5
2
+5V
CON3
PD1
10k
XTAL2
A
7
K
PD3
D6
100nF
XTAL1
GND
10
A
D3–D6: 1N4148
A
2010
b
c
f
e
g
d
dp
a
K
9–12V
DC IN
b
f
g
e
c
dp
d
g f e d c b a dp
DISP3 NFD-5621BS
a
b
f
e
c
a
b
g
d
dp
f
e
c
g
d
a
b
f
g
e
c
d
dp
dp
c dp e d g
g f e d c b a dp
b
c
dp
f
b a
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10
15
14
13
12
11
16
17
18
19
2
1
+5V
RLY1
K
D2
9
CON1
A
3
COM
NC
NO
K
D5
SC
d
+
–
47 µF
DISP2 NFD-8021BS
a
1 2 3 4 5 6 7 8 9 10
PB3
PB2
PB1
PB0
PD6
PB4
PB5
PB6
PB7
PD0
+5V
3
g
e
6
RESET
IN
a
C
2
1
DISP1 NFD-8021BS
20
Vdd
Q1
BC556
D1
D2
λ
1
A
CON4
D1
D2
3
IN
GND
100 µF
+5V
K
K
D2
D1
λ LED1
100nF
IRD1
IR
RECEIVER
D1
REG1 7805T
+5V
4
5
+
COM
NC
NO
PIEZO
BUZZER
X1 8MHz
–
33pF
10k
C
B
33pF
CON2
Q2
BC546
E
D1, D2: 1N4004
A
REMOTE-CONTROLLED DIGITAL TIMER
LED
K
B
K
A
7805
BC546, BC556
E
GND
IN
C
GND
OUT
Fig.1: the circuit is based on an Atmel ATTiny2313 microcontroller (IC1), three dual 7-segment LED readouts and an
infrared receiver (IRD1). The micro drives the LEDs, controls the timing and drives a DPDT relay via transistor Q2.
to directly switch mains devices.
By default, the relay is energised
while the timer is running. As such,
the timer could be used to run an oven
for the programmed timing period,
expose a PC board to UV light, or run
a fan or light for a fixed period, etc.
The trigger and reset inputs can be
used to automatically start and stop the
timer when certain events occur, eg,
when a door opens, an external button
is pressed or a PIR (passive infrared)
sensor is triggered by motion, etc.
This means that you could set it up to
turn on a light or fan when a door is
opened and then subsequently switch
the device off when the door is shut or
after the programmed period expires.
It could even be used as the basis of
a very simple alarm system. All you
siliconchip.com.au
have to do is connect a PIR sensor to
the trigger input, a key-switch to the
reset input and a siren to the relay. You
then set the timer to a short period (say
30 seconds) and the alarm period to
a value that’s longer than the default
(say three minutes) and voila! . . . you
have a basic motion-triggered alarm
with key deactivation.
By the way, the unit will work with
virtually any universal remote control
that’s capable of transmitting Philips
RC5 codes (nearly all do). So if you
have a spare universal remote control,
it will do the job quite nicely.
Circuit description
Take a look now at Fig.1 for the full
circuit details. It’s based on microcontroller IC1 plus three dual 7-segment
LED readouts. However, instead of
using a PIC micro as in most other
projects, this time we’ve opted for an
Atmel ATTiny2313 with 2048 bytes of
flash memory.
The micro normally runs at 8MHz,
as set by an internal 8MHz oscillator
and crystal X1. This clock frequency is
reduced to 1MHz (via a clock divider)
when the micro is in standby mode.
Note that although the micro actually has an internal 8MHz oscillator,
the crystal is necessary for accurate
timekeeping. Typical crystal error is
less than 100ppm or 0.01%, giving a
maximum timing error is one second
per three hours although it will normally be well under half that.
The unusual part of this circuit is
the way in which the six 7-segment
August 2010 35
Parts List
1 PC board, code 19108101,
89 x 80mm
1 sealed polycarbonate enclosure,
115 x 90 x 55mm with clear lid
(Jaycar HB-6246)
1 universal remote control with
numeric keypad (eg, Jaycar
AR-1726, Altronics A-1012)
1 9-12V DC 300mA plugpack
(Jaycar MP-3147, Altronics
M-8928 or similar)
1 6-way chassis-mount terminal
barrier (Jaycar HM-3168,
Altronics P-2076A)
1 5V DPDT DIL relay (Futurlec
HFD2-05, Altronics S-4147 or
equivalent) (RLY1)
1 PC-mount 5V mini piezoelectric buzzer (Jaycar AB-3459,
Altronics S-6105)
1 8MHz HC-49 crystal resonator
(X1)
1 20-pin DIL IC socket
3 mini 3-way terminal blocks
(5.08mm pitch) (CON1-CON3
1 2-way polarised header
(2.54mm pitch) (CON4)
1 2-way polarised header connector (2.54mm pitch)
1 2.1mm ID panel-mount DC
socket (Jaycar PS-0522,
Altronics P-0622)
4 M3 x 15mm tapped Nylon
spacers
6 M3 x 20mm pan head machine
screws
2 M3 nuts
2 M3 flat washers
2 M3 spring washers
Medium-duty hook-up wire: 50mm
lengths of black and red, 130mm
lengths of brown, orange, yellow,
green, blue and white
LED digits (DISP1-3) are driven. Just
10 of IC1’s 20 pins are used to drive the
48 segments (seven per digit plus the
six decimal points). What’s more, we
have not used any discrete transistors
or current limiting resistors in the LED
drive circuit. This makes the project
smaller, cheaper and easier to build but
how do we get away with it?
First, we are using a “charlieplexing” system (popularised by Charlie
Allen at Maxim) which cuts down on
the number of pins required to drive
the LEDs. This is a special form of
multiplexing and to understand how
it works, first consider display DISP1.
This contains two of the digits and has
10 pins – two common anodes and
eight shared cathodes.
If we wire up just this display, then
turning on any single segment is easy.
We start by pulling one of the common
anodes pins high – pin 1 for the first
digit or pin 2 for the second digit. We
then drive one of the cathode pins
low, so that one of the 16 LEDs in the
display has a complete circuit, ie, is
driven at both ends. This ensures that
only that segment lights up.
The other eight lines remain high
impedance (“Tri-stated”) in order
to avoid turning on any of the other
segments.
To drive the second display, we reuse the same set of pins on the micro
but we use two different ones for driving the anodes. For example, here we
are using pins 15 & 14 of the micro to
drive the anodes in DISP1, while pins
11 & 12 drive the anodes in DISP2.
36 Silicon Chip
Semiconductors
1 ATTiny2313 microcontroller
(IC1) programmed with
1910810B.hex
1 7805T 5V regulator (REG1)
1 infrared receiver (IRD1)
1 BC556 PNP transistor (Q1)
1 BC546 NPN transistor (Q2)
2 7DR/NFD-8021BS 20mm
dual high-brightness common
anode 7-segment LED displays (DISP1-2) (available from
Futurlec)
1 7DR/NFD-5621BS 14mm dual
high-brightness common
anode 7-segment LED display (DISP3) (available from
Futurlec)
1 green 5mm LED (LED1)
2 1N4004 diodes (D1-D2)
4 1N4148 diodes (D3-D6)
Capacitors
1 100µF 16V electrolytic
1 47µF 25V electrolytic
4 100nF MKT
2 33pF ceramic
Resistors
4 10kΩ
1 470Ω
With this arrangement, when any
segment in display DISP1 is illuminated, there is also a voltage present
across one of the segments within
DISP2. However, because DISP2’s anode pins are connected only to DISP1’s
cathodes, that LED is reverse biased
and so it does not light. The same is
true in reverse, ie, driving a segment
in DISP2 will reverse bias a segment
in DISP1.
The same applies for DISP3, which
has its anodes driven from pins 18 &
19 of the micro. As a result, no two
common anodes are joined to the same
microcontroller output. Thus, by being clever as to which lines are driven
high and low at any one time (as set
by the micro’s internal firmware) and
leaving the rest at high impedance, we
can light any one of the 48 segments.
Multiplexing
While this scheme theoretically allows us to light more than one segment
at once (in fact we could light all the
segments in a single digit quite easily),
in practice we would need external
anode driver transistors to do this. The
microcontroller outputs simply can’t
provide enough current to light multiple segments simultaneously, at least
not without affecting their brightness.
So each segment in the display is lit
individually in sequence. Because this
happens so rapidly, the persistence
of vision effect in our eyes makes it
appear as if all the segments are lit
simultaneously. This is much the
same technique that’s generally used
to multiplex a multi-digit 7-segment
LED display, except that normally
all the segments of each digit are lit
simultaneously.
In this case, we have taken the
multiplexing to its extreme and as a
result, the individual segment duty
cycle is less than 2%. In other words,
each segment is lit for less than 1/50th
of the total time.
We can get away with this for two
reasons. First, the LED displays are
very bright, so despite each segment
being lit for such a short period, they
are still quite visible. Second, we are
driving them above their rated DC
current (but below their rated pulse
current), thereby increasing their
instantaneous (and thus average)
brightness.
This scheme has yet another advantage. Because the number of segments
being lit at any one time never varies
siliconchip.com.au
(it’s always one), the displays do not
vary their brightness according to the
value. Look carefully at a commercial
device with a 7-segment LED display
(eg, a microwave or clock/radio) and
you will find that in many cases, the
brightness varies quite dramatically
between a digit reading “1” and one
reading “8”.
Current limiting
The microcontroller runs off a +5V
rail (more on this later) and the LED
segments have a typical forward voltage of around 2V. So how does the
microcontroller drive the LEDs, or for
that matter its internal output transistors, without burning them out?
The answer is that these output transistors, for both the anode and cathode
drive, have a fairly significant internal
resistance. This limits the current to a
safe level but only if the segment duty
cycle is kept low. As mentioned earlier,
the duty cycle has to be less than 2%
due to the number of segments and
calculations show that this is safe for
both the micro and the displays.
Let’s take a closer look at these calculations. The ATTiny2313 datasheet
does not specify any dissipation limits
but we can estimate them from its current limits. In this case, the maximum
current per I/O pin is given as 40mA,
while the maximum current for the
entire micro is 200mA.
By referring to the “I/O Pin Source
Current vs. Output Voltage (VCC = 5V)”
and “I/O Pin Sink Current vs. Output
Voltage (VCC = 5V)” graphs, we can
calculate the maximum average dissipation for the output transistors in
the worst case temperature. This is
48mW for the pull-up transistors and
42mW for the pull-down transistors.
Since it is permissible to have up to
five I/O pins sourcing 40mA and five
I/O pins sinking 40mA simultaneously
(40mA x 5 = 200mA) then we can
calculate that the maximum package
dissipation must be at least (48mW +
42mW) x 5 = 450mW.
Average dissipation
We can now calculate the actual
dissipation in the output transistors
to check that it is safe.
First, we assume that the voltage
drop across each LED segment is
around 2V. In reality, it will be higher
than this due to the higher than normal
current but using a 2V figure is the
conservative approach. This means
siliconchip.com.au
Specifications
Timing range: 1 second to 100 hours (360,000 seconds) in 1-second steps.
Timing direction: unit can count up or down.
Remote control: can be set and controlled using a universal remote control.
External inputs: can be triggered and reset using external inputs; timer counts
up or down from a preset value when externally triggered.
Outputs: DPDT (double-pole double-throw) relay outputs – relay can be on or
off while counting and then changes state for the duration of the alarm period.
Relay contact rating: 30V DC or 24V AC (must NOT be used to switch mains
appliances).
Power supply: 9-12V DC 300mA plugpack or a battery.
the current through the LED will be
such that the sum of the voltage drops
across the output transistors is 3V (ie,
5V - 2V).
By referring to the sink and source
graphs previously mentioned, we can
calculate that the worst case current
flow is 65mA at -40°C. The instantaneous dissipation will thus be 118mW
in the source transistor, 130mW in the
LED and 76mW in the sink transistor.
Since the current source transistors
have a duty cycle of no more than
1:6 (there are six digits) and the sink
transistors have a duty cycle of no
more than 1:8 (eight segments), we
can calculate the maximum average
dissipation figures. These turn out to
be 19.7mW for the source transistors,
2.7mW for the LEDs and 9.5mW for
the sink transistors. The total average
dissipation in the microcontroller is
just 194mW.
These figures are all well below
the maximum continuous ratings. So
as long as we are careful to turn on
each segment for just a short period
(to prevent heat build up), then no
damage should occur. In fact, in this
design, each segment is lit for 10-20µs
at a time and thus the refresh rate is
around 1kHz.
Measurements on the prototype
confirm these calculations. With the
microcontroller running at 8MHz and
no segments lit, the current drain is
around 12mA. Conversely, with all
the segments lit, it is around 50mA.
This suggests that the instantaneous
current through each LED is in the
range of 40-50mA, which is slightly
less than we have calculated.
Infrared remote control
Control signals from the remote are
picked up by infrared receiver IRD1
and fed to the PD2/INT0 input (pin 6)
of IC1. IRD1 also drives LED1 (a green
5mm type) via PNP transistor Q1 and
this LED flashes when ever an infrared
transmission is received. However, it
does not guarantee that there were no
errors in the reception – if there are
then IC1 will ignore the signal. LED1
simply flashes brightly when infrared
(IR) data is received.
A typical infrared remote control
produces a modulated signal at around
36-38kHz. The IR receiver (IRD1) includes an internal 30-40kHz bandpass
filter in order to remove any signals
that may be present from flickering
lights or other infrared sources.
Unfortunately, while this filter does
a good job of preventing unintentional
signals from triggering its output, it is
not perfect. As a result, some red light
reflected back to the receiver from the
LED displays can cause occasional
false triggering and this can be made
worse if there are lights shining directly on the unit, as their flickering can
interact and produce beat frequencies.
Ultimately, this isn’t a problem because the microcontroller recognises
only legitimate 889µs-long control
pulses and ignores the shorter pulses
caused by interference. As a result,
false triggering at the IR receiver’s
output is rejected by the micro’s firmware and has no effect on the timer’s
operation.
Minor effects
The false triggering does have two
minor effects, though. One is that the
onboard green LED can briefly flicker
under some situations, as it directly
monitors IRD1’s output. However, the
LED lights much more brightly when
August 2010 37
r emiT latigiD pih C no ciliS
8888
BUZZER
100nF
4148
4148
33pF
x2
girT
TRIG
GND
RESET
t es eR
D N GCON3
CON1
COM
5V DPDT
RELAY
LED1
RLY1
0102 ©
© 2010
DISP3
CON2
COM
NC
NC
NO
88
NFD-5621BS
100nF
100nF
10k
10k
470Ω
D4, D6
10k
BC556
Q1
D2
BC546
4004
Q2
8MHz
IRD1
19108101
10180140
+
D3,
D5
10k
CON4
100nF
IC1 ATTINY2313
4148
4148
47 µF 25V 7805T
D1
4004
+
POWER
+
–
DISP2
NFD-8021BS
100 µF
Silicon Chip Digital Timer
NFD-8021BS
DISP1
NO
Fig.2: follow this parts layout diagram to build the PC board. Be careful
not to get transistors Q1 & Q2 mixed up and note that the displays must
be mounted with their decimal points towards the bottom.
It is also switched alternately on and
off at 1Hz to save power and make its
sound more obvious.
Note that its 1-minute period is the
default value and this can be altered
if necessary.
Relay RLY1 (a standard 5V micro
DPDT type) is driven from output PD5
(pin 9) of IC1, in this case via NPN
transistor Q2. Diode D2 protects the
transistor by quenching the back-EMF
voltage spikes that are produced when
the relay is switched off. All six relay
contacts are connected to terminal
blocks CON1 & CON2 so they can be
connected to the output terminals on
the outside of the case as you see fit.
The trigger and reset inputs are
provided via 3-way terminal block
CON3 and a pair of RC filters (10kΩ
and 100nF). These serve two purposes: (1) they filter out any noise or
transients from the signals; and (2) in
combination with diodes D3-D6, they
protect IC1 from excessive voltage in
either direction. As a result, it is safe
to apply at least ±36V to either input.
These inputs are connected to ports
PD3 and PD4 (pins 7 & 8) of IC1.
Voltages below 1.5V are considered
“low” while voltages above 3V are
considered “high”. The micro can be
configured as to whether a low or high
state activates the appropriate function
(trigger or reset).
PD3 and PD4 also have a weak
pull-up resistor enabled within the
microcontroller. This allows you to
attach a switch, pushbutton or relay
between the inputs and ground for passive triggering. In this case, you would
configure the input as active-low for
use with a normally open switch or
active-high for use with a normally
closed switch.
Power supply
This photo shows the fully-assembled prototype board. Note that there
are a few minor differences between this board and the final version
shown in the wiring diagram of Fig.2
the device is receiving genuine signals
from the remote, so it’s easy to distinguish between the two situations.
The second problem is that if there
is a lot of light shining directly into
the device, it can cause occasional reception errors when using the remote.
Our tests have shown that the device
can be reliably controlled from at least
5m away in most situations. It still
works under adverse conditions but
38 Silicon Chip
you may occasionally have to press a
remote button more than once or correct a misinterpreted command when
programming the unit.
Support circuitry
Pin 3 of IC1 drives the piezoelectric
buzzer and this is activated for one
minute at the end of the timing period.
It is driven directly from output PD1
as it only consumes a few milliamps.
Power for the unit can either be
derived from a 9-12V DC 300mA plugpack or from a suitable 9-12V battery.
The positive rail is fed in via diode
DI, which provides reverse polarity
protection, and applied to 3-terminal
regulator REG1 (7805). REG1 then provides a regulated +5V rail to power the
circuit (including the relays), while the
47µF and 100µF capacitors on either
side of REG provide the necessary
supply line filtering.
The idle current is around 8.6mA
and the maximum current drain is
about 100mA with all LEDs lit, the
relay on and the buzzer sounding.
siliconchip.com.au
Most of the idle current is consumed
by the 7805 regulator (up to 6mA) and
the infrared receiver (up to 4mA).
If you want to power it from a battery, especially one comprising alkaline cells, it would be a good idea to
replace D1 with a 1N5819 Schottky
diode and REG1 with an LM2940IT-5
low drop-out regulator. The LM2940
has a slightly higher quiescent current
but will allow the timer to run down
to a much lower battery voltage.
Board assembly
Most the parts are installed on a PC
board coded 19108101 and measuring 89 x 80mm. Begin by carefully
checking the copper side for defects
(breaks or short circuits), then check
that all the holes have been drilled to
the correct size. You may have to test
fit some of the parts (eg, the terminal
blocks and displays) to confirm this.
Check also that the four corner
mounting holes have been drilled to
3mm and that the board fits inside the
plastic case. If it won’t go in, you may
need to file the corners slightly.
Fig.2 shows the parts layout on the
PC board. Install the resistors first,
followed by the four 1N4148 small
signal diodes (D3-D6) which go in the
middle of the board. The two larger
1N4004 diodes (D1 & D2) can then be
installed. Make sure that all diodes are
correctly orientated.
Next, install the IC socket with its
notch closest to D1 – see Fig.2. Solder
its two diagonally opposite pins first,
then make sure it’s sitting flat on the
board before soldering the rest. The
two ceramic and four MKT capacitors
can then be installed.
Follow these with the two transistors (Q1 & Q2). Note that Q1 is a
PNP BC556 type while Q2 is an NPN
BC546, so be careful not to get them
mixed up. If their leads are too close
together to fit through the holes on
the board, crank them out with small
pliers, then back down again so that
they slide easily into place.
Mounting the displays
It’s now time to install the three dual
The PC board is installed by fitting
M3 x 15mm tapped Nylon spacers at each
corner and then fastening it to the integral pillars
in the case. Note that you will have to run the wiring to
the DC socket and the barrier terminal strip before this is done.
LED displays (leave the protective
plastic on while you do this). For best
appearance, they must sit perfectly
flat against the PC board and should
be parallel with the board edges. They
also fit the board if installed upsidedown, so be careful with their orientation – the decimal points must be
towards the bottom.
Before mounting the displays, check
that their pins haven’t been bent
during transport. If so, they can be
carefully straightened with pliers. Be
sure to push each display all the way
down so that it sits flush against the
board. It’s best to solder two diagonally
opposite pins first. That way, you can
check that the display is correctly
orientated and is flush with the board
before soldering its remaining pins.
The two electrolytic capacitors are
next on the list. Check their polarity
carefully when installing them and
be careful not to get them mixed up.
They should both be mounted about
3mm proud of the board so that they
can later be bent over at about a 45°
angle – see photos. That way, they
won’t intrude on the display.
Once these parts are in, install the
green LED (LED1). This goes in with its
flat (cathode) side towards 7-segment
LED display DISP3. Push it all the way
down onto the board and check its
orientation before soldering its leads.
Now for the infrared receiver (IRD1).
Table 2: Capacitor Codes
Value µF Value IEC Code EIA Code
100nF 0.1µF
100n
104
33pF NA
33p
33
Table 1: Resistor Colour Codes
o
o
o
siliconchip.com.au
No.
4
1
Value
10kΩ
470Ω
4-Band Code (1%)
brown black orange brown
yellow violet brown brown
5-Band Code (1%)
brown black black red brown
yellow violet black black brown
August 2010 39
the programming pins are connected
across LEDs. Install the hex file (available from the SILICON CHIP website)
into its flash memory and don’t forget
to set the fuse bits, which are documented in the accompanying text file,
otherwise it may not work correctly.
6-WAY BARRIER TERMINAL STRIP
Final assembly
–
4148
+
4004
4148
88
COM
girT
TRIG
RESET
t es eR
GND
DNG
NC
NO
COM
NC
10180140
+
0102 ©
NFD-8021BS
8888
4148
4148
+
4004
DC
INPUT
SOCKET
(REAR)
NFD-8021BS
r emiT latigiD pih C no ciliS
NO
Fig.3: here’s how to wire the DC input socket and connect the external
Trigger & Reset inputs plus one pole of the relay to the 6-way barrier
terminal strip. Alternatively, if you don’t need the Trigger & Reset inputs,
you can connect both relay poles or you can use a second terminal strip.
As shown in Fig.2, this is installed
with its body flat against the PC board
(domed lens facing upwards). This
simply involves bending its leads
down by 90° about 3mm away from
its body before soldering it in position.
The three screw terminal blocks
(CON1-CON3) can now be soldered
in. Note that CON1 & CON2 must be
orientated so that their entry holes face
away from the relay. Similarly, CON3
should be installed with its entry holes
towards the adjacent edge of the board.
Check that they sit flush against the
board before soldering their pins.
Follow these with the relay, which
again should sit flat against the board.
After that, fit the buzzer, which must
be installed with its positive pin (indicated on the body) towards CON4.
The 2-pin polarised header (CON4)
can then go in – install it with its
40 Silicon Chip
locking tab towards the adjacent edge
of the board.
The 8MHz crystal and the 7805T
regulator are next. The crystal can go
in either way around while the 7805T
must go in with its metal tab towards
the adjacent edge of the board. Solder
the regulator’s leads, then bend it away
from the displays at a 45° angle so that
it doesn’t later impinge on display
visibility.
Microcontroller
You can now complete the board
assembly by installing the microcontroller. If it came pre-programmed (as
in a kit), all you need to do is make sure
its pins are straight and then push it
down into the socket with the correct
orientation.
If you need to program it first, you
must do it out-of-circuit as some of
The PC board is designed to fit in
a Jaycar HB-6246 polycarbonate case
with clear lid. We have also produced
a slightly modified board to suit the
similar Altronics H-0324 box (both
board patterns can be download from
the SILICON CHIP website).
Basically, you can customise the
connections on the box to suit your
needs. For example, if you want to
power the unit from a battery you may
decide to install an on/off switch to
avoid draining the battery when you
are not using it. And if you don’t need
the trigger and reset connections (ie,
you will be using the remote control
only), then you won’t need to run leads
from CON3 to an external connector.
As shown in Fig.3, we used a 6-way
chassis-mount terminal barrier to terminate the trigger/reset inputs and one
relay pole. A 2.1mm chassis-mount
DC socket mounted on one side of the
case is used for the power input. This
is connected to a polarised header
plug via two short leads (red for positive, black for negative) which is then
plugged into CON4.
The second relay pole was not
connected in our prototype. If you do
want to connect it, there is room on
the other (bottom) side of the case for
a second terminal barrier. We left the
bottom clear so that the completed
unit can rest on a flat surface but if we
were mounting it on a wall, the bottom
would be the logical location for the
connections to be made.
Assuming you want to assemble
your timer as shown in Fig.3, you will
need to drill eight holes along the top
edge of the box and one hole in the
lefthand side for the DC connector.
Fig.4 shows the drilling details. This
can either be photocopied and the sections used as drilling templates or you
can download the diagram from the
SILICON CHIP website and print it out.
You can attach the templates using
adhesive tape. Make sure they are
correctly positioned before drilling
the holes (the terminal barrier and DC
socket must both sit low enough to
clear the PC board when it is installed
siliconchip.com.au
in the case). Drill small pilot holes at
each location first, then enlarge them
by stepping up to the correct drill
size. Finally, deburr each hole using
an oversize drill.
The terminal barrier can now be
pushed through and secured using
two M3 x 20mm machine screws (one
at either end). Use a flat washer under
the head of each screw and a spring
washer and nut inside the case. The
DC socket can then be installed but
you will have to discard its washer as
the box is too thick for it. Do the nut
up firmly so it can’t rotate.
4.75
9.5
A
9.5
B
4.75
9.5
B
9.5
B
B
9.5
B
9.5
A
B
13
BASE OF JAYCAR HB-6246 ENCLOSURE – LONG SIDE
CL
FULL ENCLOSURE
MEASURES
115 x 90 x 55
HOLES A = 3.0mm DIA, HOLES B = 3.5mm DIA.
CL
Wiring
It’s now just a matter of completing
the wiring as shown in Fig.3, using
medium-duty hook-up wire. Cut the
wires to the lengths specified in the
parts list, then strip and tin the ends
before making the connections.
The leads to the 6-way terminal barrier are soldered to the various tags,
while the supply leads are crimped
and soldered to the polarised header
pins. These pins are then inserted
into the plastic header shell (watch
the polarity).
Before soldering the supply lead to
the DC socket, it’s a good idea to test
the current drain. To do this, you will
need a 9-15V DC supply, a multimeter
and some alligator clip test leads.
It’s then simply a matter of applying power with your multimeter (set
to mA) connected in series with one
of the supply rails. The current drain
should be in the region of 10mA. If it’s
significantly more, disconnect the supply and check for faults. If it is close to
(or exactly), zero then you may have
the supply leads transposed.
Once the wiring to the terminal barrier and the DC socket is completed,
the board can be installed in the case.
To do this, first attach an M3 x 15mm
tapped Nylon spacer to each corner of
the board using M3 x 20mm machine
screws. Wind the spacers all the way
onto the screws but don’t tighten them
– you must still be able to easily rotate
the screw head.
Next, attach the three leads to screw
terminal block CON3 (it’s much more
difficult to attach them once the board
is in place). Having done that, route the
soldered leads from the barrier terminal strip and the DC socket to either
side of the case (see Fig.3), then lower
the board into place until its mounting
screws meet the integral pillars.
siliconchip.com.au
ALL
DIMENSIONS
IN
MILLIMETRES
C
11
BASE OF JAYCAR HB-6246 ENCLOSURE – SHORT SIDE
HOLE C = 8mm DIA.
Fig.4: these diagrams can be copied and used directly as drilling templates
for the plastic case. Note that hole “C” is best made using a pilot drill and
then enlarging it to size using a tapered reamer.
The assembly can now be completed
by tightening the four screws to hold
the board in place, connecting the appropriate wires to the relay terminals
(either CON1 or CON2, or both) and
plugging the power connector into
CON4. Check that the positive supply
lead is closest to IC1 (this lead should
also go back to the centre terminal of
the DC socket).
Finally, push any excess wire down
under the board through the gaps on
either side and install the lid (with
the neoprene seal pressed into its
channel).
Waterproofing
Since the box is IP65 rated (ie,
water and dust proof), it’s possible to
waterproof the timer if you wish to use
it outdoors. However, because of the
holes drilled for the barrier terminal
strip and the DC socket, our prototype
is more splash-proof than waterproof.
If you like, you can apply silicone sealant to the inside of both connectors to
improve this.
The difficulty of properly waterproofing the timer is that all connections must be made via IP65-rated
connectors or cable glands. Perhaps
the easiest method is to install a small
cable gland on one side of the box and
pass a multi-core cable through it, carrying power and all the signal lines.
With an 8-way cable, it’s possible to
run the power, the two trigger wires
(ground can be shared) and up to four
relay connections.
Getting the remote working
To use the Digital Timer you will
need a universal infrared remote control which is set to a standard Philips
RC5 remote control code (this is the
default in many cases).
The green LED in the timer will flash
whenever an IR signal from the remote
control is detected. To test whether
you are using the right code, simply
point the remote at the timer (make
sure it is switched on) and press some
of the numeric buttons.
The corresponding numbers should
appear on the timer’s 7-segment displays.
If they don’t, either the timer has a
fault or the remote control is set to the
wrong code. Try setting the remote to
other Philips codes until you find the
correct one. For example, the Digitech
remote control pictured in this article
August 2010 41
A barrier terminal strip
on one end of the case can
be used to terminate the
external trigger & reset
inputs plus one set of relay
contacts, or you can use
it to terminate both sets of
relay contacts. Don’t forget
the ratings sticker.
(Jaycar Cat. AR-1726) should be set to
TV code 103.
Once it’s working and the correct
numbers appear, press the Power/
Standby button on the remote to clear
the display.
Adjusting the settings
Before putting the timer to work,
you need to configure it for your application (unless you just want to use
the default settings). The procedure
is as follows:
(1) Default settings: for the first set of
options, refer to Table 3. Decide on the
default settings you want, then enter
the corresponding digits in turn, from
the first digit through to the sixth.
When you have entered all six digits,
press the mute button on the remote.
The display will now blank and
your settings are saved. They can be
updated at any time by repeating the
above procedure.
An example will make this clearer.
Let’s say that you: (1) want the buzzer
to sound at the end of the timing period, (2) want the relay to turn on at
the end of the timing period (ie, for
the duration of the alarm period), (3)
want the trigger input active high,
(4) the reset input active high, (5)
the unit to count up when externally
triggered and (6) the alarm period set
to four minutes. In that case, it’s just
a matter of pressing 1, 2, 2, 2, 0, 4 on
Fig.5: these labels should be attached inside the lid and to the panel above
the barrier terminal strip using silicone sealant.
the remote in sequence, followed by
the Mute button.
(2) Adjusting the brightness: the next step
is to set the display brightness. This is
done using the Volume Up (increase
brightness) and Volume Down (decrease brightness) buttons. There are
32 possible levels and the brightness
can be changed either when the timer
is running or while setting the timing
period.
Initially, you can just press some
random number buttons to get digits
on the display and adjust the brightness from there. That done, clear
the display by pressing the Power/
Standby button then press the Mute
button. Each time the device is powered up after this, it will automatically
load the set brightness level.
You can use the same procedure to
change it again later, if necessary.
(3) Automatic timing: the final setting
is the timing period you want programmed in for automatic triggering.
Enter the time using the keypad, keeping in mind that the first two large
Table 3: Setting Up The Presets
Digit
Setting
0 means
1 Means (Default)
2 Means
First
Buzzer
Always off
On during alarm period
N/A
Second
Relay
Always off
On while counting
On during alarm period
Third
Trigger input
Disabled
Active low
Active high
Fourth
Reset input
Disabled
Active low
Active high
Fifth
When triggered
Count up
Count down
N/A
Sixth
Alarm period
Enter number of minutes (0-9)
42 Silicon Chip
siliconchip.com.au
Controlling Mains Or High-Current DC
The relay used in this project is rated at 30VDC/2A and 125VAC/1A. However,
as used here, it should not be used to switch any AC voltage higher than 24V.
DO NOT under any circumstances use the on-board relay to switch 230V AC
mains appliances – that would be quite dangerous.
To switch a mains load, you will need to use the on-board relay to trigger an
external mains-rated relay (mechanical or solid state). This must be mounted
and wired in a safe manner. Don’t attempt to do this unless you know exactly
what you are doing and are experienced with 230VAC wiring! You can also
use an external relay if you need to switch high-current DC.
If you plan on adding an external relay, it’s best to use one with a 12V DC
coil and run the Digital Timer from a 12V DC supply. It is then simply a matter
of connecting the timer’s 12V rail to one of its internal relay’s COM contacts
(either on CON1 or CON2). The positive side of the external relay’s coil is then
connected to the corresponding NO contact, while the negative side goes
directly to the negative output of the 12V DC supply. A reverse-biased diode
should be connected across the external relay’s coil to quench switching spikes.
Now when the internal relay switches on, it supplies power to the external
relay’s coil and it too switches on. The contacts of the external relay can then
be used to switch on a mains device or supply power to a high-current DC load
(provided these contacts are adequately rated).
Keep in mind that your 12V DC supply must be able to provide at least 100mA
for the Digital Timer itself plus the rated coil current of your external relay. A
300mA plugpack supply should do the job quite nicely.
digits represent the number of hours,
the next two the number of minutes
and the two smaller digits the number
of seconds. Then press the “1-” key
on the remote (the one normally used
to enter 2-digit TV station numbers).
This programmed time will now
be placed in memory and recalled
whenever the timer is started via its
trigger input.
Using the timer manually
To use the timer manually, simply
enter the timing period you want using the keypad, then press either the
“Channel Up” or “Channel Down”
button. If you press “Channel Up”,
the display will start at 00:00:00 and
count up to the timing value you have
entered. Alternatively, if “Channel
Down” is pressed, the display will start
at the timing value you have specified
and count down to 00:00:00.
When the timing period ends, the
alarm period will begin (unless it has
been set to 0 minutes in which case the
timer will immediately reset). When
the alarm period expires, the unit
resets automatically or you can press
the Power/Standby button to reset it
before it expires.
If you want to stop counting simply
press the remote’s Power/Standby button and the device will reset and go to
siliconchip.com.au
Charlieplexing
Earlier in the article, we referred to
the method used to drive the LED
displays as “charlieplexing”, which is
really just a special form of multiplexing. If you want to know more about
charlieplexing, refer to our feature
in the forthcoming September 2010
issue of SILICON CHIP.
standby mode. You can also pause the
timer by pressing the pause button (assuming your remote control has it – it
is actually a VCR function). To resume,
press play (another VCR function).
Note that the buzzer is quite audible but not particularly loud once it
is sealed inside the box. If you want
to make it louder, drill some small
holes in the lid immediately above the
buzzer’s location.
Finally, Fig.5 shows some labels
which should be affixed to the inside
lid of the case and to the panel immediately above the barrier strip terminal. These indicate the power supply
requirements (and polarity) and also
indicate the maximum voltage ratings
for the relay contacts.
That’s it! We are sure you can think
SC
of many uses for this project.
Helping to put you in Control
Control Equipment
Relayduino
The KTA-225 is a
new version of our
popular Arduino
compatible USB controller featured in SC
April 2010. Features ASCII Commands, 8 Relays, 8 Flexible I/O
(Digital Input or Analog Input (05V/4-20mA). Windows/Mac/Linux
compatible . $135+GST
Rolls Of Heatshrink We now
have rolls of
heatshrink available. Colours of red, black, blue, yellow, green, white and clear available
Diameters from 1.5/0.75 to
50/25mm From $75.00 +GST
Industrial Grade
Switches and Indicators We now have
a selection of 22 mm
diameter industrial
switches. Fitted with
NO+NC contacts. Screw Connections.
Color Black, Red, Green, Yellow and
Blue From $9.95 +GST
DIN Rail Enclosure An ABS plastic enclosure that
can be bolted to a
panel or mounted
on DIN rail
Size: 145x90x40mm
From $12.95 +GST
70W Brushed DC
Servo Motor CNC
Kit This 3-axis CNC
kit contains all the
drives, motors
power supplies to
build or retrofit a mill or lathe for
CNC work. $929+GST
Isolated RS232 to
RS422/485 Converter A high performance RS-232 to
RS485/422 converter.
Features both 2.5KV opto-electrical
isolation and internal power isolation
$75+GST
Ph: 03 9782 5882
New, Easier to Use Website
www.oceancontrols.com.au
August 2010 43
|