This is only a preview of the July 2005 issue of Silicon Chip. You can view 37 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. Articles in this series:
Items relevant to "Remote-Controlled Automatic Table Lamp Dimmer":
Items relevant to "Lead-Acid Battery Zapper":
Items relevant to "PICAXE In Schools, Pt.3":
Articles in this series:
Purchase a printed copy of this issue for $10.00. |
Plug in any lamp – dim up or down remotely and automatically
24 Silicon Chip
24 Silicon Chip
siliconchip.com.au
Remote
Controlled,
Automatic
Table Lamp
Dimmer
by John Clarke
Features
• Remote control operation
• Uses commercial pre-programmed remote control
• On and off control with soft start for long lamp life
• Fast and slow dim up and dim down control
• Automatic dim up and dim down
• Programmable minimum and maximum dimming levels
• Programmable automatic dimming rate
• Dimming level and dimming rate kept even after a blackout
• Remote control acknowledge indication
• Automatic dimming indication
• RFI suppression
•
Four remote control codes available
siliconchip.com.au
JJuly
2005 25
uly 2005
83
July
2005 25
D
o you want more features from a plug-in lamp than room. It provides such a slow reduction in light over a period of time, that the children probably won’t even notice
just boring old on and off?
before they fall asleep!
This multi-featured Automatic Lamp Dimmer
Automatic dimming can be set from a minimum of 10
provides total control via an infrared remote. Use it for
mood lighting, home theatre lighting or even as a night light. seconds through to 990 seconds (16 minutes and 30 secWall-mounted lamp dimmers (ie, those that control the onds), in 10 second increments. The maximum time period
fixed lamps in homes) are common, used to great effect to should be more than enough for most automatic dimming
applications.
adjust the brightness levels to suit the occasion.
The Automatic Lamp Dimmer is housed in a modified
However, it is not very common to find a dimmer for a
table lamp or other portable lamp. But these lamps can also 4-way mains power board. This provides a robust and
professional-looking case. Three of the four outlets are
benefit from being able to be dimmed.
For example, you may wish to dim the lights in your not used, to provide sufficient space to house the dimmer
lounge room and you can do this with the dimmer that circuitry. A cover blocks off the three unused mains outlets
and prevents these from being used.
controls the main ceiling lights.
Two indicaUntil now,
Specifications
tor LEDs prothough, you’ve
• Fast up and down dimming … 2 seconds from one extreme to the other
trude through
had only on
• Slow up and down dimming … 12 seconds from one extreme to the other
the cover. One
and off control
• Switch on rate … 340ms soft start
shows when
of any other
• Automatic dimming rate… adjustable from 10 seconds to 990 seconds
the dimmer is
lamps.
• Minimum brightness setting for automatic dimming … adjustable over full dimming range
receiving an inFor a home
• Maximum brightness setting for automatic dimming … adjustable over full dimming range
frared remote
theatre room,
• Maximum dimming steps … 125
control signal,
being able to
• Phase control range … 14° maximum brightness, 158° minimum brightness
while the secdim the ancil• Lamp rating … 40W minimum to 150W maximum
ond shows that
lary lights is
the dimmer is
important if the
automatically dimming (handy if a long dim time is set). The
full visual impact of the large screen is to be realised.
In fact, if you only use ancillary lighting that plugs into infrared remote signal is received by the internal circuitry
the Automatic Lamp Dimmer, the lighting can be dimmed via a red bezel mounted in the end of the power board.
automatically over the period of a few seconds, resulting
The infrared remote
in a “professional” theatre experience.
A commercially available, pre-programmed handheld
And as the dimmer functions are remote controlled, all
the brightness adjustments can be made from the comfort remote control operates the Automatic Lamp Dimmer.
These controllers can operate hundreds of different types
of your lounge chair. Bring on the popcorn and choc-tops!
As a night-light, the Automatic Lamp Dimmer can be set to of TVs, VCRs and satellite receivers by setting a code to
slowly dim from full brightness (or from a dimmed brightness) suit the device concerned.
To operate the Automatic Lamp Dimmer, you can select
down to a preset level over an extended time period.
The slow dimming function is ideal for use in a child’s one of four programming codes. The idea is to use a code
Our new Automatic Lamp Dimmer is housed in a 4-way power
board, modified to suit the inclusion of the PC board. Three of the
outlets are not used and are blanked off by the “front panel”. At
right is the commercial infrared remote control we used, a “Big 3”
from Jaycar Electronics. Most “universal” remote controls would
be suitable for use with the Automatic Lamp Dimmer and can
probably replace a couple of your existing remotes into the bargain!
26 Silicon Chip
siliconchip.com.au
that does not operate any of your other devices that are
used in the same room.
The remote control can also be used to operate your other
remote control devices such as TV, VCR and cable/satellite
receivers. More elaborate pre-programmed remote controls
will operate DVD players and amplifiers as well.
As mentioned, the Automatic Lamp Dimmer can be used
to control the light in several ways. Simple on-and-off
switching of the lamp uses the mute button on the remote
control. Press this and the lamp switches on; press again
to switch off.
Think of this operation as similar to the sound muting
on a TV set – a press of the mute switch turns the sound
off and a second press sets the sound back to normal.
Soft starting
When the lamp is switched on, it may appear that it is
instantly switched to full brightness. However, in reality
it is soft-started. Soft starting means that power is applied
to the lamp gradually. This reduces the very high surge
current flow that would otherwise occur due to the lamp’s
filament being cold. Allowing the lamp filament to warm
up more slowly prevents most of the thermal shock most
lamps experience, resulting in a much longer life.
The soft start brings the brightness of the lamp up automatically from off to full brightness in 340ms. That’s just
a third of a second, so in all probability you won’t even
notice the difference between this and normal off/on action.
By default, the lamp must be soft-started when using the
remaining controls for the Automatic Lamp Dimmer. This
is because the brightness is brought up slowly using the
dimming buttons on the remote control.
There are three types of dimming available for the
lamp.
(1) Fast dimming, using the channel up (+) and the
channel down (-) buttons. Press and hold the channel (+)
button and the lamp will be dimmed up from fully off to
fully on in about two seconds. You can stop the dimming
+340V
(a)
0V
10ms
0
30ms
20ms
TIME
NOTE: THIS CIRCUIT CAN BITE!
Never plug this project in to mains power
without the case fully assembled.
Contact with components could be lethal.
at any brightness level by letting go the button. Similarly,
the channel (–) button will dim the lamp from fully on to
fully off over two seconds.
(2) Slow dimming is available with the volume up (+) and
volume down (-) buttons. With these buttons, it takes some
12 seconds to fully dim the lights from off to on or on to
off, again with the position holding if you let go the button.
Slow dimming allows you to select precise brightness levels
for the lamp if that’s something you need to do.
(3) Automatic dimming is initiated with the operate (or
standby) button. This is usually the red button and it has
a split circle and vertical stroke icon to indicate a power
switch.
During dimming, the lamp will dim up or dim down
with 125 steps in brightness level from full on to full off
over the automatic dimming sequence. Dimming will
alternate between dimming up to dimming down with
each pressing of the operate button at the end of the dimming sequence.
The 125 steps means it is not easy to detect any change
in brightness level, so the effect is a smooth up or down
dim.
At any stage during the automatic dimming sequence,
the other dimming or on/off controls can be used to stop
the dimming sequence and begin the operation selected by
the appropriate button.
Two preset dimming levels, high and low, can be set to
suit your particular application. A preset high dimming
level sets the brightness reached when automatically dimming up and a preset low level sets the brightness reached
when automatically dimming down. The preset brightness
levels can be set to any value required.
For example, the preset low level would be set to a low
glow from the lamp filament, suitable for sleeping. Or it
might be set higher, for home theatre use. Similarly, the
preset high level could be set anywhere you desire.
The preset levels are selected by setting the required
+340V
ZERO VOLTAGE DETECT,
BRIGHTNESS COUNTER RESET
–340V
127V
82V
+340V
10ms
0
30ms
20ms
–340V
–340V
0
FIG.1 PHASE CONTROL
Fig. 1 depicts phase control of an alternating voltage.
Fig.1a shows the normal AC waveform (ie, that from
the power point). Fig.1b shows just what happens if the
power is applied for half of each half cycle.
siliconchip.com.au
TIME
–127V
MINIMUM
BRIGHTNESS
PHASE
MAXIMUM
BRIGHTNESS
PHASE
TIME
0
20ms
–82V
MAXIMUM
BRIGHTNESS
PHASE
(b)
0V
10ms
0V
14
158 180 194
MINIMUM
BRIGHTNESS
PHASE
338 360 14
DEGREES
20
220 250
0 20
0 20
220 250
BRIGHTNESS
COUNTER VALUE
Fig.2 shows the relative trigger points and corresponding
voltages used in the automatic dimmer. A full explanation
of these is in the text.
July 2005 27
brightness level with the slow dimming controls - the level
set during slow up-dimming will become the high preset
level and the level set during slow down – dimming will
become the low preset level.
The levels are only set during slow dimming, not during
fast up and down dimming. If you want to set the preset
levels for automatic dimming, you set them using the
slow dimming, then press the “operate” button followed
by the “0” button on the remote control. The “0’ button
tells the Automatic Lamp Dimmer to store the new high
and low brightness levels that were selected during the
slow dimming.
This is a two-stage operation for storing the required
preset brightness level. It prevents any dimming made
using the slow dimming controls from becoming the new
preset brightness level unless it is stored using the “0”
button during automatic dimming.
For obvious reasons, the low brightness preset should not
be set at a higher level than the high preset level nor vice
versa. If this happens, automatic dimming will not work.
The rate of automatic dimming is programmed during automatic dimming using the number buttons on the
hand-held remote. One or two numbers can be entered,
ranging from “1” through to “99”, which correspond to 10
seconds per digit. So, for example, entering a “1” will cause
the automatic dimming to occur over a 10 second period.
Entering “10” will set a 100 second (1 minute 40 seconds)
automatic dimming period and so on.
Note that the number “0” cannot be entered first because
that is used for preset brightness storage. “0” can be entered
as the second digit for the automatic dimming rate.
Once the automatic dimming rate and the preset brightness level values are stored, they will remain with these
settings unless changed again. The settings will remain
even if there is a power blackout or if the Automatic Lamp
Dimmer is switched off at the mains.
The first time power is connected to the Automatic Lamp
Dimmer, the lamp will initially be set to off.
Acknowledgement
Whenever the Automatic Lamp Dimmer receives an
infrared remote control signal, the acknowledge LED will
flash on and off at a rapid rate. It will do this for any remote
control code whether it is the correct one or not.
During automatic dimming, the auto dimming LED will
flash at a one-second rate. This is very useful when the
dimming rate is set to a long period, since the LED then
indicates that the sequence has started even though it is not
noticeable by the dimming of the lamp. It also indicates that
the preset dimming level can be set and/or the dimming
rate can be programmed, if required.
If a number is pressed, the auto dimming LED will flash
rapidly for around 0.5 seconds to show that the number
or dimming level has been recorded. The second number
can be entered when this rapid flashing of the LED has
stopped.
Also, it is possible to enter the “0” to record the dimming
levels, then two other numbers to record the dimming rate
if both values are to be changed. Alternatively, just the dimming rate (eg, 25) can be entered or just the dimming preset
level using the “0” can be entered on their own.
Phase control
The lamp brightness is controlled by a phase control
circuit.
When a lamp is driven from the full mains supply, the
filament is supplied with current from 240V AC. 240V is
the “rms”, or root-mean-square, value of the AC waveform.
Incidentally, it equates (in a resistive load such as an incandescent load) to exactly the same amount of applied power
as would be applied by a DC (direct current) source. Put
another way, a light globe will be exactly the same bright15
CRYSTAL
TIMEBASE
START
NEUTRAL
RB0 (6)
ZERO VOLTAGE
NEGATIVE EDGE
DETECTOR
16
Fig.3: the block diagram shows how
the neutral line is used for setting
the various trigger points used in
the dimmer.
LOCK
CLOCK
RESET
ACKNOWLEDGE
λ
LED1
RA1 (18)
λ
RA0 (17)
LED2
TIMER 1
X1
20MHz
BRIGHTNESS
COUNTER
0–250
COMPARATOR
BRIGHTNESS
LEVEL REGISTER
& OPERATION
RB1-2-3
(7,8,9)
TRIAC
GATE
TRIGGER
20–250
AUTODIM
RB5 (11)
RB6 (12)
RB7 (13)
IR
SIGNAL
λ
DECODING
RB4 (10)
IR MONITOR
TIMER 1
IC2
AMPLIFIER
DEMODULATOR
28 Silicon Chip
siliconchip.com.au
(+5V)
LEDS
470 µF
16V
K
A
LED1
470Ω
λ
K
A
1k
IC2
LED2
λ
K
A
100nF
OSC1
RA0
OSC2
2
100nF
100 µF
16V
RB7
2
1
10
IC2
IR RX
SHIELD
BOX
ZENER DIODE
–
SC
2005
+
RB4
A
A1
TRIAC1
BT137F
16
100nF
250VAC
(CLASS X2)
K
D1
1N4004
A
A2
X1 20MHz
15
L1
75 µH
RB0
11
LK1
12
LK2
13
LK3
MAINS
INPUT
N
N
E
CODE
SELECT
LINKS
E
1.5M 1W
6
Vss
5
BT137F
4.7nF
FR102, 1N4004
A
220nF
250VAC
(CLASS X2)
1k
1W
MAINS
OUTLET
33pF
A
RB6
λ
K
G
33pF
RB5
3
–
D2 FR102
39Ω
IC1
PIC16F628A
-20P
3
1
ZD1
5.6V
1W
2.2k
4
14
Vdd
MCLR
7
RB1
8
RB2
18
9
RA1
RB3
17
A
+
K
AUTOMATIC LAMP DIMMER
A2
A1
G
WARNING: COMPONENTS & WIRING
ARE AT 240V MAINS POTENTIAL
WHEN THE CIRCUIT IS OPERATING.
CONTACT MAY BE LETHAL!
Fig.4: here is the complete circuit. A PIC16F628A handles most of the hard work. Please note the warning above!
ness powered by 240V rms or 240V DC.
The peak value to which the AC voltage rises is significantly more than the rms value – in fact, it’s exactly 1.4142
times – or about 340V. (It’s about 340V and not exactly 340V
because 240V rms is what the electricity supply authority
aims for – but it can be ±5% so could actually be anywhere
from about 228V to 252V).
For a 240V AC supply, this means that the voltage will
swing from 0V up to around +340V before dropping to zero
again. The voltage then swings negative to –340V before
going back up to 0V again. The whole process repeats in a
sinusoidal waveform at a frequency of 50Hz.
Why 50Hz? Because that is the carefully-controlled but
again average frequency at which the power is generated
back at the power station.
If the voltage is only connected to the lamp at say when
the voltage is at 340V, the supply to the lamp and hence
its brightness will be greatly reduced as shown in Fig.1b.
This is because power is only applied to the lamp for half
the time – the first part of the “cycle” is wasted.
The supply to the lamp is switched off again when the
voltage drops to zero. This happens because we are using
a Triac to do the switching and Triacs turn themselves off
when the voltage (or more correctly the current) drops to
zero – see Fig.1.
This method of lamp dimming is called phase control. By
altering the point in the cycle where the voltage is applied
to the lamp, we can provide dimming from fully off through
to fully on. Fully off is where the lamp is never provided
with current, while fully lit is when the voltage is applied
to the lamp at the beginning of the mains cycle. Dimming
levels in-between the full brightness and the fully off range
can be set by switching the lamp on at a time other than at
siliconchip.com.au
the beginning of the mains cycle.
Circuitry for the Automatic Lamp Dimmer uses phase
control and divides up the each half of the mains waveform into 250 discrete sections – 250 between the 0° to
180° positive half cycle excursion and 250 from the 180°
to 360° negative half cycle.
Each discrete section corresponds to about 0.72°, as
shown in Fig.2. The two extremes over which the circuit
will dim the lights are from 14° through to 158°. The 14°
setting gives maximum brightness (ie, lamp fully on) and
the 158° provides the minimum brightness (lamp fully off)
phase setting.
Why not 0° and 180°?
The reason for limiting the dimming range between 14°
and 158° is to ensure that the lamp is not switched in the
previous half cycle or into the next half cycle. This could
happen with a wider dimming range because the zero
voltage crossing detection has a degree of uncertainty due
to filtering that produces phase changes. Tolerances in the
filter components will alter the phase and hence the zero
voltage detection point in the mains waveform.
Block diagram
Fig.3 shows the general arrangement of the automatic
dimmer circuit. Most of the operation, with the exception
of the infrared amplifier demodulator (IC2), is performed
by a PIC16F628A microcontroller, programmed to perform
phase control (IC1).
It accepts inputs from the mains and from IC2 and provides an output to drive the gate of a Triac.
The mains Neutral input (pin 6) provides the phase information. Each time the voltage goes negative, the microJuly 2005 29
Timer 1 in increments of 800ns either faster
or slower over each 10ms period. Should the
100nF
100 µF
A
brightness counter alter from its 250 count at
ZD1
D2
REMMID OTUA
each zero crossing, Timer 1 is adjusted to com33pF
L1
pensate for the difference.
By remaining in lock, the lamp filament will
IC2
X1
IR RX
TRIAC1
)tuo( A
produce a rock steady level even at very low
CABLE
CS
33pF
4.7nF
TIE
brightness levels. Without the locking, the
1k
1.5M 1W
LED2
lamp could have a slight flicker under phase
470Ω
220nF
control.
4004
250V AC
1k 1W
N
LED1
D1
470 µF
The infrared signal is detected by IC2, an
amplifier/demodulator.
This converts the reTO POWERBOARD
TO POWERBOARD
NEUTRAL
SOCKET ACTIVE
mote control’s modulated 38kHz pulses into
digital levels that can be read by the IR monitor.
Fig.5: all components are mounted on a single PC board which in turn
Decoding into digital levels occurs at the rate
is housed inside the powerboard case. Below is a same-size photo of
set by the Timer 2 which is also locked to the
the board from above. Note that the Triac (centre of picture) is bent
mains frequency.
over about 40° to allow it to fit inside the case.
If the mains frequency happened to drift too
far off 50Hz, then the remote control decoding
would not operate correctly and would result
in loss of remote control operation. Fortunately,
the mains frequency is well within 5% of 50Hz
and with this variation the remote control will
still operate the Automatic Lamp Dimmer.
The IR monitor signal is compared with
known codes in the decoding section. Input
pins 11, 12 and 13 select the particular code
that is used, with four different codes available.
When the selected, stored code is the same as
controller senses this and so is provided with a reference the received remote control code, the brightness register
position for the phase of the mains waveform.
is altered in response to the particular button pressed on
The zero-voltage negative-edge detector resets the bright- the remote control. For example, if slow down-dimming
ness counter whenever the voltage is zero. After resetting, is selected, the brightness level register is increased to
the brightness counter is incremented by 1 every 40ms from decrease lamp brightness.
0 up to 250. By the time the count reaches 250, some 10ms
The comparator monitors both the brightness level reghas elapsed which is half the wavelength of the mains cycle, ister and the brightness counter. When they are equal, the
the zero voltage crossing point for the second half cycle.
comparator provides a pulse to drive the Triac gate.
The 40ms brightness counter is clocked from timer 1,
If the brightness level register is a low value, this value
driven by a 20MHz crystal time base. It is important that will be equal to the brightness counter early in the mains
the brightness counter reaches the count of 250 exactly at cycle to provide a bright lamp. If the brightness level register
the zero crossing point.
is a larger value, the value will be equal to the brightness
This may not happen unless Timer 1 is locked to the counter later in the mains cycle and so the lamp will be
mains. Without locking, the brightness counter could be dimmer.
anywhere between 225 and 275, depending on the mains
frequency. (Over time, the average mains frequency is held The circuit
very accurately at 50Hz but in the short term can drift a
Considering the complexity of the Automatic Lamp Dimlittle).
mer operation, there is not too much in the actual circuit itself.
We therefore lock the counter to the mains by adjusting This is because the complexity is all taken care of within the
100nF
250V AC
39Ω
FR102
2.2k
ACTIVE OF POWER
BOARD CORD
IC1 PIC16F628-20P
100nF
5040DACJ
SHIELD CAN MADE FROM
USB TYPE B SOCKET
The modified Powertech powerboard before the insertion of the PC board. Here we’ve cut away the bus bars, removed part
of the plastic moulding and drilled the holes for the two LEDs and the infrared signal bezel (far right).
30 Silicon Chip
siliconchip.com.au
And here’s another view of the PC board,
this time at an angle to show the relative height
of the components. In this shot, the two LEDs can be
seen proud of the top of the 100nF capacitor (yellow,
back of pic) to allow them to poke through the top of
the powerboard and the “panel”.
microcontroller (IC1). Apart from this IC, there is only the
infrared decoder (IC2), a Triac, several diodes, a crystal and
an inductor, plus a few resistors and capacitors.
The Triac is connected between the mains Active and the
lamp via an inductor (L1). This inductor, in conjunction
with the 100nF 250VAC capacitor, provides suppression
of electromagnetic radiation caused by the Triac switching. The inductor core is made from iron powder, which
is lossy at high frequencies (above about 1MHz) and so
prevents (or at least minimises) EMR from being radiated
via the power wiring.
Power for the circuit is derived from the mains supply
via a 220nF 250VAC mains capacitor and a 1kW 1W resistor.
The capacitor and resistor act as a current limiting impedance for the following zener diode, ZD1.
The supply is derived in two steps. Firstly, supply is
limited to 5V as diode D1 conducts when the mains voltage
goes below the ground supply, pulling the anode of ZD1 to
some 0.6V below the ground supply. This causes the zener
to clamp the supply voltage to 5V (5.6V-0.6V).
Secondly, when the mains swings above the ground
supply, current can flow through the forward-biased zener
diode and into the 470mF supply decoupling capacitor to
top up the supply.
Apart from the 470mF supply smoothing capacitor, both
IC1 and IC2 have 100nF capacitors across their supply to
provide high frequency decoupling. IC2 is further decoupled with a 100mF capacitor.
Power for IC1 is supplied between pins 14 and 5. Pin
4 is a brownout input – should the supply drop below
about 4V, the IC will be held reset until the supply voltage
rises above the 4V level. This brownout reset ensures the
microcontroller will operate correctly after the brownout
has ended.
Infrared code selection inputs are at the RB5, RB6 and
RB7 pins. These pins can be left open or tied low with the
linking to ground. When the microcontroller is reset after
power is applied or after a brownout, the RB5, RB6 and
RB7 inputs are pulled high via internal pull-ups within
IC1. A check is made to determine whether the pins are all
held high or if one is tied low via one of the links. This sets
the remote control code that will operate the Automatic
Lamp Dimmer. After this, the RB5, RB6 and RB7 input
pull-up resistors are deselected and these inputs are set
as low outputs.
We need to set the RB5 – RB7 inputs as outputs to prevent them from floating and drawing excess current from
the supply. The removal of the pull-up resistors from the
inputs also removes the internal pull-up for RB0. This input
detects the zero voltage crossing of the mains via a 1.5MW
resistor and 4.7nF filter capacitor. The pull-up resistor is
not required for the zero voltage detection since its value
can vary from part to part, making the filter phase response
too variable. This could produce an incorrect detection
of the zero voltage crossing and causing faulty dimming
characteristics such as flashing of the lamp.
IC1 outputs RB1, RB2 and RB3 drive the gate of Triac1 via
a 39W resistor and fast diode D2. Gate current is limited to
around 50mA because of the resistor. The diode prevents
the 0.7V present on the gate when the Triac is switched on
from feeding back into IC1.
Outputs RA1 and RA0 drive the “acknowledge” and “auto
dim” LEDs respectively. The Acknowledge LED is driven
with short bursts of high levels from RA1 and the 470W
Now the new PC board has been placed and connections made back to the bus bars as required. What is not obvious here
is that those connections should not just rely on the soldered joint; the wires should be twisted around the bus bars first.
siliconchip.com.au
July 2005 31
inside a shield to protect it as much as possible from external fields.
Construction
To open the
powerboard, you’ll
need a tri-wing screwdriver
bit. They’re commonly available
but if you don’t have one on hand,
do what we did and grind the end of an
old screw-driver blade into a triangle the
right size. Don’t knock it: it works!
resistor sets the current for sufficient LED brightness. The
Auto Dimming LED is driven with slightly wider pulses
and so can be driven with a lower current using the 1kW
resistor. It is important that there is not too much current
drawn from the supply as this is limited by that which
can be delivered via the 220nF capacitor and 1kW resistor
connecting to the mains Neutral.
The 20MHz crystal X1 provides IC1 with an accurate
clock signal for the timing requirements in the phase control
driver and remote control functions. The 33pF capacitors
provide the correct loading for the crystal to ensure reliable
starting of the oscillator when power is applied.
IC2 receives and demodulates the codes from the infrared
remote control. It incorporates an amplifier and automatic
gain control plus a 38kHz bandpass filter to accept only
remote control signals. Upon detection of an infrared signal, it detects and removes the 38kHz carrier. The resulting
signal is applied to the RB4 input of IC1.
The high gain of IC2 makes it susceptible to interference from the switching of the Triac. The software has
been planned so that the remote control signal is only
monitored when interference is at a minimum. Interference
does, however, affect the gain of IC2, which shuts down
the gain as interference is detected due to its automatic
gain feature. This gain reduction reduces infrared remote
control range.
To help prevent this reduction in gain, IC2 is housed
MAINS
CORD
NEUTRAL
(BLUE)
The Automatic Lamp Dimmer is constructed on a PC
board coded 10107051, measuring 96 x 35mm. It is mounted
inside a 4-way power board.
The power board provides us with a case, a power lead
and mains plug plus the mains outlet. The power board
is modified by blocking off three of the four mains outlets
to make space for the dimmer circuitry. A cover plate is
mounted over the blocked off sockets and secured with
Nylon screws. Two LED indicators protrude through this
cover plate.
Begin by checking the PC board against the published
pattern to ensure there are no shorts between tracks or any
breaks in the copper. Repair these if necessary.
First components to install are the resistors – use the
colour code table as a guide to selecting each value and/
or use a multimeter to check each value.
Solder in the socket for IC1, making sure the orientation
is correct. Capacitors can also be inserted and soldered in
place. The electrolytic types must be oriented with the
polarity shown on the layout diagram, as must the diodes.
Also ensure each is installed in its correct position. Install
the Triac and crystal (the latter is not polarised).
IC2 is mounted in the position shown with the leads bent
forward and then upwards so that the lens section of the
device is still vertical and located about 5mm back from
the edge of the PC board.
We made a shield for IC2 from a USB connector. Unclip
and open up the rear of the USB socket’s shield and slide
out the internal part. Bend back the rear flap on the shield
to its closed position and insert the shield in place over
IC2 and solder the mounting tabs to the PC board. The
rear flap of the shield may need to be soldered in position
since the bending process will have weakened the metal
where it was bent.
Inductor L1 is wound using 38 turns of 0.5mm enamelled
copper wire, wound neatly, tightly and evenly around the
core. This coil may produce a buzzing noise in the Auto-
ACTIVE (FROM MAINS CORD VIA OVERLOAD SWITCH)
(BROWN)
EARTH
(GRN/YEL)
OVERLOAD
SWITCH
BRASS
BUSBARS
ACTIVE
(BROWN)
TOP OF POWER BOARD
(UNDERSIDE VIEW)
AUTODIMMER
PC BOARD
(UNDERSIDE
VIEW)
NEUTRAL
(BLUE)
EARTH WIRE
(GREEN/YELLOW)
Fig. 6: here’s how the new PC board fits into the modified powerboard, along with the connections required. Note that
this diagram is for the Powertech (Jaycar MS4040) – other powerboards might be different. This diagram also gives you
a good idea of where the busbars must be cut – a sharp pair of tinsnips is required here.
32 Silicon Chip
siliconchip.com.au
matic Lamp Dimmer, caused by the phase control method
of dimming that produces sudden changes in current and
movement in the wires.
To prevent this happening, you can coat the windings
in some epoxy resin before installing the core on the PC
board. When the resin is dry, insert the wires into the PC
board holes where shown and secure the toroid in place
with the cable tie. Strip off the wire insulation near the
underside of the PC board using a sharp hobby knife and
solder the wires in place.
Note that if you are using red-coloured enamelled wire,
the insulation can be stripped with a hot soldering iron.
Brass-coloured enamel will not strip under soldering iron
heat and will need to be scraped off.
LED1 and LED2 are mounted so that the top of each is
25mm above the top of the PC board. The longer lead of each
LED is the anode. The tops should not protrude through
the panel when assembled but be level with its surface.
Leave the remote control code linking options for LK1
to LK3 open for the present.
Modifying the powerboard
We used a Powertech 4-way powerboard (from Jaycar
Electronics) to house the project. Other powerboards may
not have the same clearances nor setup inside.
The powerboard requires modification in order for the
PC board to fit inside. Firstly, you will need to open it up
– most (as ours did) use tamper-resistant screws to stop
you doing just that!
The specified powerboard uses tri-wing screws, requiring
a tri-wing screwdriver bit to open them. We didn’t have
one so we used a bench grinder to grind an old screwdriver
blade down to a triangular shape, then bent it over to make
a handle. It’s rough . . . but it worked!
Inside the power board you will see that there are brass
bus bars to carry the Active, Neutral and Earth connections. The three far end sockets (those further away from
the mains inlet cord) need to be cleared to make room for
the PC board. This is done by cutting back the bus bars so
that they are available for the first mains socket but not for
the final three.
Also, the plastic moulding will need to be removed to
make space for the PC board components. This plastic can
be removed with a small flat nosed set of pliers by twisting
and breaking the plastic out from the case.
The infrared receiver bezel is actually the front part of
a red plastic neon bezel. Clip the power board casings together and drill out the hole in the end of the case to suit
the bezel – it should be small enough so that the bezel is
The powerboard we used for this project was a Powertech
(Jaycar) MS4040. The PC board is designed to fit this one.
siliconchip.com.au
Parts List – Automatic Lamp Dimmer
1 PC board, code 10107051, 96 x 35mm
1 4-way mains power board
(Powertech [Jaycar] MS4040 used in prototype)
1 pre-programmed “universal” infrared remote control
(with channel numbers, volume and channel up and
down plus mute and operate buttons)
1 133 x 51 x 3mm Perspex sheet (to cover three mains
sockets)
1 powdered iron toroidal core, 28 x 14 x 11mm
1 B-type USB PC-mount socket (for the metal shield
only)
1 20MHz crystal (X1)
4 M3 x 10mm Nylon screws
4 M3 nuts
1 all-plastic 240V red Neon Bezel (eg, Jaycar Sl-2630)
1 1.6m length of 0.5mm enamelled copper wire
1 150mm length of brown 10A mains wire
1 100mm length of blue 10A mains wire
1 200mm long cable tie
Semiconductors
1 PIC16F628A microcontroller
programmed with autolamp.hex (IC1)
1 BT137F 600V 8A Triac (Triac1)
1 infrared receiver decoder (IC2)
1 5.6V 1W zener diode (ZD1)
1 1N4004 1A 400V diode (D1)
1 FR102 fast diode (D2)
2 5mm high-intensity red LEDs (LED1,LED2)
Capacitors
1 470mF 16V electrolytic
1 100mF 16V electrolytic
1 220nF 250VAC X2 polyester
1 100nF 250VAC X2 polyester
2 100nF MKT polyester
1 4.7nF MKT polyester
2 33pF ceramic
Resistors (0.25W 1%)
1 1.5MW 1W 5%
1 2.2kW
1 1kW
1 470W
1 1kW 1W 5%
1 39W
held in securely when the power board is screwed together.
Use some Super Glue to secure the bezel to one half of the
casing if it can be prised out of its hole. Two holes will be
required for the LEDs in the top of the case.
The cover plate is essential – it stops the unwary (or unknowing) trying to use the powerboard as a powerboard and
possibly damaging components inside. Make up the cover
plate to suit the powerboard you are modifying (use the photos
as a guide) – it covers three of the four mains sockets. The
two LED holes are also drilled into this plate.
The plate is secured with Nylon screws, necessary as they
provide insulation from the mains voltages inside the powerboard. We also recommend melting the Nylon screw ends
over the nuts once installed to prevent them from becoming
unscrewed. A hot soldering iron will do this.
On the particular power board we used, there are two
slotted holes at the rear, designed to allow the powerboard
to be secured to a wall using screws. We recommend that
July 2005 33
Capacitor Codes
Resistor Colour Codes
p
p
p
p
p
p
No.
1
1
1
1
1
1
Value
1.5MW
2.2kW
1kW
1kW
470W
39W
4-band Code (1%)
5-band Code (1%)
brown green green gold (5%)
red red red brown
red red black brown brown
brown black red gold (5%)
brown black red brown
brown black black brown brown
yellow violet brown brown yellow violet black black brown
orange white black brown
orange white black gold brown
Value
220nF
100nF
4.7nF
33pF
mF
IEC Code
0.22mF
220nF
0.1mF
100nF
.0047mF
4n7
N/A
33p
EIA Code
224
104
472
33
10107051
you fill the hole that is located beneath the dimmer
A
PC board with some Silicone sealant. This is because
AUTO DIMMER
there is a possibility (admittedly remote) that some
thin metal object could be poked through the hole
onto back of the PC, with possible dire consequences.
Better to be safe than sorry, as mum used to say!
A (out)
SC
The Active bus bar will need to be disconnected
from the main active supply lead so that the dimmer
circuitry can intercept the Active before the mains
N
outlet. The Earth lead connection may need to be
relocated nearer to the mains socket. Make sure the Fig. 8: the full-size PC board pattern – use this to check
wire is well soldered to the earth bus bar – it’s always the etching and drilling of commercial boards, or use it to
best to make a mechanical joint (ie, wrap the wire photographically etch your own PC board.
around the bus bar) which can hold by itself, then
solder in place.
191 coding is that for a Philips TV set. If you are using a
Wire up as shown and cut the neon bezel so that its length different remote control, try the codes listed for Philips
will just reach the metal shield for IC2 when installed brand TV sets.
into the case. The project is now electrically complete but
Plug a 40W (or more) 240V lamp into the power board
before you reassemble the power board, give it a thorough socket and plug the powerboard plug into a mains power
visual check.
socket.
When you’re satisfied everything is as it should be,
Check that the dimming can be set with the channel
screw the two halves of the power board together with the up and down buttons and that slow dimming works. The
tri-wing screws.
Mute button should switch the lamp on and off. Check that
Don’t be tempted to work on the next part of the project, the automatic dimming works by pressing the appropriate
testing, before assembling the powerboard. Live wiring is button. If it does not work, check that the correct code has
dangerous.
been entered into the remote. Observe operation of the
LEDs during these tests.
Testing
If the remote control also activates other items that are
Before testing, you will need to set the remote control located in the same room where you will be using the
to the appropriate coding. It is most unlikely that you will Automatic Dimmer, then the remote control coding will
find any “universal” remote control which cannot be used need changing.
with this project.
The coding is changed by selecting one of the optional
For the remote control we used, the “Big Shot 3 in 1” codes such as VCR1, SAT1 or SAT2. Generally, the SAT2
remote, the process is to press the SET and TV buttons selection is a good choice. This is selected by soldering a
together and then enter the numbers 191. For other re- bridge for link 3 on the dimmer PC board. Before doing
mote controls, the process may be slightly different. The this make sure (twice!) that the powerboard is unplugged
from the mains so that it is safe to open.
The hand-held remote will need to be programmed
for the code selection. To select SAT2, press SET and
SAT together and then enter the numbers 425. This
number may be different for another type of remote
control unit. If selecting SAT1 use the numbers 424
and for VCR1, use 336. Also the linking on the dimLK3
mer PC board will need to be changed.
LK2
Note that for the VCR1 selection, the on and off
LK1
function using the Mute button will not operate the
Automatic Lamp Dimmer. Instead it will operate the
mute in a TV set that works with the TV1 selection
SOLDER LK1 FOR VCR1
REMOTE CONTROL
LK2 FOR SAT1
CODING SELECTION
on the remote.
LK3 FOR SAT2
LEAVE ALL THREE OPEN FOR TV1
This feature is called punch-through, where selecFig.7: this view of the copper side of the PC board shows the three tions that do not have a mute feature are operated
by the TV code.
links which set the correct infrared decoding (see text).
SC
N
A
AUTO DIMMER
SC
10107051
A (out)
34 Silicon Chip
siliconchip.com.au
|