Silicon ChipTouch And/Or Remote-Controlled Light Dimmer; Pt.1 - January 2002 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Electronics Australia copyright will not be lost
  4. Feature: Segway - A Revolutionary Powered Scooter by Sammy Isreb
  5. Feature: Electric Power Steering by Julian Edgar
  6. Feature: Computer Tips by Peter Smith
  7. Project: Touch And/Or Remote-Controlled Light Dimmer; Pt.1 by John Clarke
  8. Subscriptions
  9. Order Form
  10. Book Store
  11. Project: A Cheap 'n' Easy Motorbike Alarm by Mick Gergos
  12. Weblink
  13. Project: 100W RMS/Channel Stereo Amplifier; Pt.3 by Greg Swain & Leo Simpson
  14. Feature: Computer Troubleshooting by Stephen Davis
  15. Project: Build A Raucous Alarm by Thomas Scarborough
  16. Product Showcase
  17. Back Issues
  18. Vintage Radio: Philips Philetta vs the Titan Tiny by Rodney Champness
  19. Notes & Errata
  20. Market Centre
  21. Advertising Index
  22. Outer Back Cover

This is only a preview of the January 2002 issue of Silicon Chip.

You can view 30 of the 96 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 "Computer Tips":
  • Software for the "Build Your Own MP3 Jukebox" articles (Free)
  • AT90S2313 firmware and source code for the PC IR Interface & LCD Display (Software, Free)
  • IR Remote Receiver & LCD Display PCB pattern (PDF download) [07109011] (Free)
Articles in this series:
  • Build Your Own MP3 Jukebox; Pt.1 (September 2001)
  • Build Your Own MP3 Jukebox; Pt.1 (September 2001)
  • Build Your Own MP3 Jukebox; Pt.2 (October 2001)
  • Build Your Own MP3 Jukebox; Pt.2 (October 2001)
  • Computer Tips (January 2002)
  • Computer Tips (January 2002)
  • Computer Tips (April 2002)
  • Computer Tips (April 2002)
Items relevant to "Touch And/Or Remote-Controlled Light Dimmer; Pt.1":
  • PIC16F84A-20(I)/P programmed for the Touch and/or Remote-Controlled Light Dimmer [DIMMER.HEX] (Programmed Microcontroller, AUD $10.00)
  • PIC16F84 firmware and source code for the Touch and/or Remote-Controlled Light Dimmer [DIMMER.HEX] (Software, Free)
  • Touch and/or Remote-Controlled Light Dimmer PCB patterns (PDF download) [10101021/2] (Free)
Articles in this series:
  • Touch And/Or Remote-Controlled Light Dimmer; Pt.1 (January 2002)
  • Touch And/Or Remote-Controlled Light Dimmer; Pt.1 (January 2002)
  • Touch And/Or Remote-Controlled Light Dimmer; Pt.2 (February 2002)
  • Touch And/Or Remote-Controlled Light Dimmer; Pt.2 (February 2002)
Items relevant to "A Cheap 'n' Easy Motorbike Alarm":
  • Cheap'n'Easy Motorbike Alarm PCB pattern (PDF download) [05101021] (Free)
Items relevant to "100W RMS/Channel Stereo Amplifier; Pt.3":
  • Ultra-LD 100W RMS Stereo Amplifier PCB patterns (PDF download) [01112011-5] (Free)
  • Ultra-LD 100W Stereo Amplifier PCB patterns (PDF download) [01105001-2] (Free)
  • Panel artwork for the Ultra-LD 100W RMS Stereo Amplifier (PDF download) (Free)
Articles in this series:
  • Ultra-LD 100W Stereo Amplifier; Pt.1 (March 2000)
  • Ultra-LD 100W Stereo Amplifier; Pt.1 (March 2000)
  • Building The Ultra-LD 100W Stereo Amplifier; Pt.2 (May 2000)
  • Building The Ultra-LD 100W Stereo Amplifier; Pt.2 (May 2000)
  • 100W RMS/Channel Stereo Amplifier; Pt.1 (November 2001)
  • 100W RMS/Channel Stereo Amplifier; Pt.1 (November 2001)
  • 100W RMS/Channel Stereo Amplifier; Pt.2 (December 2001)
  • 100W RMS/Channel Stereo Amplifier; Pt.2 (December 2001)
  • 100W RMS/Channel Stereo Amplifier; Pt.3 (January 2002)
  • 100W RMS/Channel Stereo Amplifier; Pt.3 (January 2002)
  • Remote Volume Control For Stereo Amplifiers (June 2002)
  • Remote Volume Control For Stereo Amplifiers (June 2002)
  • Remote Volume Control For The Ultra-LD Amplifier (July 2002)
  • Remote Volume Control For The Ultra-LD Amplifier (July 2002)
Items relevant to "Build A Raucous Alarm":
  • Raucous Alarm PCB pattern (PDF download) [03101021] (Free)
  • Panel artwork for the Raucous Alarm (PDF download) (Free)

Purchase a printed copy of this issue for $10.00.

(( TOUCH and/or REMOTECONTROLLED LIGHT DIMMER (( (( (( (( (( (( (( (( (( (( (( (( (( (( down – by simply touching an attractive plate which takes the place of the light switch and knob. And you can add one or more extensions for two, three or more-way dimming. The dimmer itself is very sleek. The only part that you see when mounted onto a wall is a modern aluminium wallplate (we used a commercially-available Clipsal Classic 2000 blank plate – so it looks very professional and as modern as tomorrow. A bezel is added to allow for reception of the remote control infrared transmission from the hand-held unit. www.siliconchip.com.au ( 22  Silicon Chip dimmers are installed in living rooms, lounge rooms, bedrooms – in fact, just about anywhere. But the traditional wall-mounted, knob-controlled light dimmer has a major drawback. You decide you want to dim the lights and you have to get up out of your comfy chair and go and do it. Wouldn’t it be nice if you could do it by remote control? You can with the all-new SILICON C HIP light dimmer. What’s more, there’s no ugly knob. There’s not even a light switch! As well as using a remote control, you can actuate the dimmer – up or (( E very now and then we get a letter or email criticising our use of a microcontroller when (perhaps) a similar job could have been done with (lots of!) discrete components. Well, look at our latest light dimmer – and what it does. We make no apologies for using a PIC because it does so much, so simply. A project such as this demonstrates perfectly why we use microcontrollers. There would be very few homes that don’t have a light dimmer or three. So-called “mood lighting” became the big thing in the eighties; today light (( Old-fashioned light dimmers with their knobs on the architrave are so passé! Here’s one that you simply touch to dim up or down, or touch again to turn full on or full off. Not decadent enough? How about full remote control from the comfort of your armchair? Now that’s a dimmer! (( By John Clarke (( (( (( (( You don’t even have to build the started” to reduce stress on the lamp one control – a touch – which must infrared controller yourself: it is a filament. What this means is that powperform several functions but the low-cost, commercially available unit er is applied to the lamp gradually to remote hand-held unit has several conwhich is preprogrammed for hundreds bring it up to brightness. trols. So we can use different buttons of different types of TVs, VCRs, satelto perform various dimming functions. When you turn on a normal light, lite receivers, etc. a very high surge current flows for a We have selected five buttons to do The light dimmer can be set to brief period (until the cold filament the job. The ‘CH +’ and ‘CH –‘ buttons operate on one of four programming heats up). This causes a thermal shock provide fast up and down dimming codes so you can select one which can cause the filament to respectively. The ‘volume +’ and which does not operate any ‘volume –’ buttons provide for slow of your other devices. (You’d up and down dimming. Features hardly want the telly to change The ‘mute’ button turns • Attractive slimline appe volume whenever you dimmed off the lights. arance - no knobs! • Touch Plate dimming the lights!). Incidentally, fast dimWe have tested two different ming takes two seconds • Soft start for lamp when switched on hand-held remote controls. from one lamp brightness • Last dimming setting sto red and returned at switc One is a simple TV-only unit extreme to the other, while h on • Full brightness restored on second touch with minimal controls while slow up and down dim• Remote control operatio the second is more elaborate ming takes 11.6 seconds. n • Full control features with and can control several difYou can use the fast conTouch Plate extension • RFI suppression ferent devices. This could trols to set the approximate also be used to control your brightness required and the • Reset for brownout and blackout TV set and VCR as well as slow dimming buttons to the light dimmer. more accurately set the level. Hey, we’ve just helped you get rid There are 102 brightness of a couple of remote controls! levels available from minibreak – especially when the lamp is mum brightness to full brightness and Dimming and “soft starting” reaching the end of its life. You have the brightness is varied so that its level probably noticed that the vast majority appears to change in approximately As mentioned, dimming of the of lamps “blow” at the instant they equal steps. lights can be achieved in two ways: are turned on. When the light dimmer is first using the touch plate or using the reAllowing the lamp to warm up installed or if power is restored after mote control. We’ll look at the touch slowly, with soft starting, prevents the a blackout or brownout, the lamp is plate first. filament from changing from cold to initially set as off. Full brightness is Dimming is initiated by simply hot too quickly, reducing the thermal returned with a quick touch of the holding your hand on the touch plate shock. Even though it happens slowly dimmer plate. Also the last dimmed and the light will be dimmed either up as far as the filament is concerned, as level is not remembered when the or down. It takes just on three seconds far as you (the user) are concerned power is lost. for the light to be dimmed over its full it all happens pretty quickly. The T he dimmer is powered from ­ range. Dimming stops when either soft start brings the brightness of the the mains via a dropping capacitor minimum brightness or full brightness lamp up automatically from minimum (0.47µF) which does not itself conis reached. brightness to full brightness in just sume power in order to deliver the Dimming the light in the opposite 340ms. Therefore it takes 17 mains current required by the circuit. direction simply requires the hand cycles (50Hz) for the lamp to be at full Power drawn by the dimmer circuit to be momentarily removed from the brightness. from the mains is a miniscule 0.42W touch plate and then reapplied. Soft starting occurs whether the which equates to about 3.7 kilowattWant instant light? A quick tap of lamp is only brought up to a low hours per year. This will make its cost the touch plate will switch the light brightness setting or to full brightof running (ignoring the power used by on and another quick tap will turn it ness. Normal up/ off. When switching on, the lamp is down dimming returned to the brightness that it was also effectively last dimmed to. provides a soft If you want the lamp at full brightstart because ness, you can give the touch plate of its slowanother quick touch and the lamp will er change in be brought up to full brightness. This brightness over second touch must be done within 2.5 time. seconds or the lamp will be switched off instead. Alternatively, you can Remote control hold your hand on the plate so that it Remote control features is dimmed up to the required brightare different to those availaness. ble with the touch plate. The Even when apparently switching touch plate has effectively only on instantly, the lamp is always “soft (( (( (( (( (( (( (( (( (( (( (( (( (( (( (( (( (( (( (( (( (( (( (( (( (( (( (( (( (( (( (( (( (( (( (( (( (( (( (( (( ( www.siliconchip.com.au January 2002  23 15 CRYSTAL TIMEBASE MAINS IN 6 10MHz 16 START ZERO VOLTAGE NEGATIVE EDGE DETECTOR LOCK TIMER (250) CLOCK RESET BRIGHTNESS COUNTER VALUE 0-250 MONITOR TOUCH PLATE 17 EXTENSION BRIGHTNESS LEVEL REGISTER TOUCH PROCESSOR & EXTENSION PROCESSOR EXCLUSIVE COMPARATOR 10,11 12,13 TRIAC GATE DRIVE VALUE 48-211 18 1 START/STOP 7 2 CODE SELECT INPUTS TRACER DECODING 8 DECODE 3 SHIFT REGISTER IC2 IR SIGNAL  9 IR MONITOR TIMER AMPLIFIER DEMODULATOR Fig.1: there appears to be a lot in the dimmer but most of the work is under-taken by the PIC microcontroller, IC1, which comprises the yellow blocks. the lamp) less than 40 cents per year. Phase controlled dimming The dimming circuitry is based on phase control to set the lamp brightness. As you know, our electricity supply (nominally 240V AC) is a 50Hz sinewave which goes positive for 10ms, back through zero and negative for 10ms, back through zero and positive for 10ms, and so on. Normally, of course, the lamp filament is connected to the supply when ever it is switched on. But what if it could be switched on and off very rapidly, so that only a percentage of the mains voltage could get through? If it was connected 50% of the time, you would expect the lamp to be significantly dimmer than when connected 100% of the time. Now what if this on/off switching was so accurately timed that the “on” point occurred at the same point in each half cycle (say half way through, or 50%) and the “off” point occurred at the end of that half cycle? The effect would be exactly the same. That is effectively what a phase controlled Triac dimmer does. It allows power to get to the lamp only for 24  Silicon Chip certain portions of the mains cycle. If power is connected early in the cycle, the lamp will glow brighter. But if it is connected much later in the cycle, the lamp will glow much dimmer, simply because there isn’t the power to heat the filament as much. Switching is performed by a device known as a Triac which can be triggered on by a voltage at its gate. The Triac will only turn off when current through it drops below a certain threshold value. In practice, when driving a resistive load, this means that the Triac switches off when the mains voltage is near 0V. The accom- panying oscilloscope traces show how it works. The first oscilloscope waveform (Scope 1) is the 50Hz mains sinusuoidal voltage measured on the active output of a power point. This has an effective or RMS voltage of 240V (±5%) while the peak voltage is about 339V. Note that the mains voltage shown here is higher – 250VAC and 355V peak (half the peak-to-peak voltage). The second oscilloscope waveform shows (Scope 2) shows the waveform applied to the lamp when it is required to have a low brightness. In this case, the lamp is powered about 150° from the start of each mains half cycle and is switched off at 0V. The lamp voltage is applied for both positive and negative excursions of the mains and the RMS voltage is around 39V. The next oscilloscope waveform (Scope 3) show the lamp voltage when it is bright. Now the voltage is applied early in each mains half cycle so that almost the full mains waveform is applied. Again the lamp is switched off at 0V. The RMS voltage is now a lot higher at 242V. Circuitry for the lamp dimmer utilises this phase control by dividing up each half of the mains waveform into 250 discrete sections. There are 250 sections starting from the 0° and finishing at 180° for the positive half cycle and another 250 discrete sections from 180° through to 360° for the negative half cycle. Thus each discrete section of the mains is about 0.72° (180/250). This is shown in Fig.2. A count of 48 is therefore 34° and a count of 211 is 152°. These are the two extremes over which the circuit will dim the lights. Block diagram Fig.1 shows the general arrangement TOUCH PLATE DETECTION TOUCH PLATE DETECTION BRIGHTNESS COUNTER RESET ZERO VOLTAGE DETECTION TIME 0 10ms 20ms 30ms 0 34 90 152 180 214 332 360 90 180 BRIGHTNESS 0 COUNTER 48 125 250 211 0 48 211 250 0 125 250 DEGREES Fig.2: this diagram represents 1.5 cycles (30ms) of mains voltage. The degrees and brightness counter scales are explained in the text. www.siliconchip.com.au These three oscillograms show how phase control delivers various amounts of power to a load. On the left (Scope1) is a somewhat distorted sine wave, straight out of a power point. While nominally 240V AC, 50Hz, in this case it’s actually 250V AC and the frequency is just a tad low (neither of which is unusual). The second shot (Scope 2, above right) shows power being made available to the load very late in the half cycle so it effectively receives just under 40V. In this case, the lamp would be barely glowing. Scope 3, the waveform at right, shows triggering very much earlier in the cycle, so the lamp receives almost all the available power. Here the lamp would be at virtually full brilliance. WARNING: These scope waveforms are shown to explain the operation of the circuit. DO NOT try to reproduce these waveforms yourself – it is too dangerous. We used a special low-voltage test jig to obtain some of these waveforms. of the dimmer circuit. Most of the operation, with the exception of the infrared amplifier demodulator (IC2), is performed by IC1, a single chip microcontroller. We used a PIC16F84-10/P (or PIC16F84A-20/P), programmed to perform phase control. It accepts inputs from the mains, from the touch plate and external terminal and also from the remote control amplifier demodulator (IC2). It then provides an output to drive a Triac. The mains input at pin 6 of IC1 provides information about the phase of the waveform. Each time the voltage passes through zero (see Fig.2) the zero crossing detector resets the brightness counter. This counts from 0 through to 250 for both the 10ms positive and the 10ms negative half cycles of the mains voltage. It counts up every 40µs provided by a signal from an internal timer which is clocked using a 10MHz crystal timebase. An important part of this circuit is the feedback from the brightness counter back to the internal timer. This is required to lock the internal timer to the brightness counter. Any deviation from this locked arrangement will produce flickering in the phase controlled lamp. Without locking, the counter could be any value between 225 to 275 depending on the mains frequency and crystal frequency drift. We therefore lock the counter to the mains by adjusting the internal timer in increments of 800ns either faster or www.siliconchip.com.au slower over the 10ms period between each zero crossing. Adjustments are carried out every 20ms. Inputs from the touch plate (and extension, if fitted) are monitored by the touch processing block. Touch plate detection is checked at around 90° which is the peak positive excursion of the mains waveform. The actual power supply for the dimmer follows the mains voltage and so if we want to pull pin 17 towards ground, the best sensitivity for this is when the dimmer circuit is sitting at the peak positive excursion of the mains waveform. The touch processing determines how long the touch plate has been touched or how long the extension input is connected by counting the number of mains cycles. It processes this to control the brightness level register. Similarly, the brightness level register is altered using the remote control. IC2 detects the infrared remote control code and amplifies the signal. Its output provides a demodulated signal of the transmitted code. Oscilloscope traces show the signal from the infrared hand held unit which is a modulated signal on a 36kHz carrier (Scope 4). The second set of traces (Scope 5) show this modulated signal in channel 1. Channel 2 shows the demodulated signal at the output of IC2 where the carrier is removed. Note that IC2 inverts the remote control signal. The remote control signal at the output of IC2 is applied to pin 9 of the infrared decode select block. A shift register January 2002  25 Scope 4, on the left, shows the signal from the infrared hand-held unit which is a modulated signal on a 36kHz carrier. Scope 5, top right, shows this modulated signal in channel 1 (the yellow waveform). Channel 2 (blue waveform) shows the demodulated signal at the output of IC2 where the carrier is removed. Channel 3 (magenta) is the tracer waveform, while the green waveform (Channel 4) shows the decoded output. Scope 6 (right) is similar to Scope 5 except that channel 1 (yellow) shows the stop start waveform. This signal can be used to sync the oscilloscope. converts the remote control serial code into a parallel form suitable for comparing with the known control codes in the decoder. Remote control operation codes are shown at pins 1, 7 & 8 which give the start and stop signal for the remote control signal, the tracer output which shows the position where the level of the remote control signal is read and the final decoded signal as applied to the decoder. Channels control decoding will not operate correctly and will result in loss of remote control operation. Fortunately, the mains 2, 3 and 4 show this. frequency is usually well within 5% of the nominal 50Hz The remote control signal applied to pin 9 is a bi-phase code where a low level is represented by a high level go- and with this variation (47.5Hz to 52.5Hz) the remote control will still operate. ing to a low level and a high is represented by a low level In fact, the mains frequency will be very, very close to going to a high level. Note how the tracer signal in channel 3 (short positive 50Hz most of the time. This is because it must remain acpulse) is essentially in the middle of the high or low square curate for power stations to keep in lock with each other and also to maintain load waveform of the remote conconditions over time. trol signal found at the pin 9 And if it varied too much, input at channel 2. Incorrect every mains-locked clock decoding will occur if the This circuit operates on the 240 volt mains and radio and alarm clock in tracer rate is too fast or too most parts of the circuit are at mains potential the country would show slow, which will shift the and therefore DANGEROUS. Furthermore, the wrong time – and then tracer too far to the left or installation into fixed wiring can only be wouldn’t people get upset! to the right respectively. The waveform resulting Once the remote control undertaken by licensed electricians under from the detection at the signal is decoded it is comcurrent legislation in most states. tracer points is the lower pared with stored codes. channel 4 output and is the Inputs at pins 2 and 3 select decoded signal. the particular code that is used with four possible different codes available. When the selected stored code is the same The Scope 6 waveforms are similar to those above except as the received remote control signal the brightness level that we have included the stop start waveform for channel register is altered in response to the particular function 1. This signal can be used to sync the oscilloscope. delivered by the remote control. So, for example, if fast Decoding periods are set by the internal timer which as previously mentioned is locked to the mains frequency. If up dimming is selected, the brightness level register is the mains frequency drifts too far off 50Hz, then the remote decreased to increase lamp brightness. PLEASE NOTE! 26  Silicon Chip www.siliconchip.com.au The PC board is secured to the plastic face plate with nylon screws. The hole in the bottom of the PC board actually has a nut soldered to the track on the other side, ready to accept the touchplate contacting metal screw. The following comparator monitors both the brightness level register and the brightness counter. When they are equal, the comparator output provides a pulse to drive the Triac gate. If the brightness level register is a low value, this value will be equal to the brightness counter early in the mains cycle to provide a bright lamp. If the brightness level register is a larger value, the value will be equal to the brightness counter later in the mains cycle and so the lamp will be dimmer. the infrared decoder (IC2), a Triac, several diodes, a transistor, 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 0.1uF 250VAC capacitor, provides suppression of The circuit Considering the complexity of the dimmer operation, there is not too much in the actual circuit itself. This is because most of the work is done in the PIC16F84-10P microcontroller (IC1). Apart from this IC there is only electromagnetic radiation caused by the Triac switching. The inductor core is made from an iron powdered material which is very lossy in the high frequencies, particularly above 1MHz. Power for the circuit is derived directly from the mains supply, using a 0.47µF 250VAC mains capacitor as a dropping impedance for the following A TOUCH PLATE Q1 BC327 B 68k 22k EXTN 4.7M VR37 47k 14 18 MCLR RB4 RB5 RB6 RB7 RA1 17 10 11 12 13 470F 16VW IC2 RB0 0.1F 2 WARNING: MOST PARTS OF THIS CIRCUIT OPERATE AT MAINS POTENTIAL A1 IC2 TRIAC1 SC141D A2 1 .01F 680k 6 RB2 9 RB3 RA3 RA4 2 0V +5V 3 5 1 8 7 3 2 680k Q1 L1 60H +5V RB1 1 +5V IC1 PIC16F84-10/P RA2 REMOTE SIGNAL +5V G A2 16 3 l G 1M X1 10MHz 22pF 39 A1 RA0 15 +5V 0.1F 250VAC D1 FR102 4 10k 22pF TRIAC1 +5V C A 4.7M VR37 10k E 47F TANT 1M E START/STOP B C DECODE TRACER ZD1 5.6V 5% 1W D2 1N4004 LAMP 250W MAX 1k 5W N 0.47F 250VAC LAMP (NOT CONNECTED TO CIRCUIT) E 0V CODE SETTING LINKS SC 2002 LIGHT DIMMER Fig.3: the circuit is based on a suitably programmed PIC 16F84. It can handle input from either a touch plate or from a selection of infrared remote controllers. The code setting links depend on the specific controller. www.siliconchip.com.au January 2002  27 UNDERSIDE DIMMER BOARD off, then the 0.47µF capacitor can charge and discharge smoothly with the sine wave voltage and the current CABLE TIE D1 through the 1kΩ resistor is SECURING FR102 SOLDER L1 ABOVE about 35mA RMS. This gives 680k CAPACITOR TO TRIAC1 SENSOR CASE a power dissipation in the AND PCB TRACK 1kΩ resistor of 1.23W. 0.1F Things are different when INSULATE PC L1 TRACK WITH the Triac is fired. This is TAPE UNDER IC2 SOLDER because of the energy stored SHIELD CAN M3 TAPPED IC2 0.47F 250VAC 6mm SPACER in the capacitor – 27mJ (1/2 IC2 CV2). To convert this to watts ZD1 1k * we multiply by 100 as there 5W 47 * D2 are this many half cycles in 470 1 a 50Hz mains waveform per 22k IC1 PIC16F84 * second. The dissipation then 68k becomes 2.7W in the 1kΩ Q1 BC327 X1 22p resistor. 10MHz 4.7M 22p 39 4.7M* Selection of the resistance VR37 value is a compromise be*THESE COMPONENTS MOUNTED UNDER PC BOARD tween having low power disFig.4: the PC board has tracks on one side but components are fitted to both sides. At sipation when the Triac is off left is the ‘normal’ component side while the right diagram shows the copper (track) (which calls for a low value of side with the infrared receiver, capacitor and resistors. resistance) and reducing the 5.6V zener diode, ZD1. The 0.47µF mum brightness for the lamp. While surge current through the zener capacitor has an impedance of 6.77kΩ it appears to be fully bright, it is not diode when the Triac is fired (which at 50Hz. When combined with the quite as bright as if switched directly calls for a large value of resistance). series 1kΩ resistor this doesn’t give across the mains supply. The resulting DC supply is filtered an effective impedance of 7.77kΩ, as If the 0.47µF capacitor gives an with the 470µF electrolytic capacitor you might expect. It’s actually 6.84kΩ impedance of 6.77kΩ by itself, why and 0.1µF ceramic capacitor for IC2 due to the phase differences between include the 1kΩ resistor in series? One and the 47µF tantalum capacitor for the capacitor and the resistor. This reason is to limit surge currents if the IC1. The 0.1µF ceramic capacitor aids impedance limits the current flow in mains supply is connected during the the 470µF capacitor in suppressing ZD1 to 35mA. peak of the supply. However, there is high frequency noise on IC2’s supply The resulting supply is about 5V due another and more important reason which could cause erratic operation to the voltage drop across D2. and is because of the Triac. of this high gain device. The tantaOne thing to note here is that this When the Triac is fired, the charge lum capacitor provides both high 5V power supply can only be obtained on the capacitor is immediately dis- frequency filtering and also sufficient when the Triac is off. When the Triac charged through L1, the Triac, the energy storage for the current drive is on there is only about 1V across it zener diode and the 1kΩ resistor. So to the Triac. which is insufficient to develop the we need to limit this surge current Power is applied between pins 14 power supply voltage. through the zener diode, particularly and 5 of IC1 and between pins 3 and Thus the phase control is limited to when the capacitor is charged to 340V 2 of IC2. Pin 4 of IC1 is the reset input a minimum of 35° to make sure that (the peak of the 240V AC waveform). for the microcontroller and connects there will always be power available. Dissipation in the 1kΩ resistor is to the brownout circuit, comprising This phase angle also sets the maxianother consideration. If the Triac is Q1 and the associated resistors. The LOOP A EXTN KEEP WINDINGS CLOSE 4.7M VR37 4.7M 1M 47k 10k 10k .01F 0.1F 250VAC 1M 680k LAMP 4mm DIA. HOLE 3 TOP 6 4 4 SOLDER WIRE TO CENTRE LEAD 3 6 3 4 SHIELD IC2 LEAVE 75% OF CORE FREE OF WINDINGS L1 WINDINGS (24 TURNS OF 0.5mm ENAMELLED COPPER) Fig.5: L1 is wound with the turns at the top to minimise interference to the infrared pickup circuit. 28  Silicon Chip Fig.6: if your infrared receiver doesn’t come with a shield, you’ll need to fashion one from tinplate. Here’s how it’s done. Note how the cable tie passes through the PC board to secure L1 on the top side. www.siliconchip.com.au circuit is used to bring pin 4 low if the supply drops below a certain threshold. With a 5V supply, there is sufficient voltage on the base of Q1 to switch it on, pulling pin 4 to the 5V supply rail. If the supply rail drops, current through the 10kΩ and 68kΩ resistors at Q1s base will also fall. When the supply voltage reaches 4.68V, the current through the resistors is 60µA and so the voltage across the 10kΩ resistor is 0.6V. At this voltage Q1 just begins to turn off, pulling pin 4 of IC1 low to reset it. Crystal X1 operates at 10MHz to provide IC1 with an accurate clock signal for all the timing signals required in the phase control driver and remote control decoder functions. The 22pF capacitors provide the crystal loading to ensure a reliable oscillation when power is applied. Dimming control inputs are at pin 17 for the touch plate and at pin 18 for the extension. The touch plate is connected to pin 17 via two series-connected 4.7MΩ high voltage resistors. It is essential to use the resistors nominated (ie, Philips VR37). As well as limiting any current flow to a person touching the touch plate to below 26µA, these particular resistors give a good safety margin as they are rated at 2.5kV (AC) each. Two resistors increase the voltage rating to 5kV giving extra safety. Normally, the input from the touch plate (pin 17) is held at 5V via the 1MΩ resistor but if the touch plate is touched, the ground capacitance of the person will bring the touch plate to ground potential. This effectively pulls pin 17 down to the same level as pin 5 whenever the active line is above ground. IC1 can then detect this low voltage. The extension input at pin 18 is normally held low via the 10kΩ resistor. It is pulled high to the 5V supply, when the extension is activated (in the same way as the main touch plate above). The 47kΩ resistor to pin 18 is used to protect the input from transients or incorrect connections to the extension. Note that we need to use this extension input for extra touch plates. If we simply extended the pin 17 input to another switch plate the extra capacitance and pickup from the extra line length would trigger this high impedance input. www.siliconchip.com.au The whole assembly fits into a standard mounting box (as shown here) or can be attached to a standard mounting plate. The brushed aluminium cover which goes over the whole assembly forms the touch plate. 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. It then detects and removes the 38kHz carrier. The resulting signal is applied to the pin 9 input of IC1 ready for code detection. The pin 2 and pin 3 inputs provide options for one of four remote control codes and are set by tying these pins either high or low with solder link connections. The high gain of IC2 makes this device susceptible to electrical interference from the switching Triac and from the suppression components. The software has been carefully planned so that the remote control coding is only monitored when interference is at a minimum. This interference, however, does cause the gain of the amplifier to be substantially reduced due to its internal automatic gain feature which is used to prevent overload in its circuitry. This throttling back of gain reduces the range of the remote control operation. To minimise the effect, we have included shielding around the device and have wound the suppression inductor in an unusual manner to substantially reduce any electromagnetic radiation. The zero voltage crossing point for the mains waveform is detected at pin 6 of IC1 via two series connected 680kΩ January 2002  29 Parts List – Touch/Remote Controlled Dimmer 1 PC board coded 10101021, 62 x 72mm 1 preprogrammed remote control (Jaycar ‘Big Shot 3’ AR-1710) or 1-TV preprogrammed remote control (Jaycar ‘Select 1’ AR-1703) 1 Clipsal CLIC2031VXBA blank plate and blank aluminium plate 1 clear capped LED bezel or 250VAC Neon bezel 1 iron powdered toroidal inductor, 28 x 14 x 11mm (Jaycar LO-1244 or equivalent) (L1) 1 4-way PC screw terminal block (Altronics P 2103 or equivalent) 1 18-pin DIL socket 1 10MHz parallel resonant crystal (X1) 2 M3 x 16mm countersunk Nylon screws 1 M3 x 10mm countersunk plated metal screw 2 3mm x 6mm untapped spacers 1 M3 tapped x 6mm metal spacer 2 M3 nuts 1 150mm cable tie 1 1.2m length of 0.6mm enamelled copper wire 1 9 x 20mm piece of tinplate (tin can material) 1 50mm length of 1.5mm spaghetti tubing Semiconductors 1 PIC16F84-10/P (or PIC16F84A-20/P) programmed with Dimmer.hex (IC1) 1 infrared receiver (Jaycar ZD-1952, DSE Z-1955 or equiv) (IC2) 1 SC141D 10A 600V Triac or similar (Triac1) 1 BC327 PNP transistor (Q1) 1 FR102 (UF102, 1N4936) or similar fast diode (D1) 1 1N4002 diode (D2) 1 BZV85C5V6 1.3W zener diode 5% (ZD1) (alternatives must be 5% tolerance) Capacitors 1 470µF (105° C) 16VW PC electrolytic 1 47µF 16VW tantalum 1 0.47µF 250VAC X2 class MKT polyester 1 0.1µF 250VAC X2 class MKT polyester 1 0.1µF ceramic 1 0.01µF MKT polyester 2 22pF ceramic Scope 7: this shows the mains waveform with a 1kHz control tone superimposed on it. The effective modulation is up to 50V peak-to-peak and can cause havoc in the zero voltage detection unless filtered out. the dimmer operates within the correct phase limits. The filtering is necessary to reduce the effects of electricity authority control tones which may be superimposed on the 50Hz mains. These could otherwise cause rather noticeable flickering in the lamp. The Scope7 oscilloscope waveform shows the mains waveform with a 1kHz control tone superimposed on it. The effective modulation can be up to 50V peak to peak and can cause havoc in the zero voltage detection unless filtered out. Gate triggering to the Triac is delivered by the paralleled pins 10, 11, 12 & 13 of IC1. Together these can sink a total of 100mA but we limit the current to the gate to around 50mA with a 39Ω resistor. Diode D3 reduces the 0.7V positive voltage which is present on the gate when the Triac is switched on from driving current back into these IC1 gates. Gate triggering pulses are shown in the “Scope 8” oscilloscope waveform. They are 80µs wide and repeat at 10ms intervals. Extension plates You can add another extension plate to the system to Resistors (0.25W 1% unless stated.) 2 4.7MΩ VR37 Philips high voltage (no substitutes) 2 1MΩ 2 680kΩ 1 68kΩ 1 47kΩ 1 22kΩ 2 10kΩ 1 1kΩ 5W 1 39Ω resistors connected to the A2 terminal of the Triac. Detection of the zero crossing is only made at the negative transition. If the Triac switches on, the A2 terminal will cause the input to go high. So zero detection is only available when the A2 terminal goes low, at the end of the positive half cycle of the mains waveform. The zero voltage detection signal is also filtered with a .01µF filter capacitor. This capacitor causes a substantial shift in the detected zero crossing point but this is adjusted in software so that 30  Silicon Chip Scope 8: these are the triggering pulses, which are 80µs wide and repeat at 10ms intervals. www.siliconchip.com.au RESISTOR COLOUR CODES    No. Value  2 4.7MΩ  2 1MΩ  2 680kΩ  1 68kΩ  1 47kΩ  1 22kΩ  2 10kΩ  1 39Ω 4-Band Code (1%) yellow violet green yellow brown black green brown blue grey yellow brown blue grey orange brown yellow violet orange brown red red orange brown brown black orange brown orange white black brown give both touch and infrared control at a second, or even third location. We’ll look at the way this works and how to put it together next month, when we also run through the recommended testing procedure. We’ll also look at coding the remote controls. Construction The dimmer is constructed on a PC board coded 10101021 and measuring 62 x 72mm. It is installed into a Clipsal Classic blank plate with a matching blank aluminium touch plate. The completed dimmer will fit inside a standard metal wall box where these are fitted in a brick wall or simply to a Gyprock wall. Alternatively, it can be placed on a standard 30mm deep mounting block. 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 as necessary. Now check that the holes are drilled to the correct sizing for the larger components. The screw terminal mounting holes need to be 1.5mm in diameter, while the PC board mounting holes, the touch plate connection and the cable tie holes to secure L1 should be 3mm or 1/8" in diameter. Install the resistors (except for the two 4.7MΩ values and the 1kΩ 5W resistor) first, noting that some are mounted on-end. Use the colour code table to guide you in selecting each value. You can also check the values with a digital multimeter. Now install the socket for IC1, along with the capacitors. The tantalum and electrolytic types must be oriented with the correct polarity, as shown on the overlay. Diodes can be installed next making sure they are also placed with the correct orientation and that the correct type is placed in each www.siliconchip.com.au 5-Band Code (1%) (NA – must be VR37 type) brown black black yellow brown blue grey black orange brown blue grey black red brown yellow violet black red brown red red black red brown brown black black red brown orange white black gold brown position. The Triac can be placed in position as well as the screw terminal strip. Transistor Q1 and crystal X1 can now be soldered in place. The 1kΩ 5W resistor mounts end-on with spaghetti sleeving over the wire ends. It stands proud of the PC board by about 5mm to clear diode D2. Inductor L1 is wound using 24 turns of 0.5mm enamelled copper wire around the toroid as shown in Fig.5. It is not wound in the conventional manner with even spacings of the windings around the core; rather the windings are concentrated over about 25% of the circumference. This unusual winding method is to keep any stray fields away from the infrared detector which is susceptible to picking up interference and producing erratic results. Do not use a commercially wound inductor as this will CAPACITOR CODES Value 0.47µF 0.1µF 0.01µF .0047µF 22pF IEC Code 470n 100n 10n 4n7 22p EIA Code 474 104 103 472 22 have even winding spacings around the core and will prevent the infrared receiver from operating properly. When you have finished winding the core, pot the windings in some 5- minute epoxy. This will reduce the audible buzz caused by the vibration of the windings when driving the lamp with phase control. When the epoxy has set, place the inductor in position on the PC board with the windings oriented towards the top and secure in place with a cable tie wrapped around the circumference and through the two holes in the PC board under the core. The wires from the core are soldered into the PC board by first cleaning off the insulation and tinning the wire ends. The windings will be in close contact with the Triac tab, however, the windings and tab are at essentially the same voltage so there is no particular reason to be concerned about insulating the windings from the tab. You may, however, wish to place a short The Clipsal CLIC2031VXBA blank wall plate shown here assembled with the PC board. The two nylon PC board mounting screws are on the left, the metal pan-head screw is at the bottom (its head is marginally above the plate surface to ensure contact with the aluminium cover plate), while the infrared receiver “lens” (actually part of an old neon bezel) is at the top. January 2002  31 length of insulating tape over the to be located as close as possiwindings in the vicinity of the ble to the inside surface of the Triac. plate for best reception of the infrared signal. Work can now begin on the underside of the PC board. The PC board is attached to the plate using countersunk Nylon The 4.7MΩ resistors are mountscrews adjacent to the screw ed first. You must use the specterminals and the countersunk ified Philips VR37 types here metal screw which secures into because they are rated at 2500V. the 6mm tapped standoff. The Use of standard 1W resistors will board stands off from the plate jeopardise the electrical safety of with two 6mm spacers for the the dimmer. You can recognise Nylon screws. Use M3 nuts to the VR37 types by their light blue secure the board in place. body and yellow tolerance band rather than a gold one. Note that you must use Nylon screws and not metal ones for the Cut the excess lead length off mounting points adjacent to the on the top of the PC board. Sol- Fig. 4: same-size PC board pattern for the main screw terminals. This is to ensure der the 6mm tapped spacer to unit. The extension will be published next month. electrical safety. the board by first securing it in The hole for the metal touch contact position with a screw from the As we mentioned earlier, screw is also countersunk a little. Don’t contact is made between the metal top side of the PC board. This will make this too deep, as the screw needs position the spacer correctly before plate and the circuit via a 3mm metal to sit proud of the top face by about machine screw. We used a pan-head soldering. 0.5mm to make reliable contact with (ie, slightly raised) countersunk If the infrared receiver does not the metal plate when it is attached. screw which, when installed, was come with an earthed metal shield, The hole for the infrared sensor just proud of the plastic surface by you will need to make one for it. It must have some form of permanent about half a millimetre or so. When can be made using some tinplate covering over it to prevent anyone the aluminium dress plate was salvaged from a tin can or lid. Cut (little people especially!) poking an- snapped into place, this screw made it out to shape with tin snips and ything inside the hole and possibly reliable contact. drill out the hole for the receiver making contact with the live parts lens. Now fold the shield around the And finally, another warning! inside. body of the receiver. Solder a short We used a clear LED bezel cover length of wire between the centre Just in case you missed the warning which was cut down in length and messages published elsewhere in this ground pin to the shield. The unit glued into the plate with super glue. is now secured to the underside project, let’s reiterate: Alternatively, you could cut the lens of the PC board as shown. This is a mains-powered project end off from a 240V neon bezel to cover with most parts floating at mains poNote that the shield and the copper over the hole on the plate. Mark out the tential. Do NOT attempt to operate it area below the sensor are at different position for the infrared receiver lens outside of a protective case or box – in potentials, so if the shield makes conon the plate and drill out this hole to fact, leave the testing until next month tact with the board it will short out suit the size of the plastic bezel. the 5V supply. Make sure there is no when we show you how to do it safely. Now attach the metal plate to the likelihood of shorting here. And if you are going to install it into plastic wall plate and drill out this your home, under current legislation A 0.1µF ceramic capacitor is solhole to suit the outer diameter of dered between the shield and PC you must be a licensed electrician the bezel lens. The bezel should not to even unscrew a wallplate or light board. protrude too far into the inside of switch. Hopefully, that may change Place the PC board onto the Clipsal SC the plastic plate as the sensor needs plastic wall plate with the infrared in the future! receiver to the side which has the mounting screws stowed away (unNext month: testing, installation, remote controls and extensions less, of course, you have already That’s about all there is to removed the screws!). This side has the basic dimmer. However, mouldings which encroach inside of we have yet to look at the the wall plate. testing procedure (which is Now mark out the hole positions done with low voltage for for the two mounting holes adjacent safety), the types of remote the 4-way screw terminals and for the controls suitable and how to touch contact screw which secures set the dimmer codes to suit, into the 6mm spacer next to the installation and also the oper4.7MΩ resistor. Drill 3mm holes for ation and construction of the each. The two mounting holes should remote touch panels/infrared be countersunk from the top side so receivers. We’ll cover all of that the Nylon mounting screws are this in February SILICON CHIP. flush with the top face. 32  Silicon Chip www.siliconchip.com.au