Silicon ChipMulti-Function Remote-Controlled Lamp Dimmer - April 2009 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Everyday solvents can be dangerous
  4. Feature: Digital Radio Is Coming, Pt.3 by Alan Hughes
  5. Feature: Wireless Networking With Ubuntu & Puppy Linux by Greg Swain
  6. Project: Multi-Function Remote-Controlled Lamp Dimmer by Mauro Grassi
  7. Project: School Zone Speed Alert by Jim Rowe
  8. Project: USB Printer Share Switch by Jim Rowe & Greg Swain
  9. Project: Build A Microcurrent DMM Adaptor by David L. Jones
  10. Review: Tektronix MSO2024 Mixed Signal Oscilloscope by Mauro Grassi
  11. Vintage Radio: The Airzone 520/550 5-valve mantel receiver by Rodney Champness
  12. Feature: Half-Duplex With HopeRF’s HM-TR UHF Transceivers by Stan Swan
  13. Book Store
  14. Advertising Index
  15. Outer Back Cover

This is only a preview of the April 2009 issue of Silicon Chip.

You can view 33 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.

Articles in this series:
  • Digital Radio Is Coming, Pt.1 (February 2009)
  • Digital Radio Is Coming, Pt.1 (February 2009)
  • Digital Radio Is Coming, Pt.2 (March 2009)
  • Digital Radio Is Coming, Pt.2 (March 2009)
  • Digital Radio Is Coming, Pt.3 (April 2009)
  • Digital Radio Is Coming, Pt.3 (April 2009)
  • Digital Radio Is Coming, Pt.4 (June 2009)
  • Digital Radio Is Coming, Pt.4 (June 2009)
  • Digital Radio Is Coming, Pt.5 (August 2009)
  • Digital Radio Is Coming, Pt.5 (August 2009)
Items relevant to "Multi-Function Remote-Controlled Lamp Dimmer":
  • Intelligent Remote-Controlled Dimmer PCB [10104092] (AUD $10.00)
  • PIC18F1320-I/SO programmed for the Intelligent Dimmer [1010409A.HEX] (Programmed Microcontroller, AUD $15.00)
  • PIC18F1320 firmware and source code for the Intelligent Remote-Controlled Dimmer [1010409A.HEX] (Software, Free)
  • Intelligent Remote-Controlled Dimmer PCB pattern (PDF download) [10104092] (Free)
  • Intelligent Remote-Controlled Dimmer panel artwork (PDF download) (Free)
Items relevant to "USB Printer Share Switch":
  • Manual 2-Way USB Device Switch PCB [07104091] (AUD $5.00)
  • USB Print Share Switch PCB pattern (PDF download) [07104091] (Free)
  • USB Printer Share Switch front panel artwork (PDF download) (Free)
Articles in this series:
  • Amateur Radio (November 1987)
  • Amateur Radio (November 1987)
  • Amateur Radio (December 1987)
  • Amateur Radio (December 1987)
  • Amateur Radio (February 1988)
  • Amateur Radio (February 1988)
  • Amateur Radio (March 1988)
  • Amateur Radio (March 1988)
  • Amateur Radio (April 1988)
  • Amateur Radio (April 1988)
  • Amateur Radio (May 1988)
  • Amateur Radio (May 1988)
  • Amateur Radio (June 1988)
  • Amateur Radio (June 1988)
  • Amateur Radio (July 1988)
  • Amateur Radio (July 1988)
  • Amateur Radio (August 1988)
  • Amateur Radio (August 1988)
  • Amateur Radio (September 1988)
  • Amateur Radio (September 1988)
  • Amateur Radio (October 1988)
  • Amateur Radio (October 1988)
  • Amateur Radio (November 1988)
  • Amateur Radio (November 1988)
  • Amateur Radio (December 1988)
  • Amateur Radio (December 1988)
  • Amateur Radio (January 1989)
  • Amateur Radio (January 1989)
  • Amateur Radio (April 1989)
  • Amateur Radio (April 1989)
  • Amateur Radio (May 1989)
  • Amateur Radio (May 1989)
  • Amateur Radio (June 1989)
  • Amateur Radio (June 1989)
  • Amateur Radio (July 1989)
  • Amateur Radio (July 1989)
  • Amateur Radio (August 1989)
  • Amateur Radio (August 1989)
  • Amateur Radio (September 1989)
  • Amateur Radio (September 1989)
  • Amateur Radio (October 1989)
  • Amateur Radio (October 1989)
  • Amateur Radio (November 1989)
  • Amateur Radio (November 1989)
  • Amateur Radio (December 1989)
  • Amateur Radio (December 1989)
  • Amateur Radio (February 1990)
  • Amateur Radio (February 1990)
  • Amateur Radio (March 1990)
  • Amateur Radio (March 1990)
  • Amateur Radio (April 1990)
  • Amateur Radio (April 1990)
  • Amateur Radio (May 1990)
  • Amateur Radio (May 1990)
  • Amateur Radio (June 1990)
  • Amateur Radio (June 1990)
  • Amateur Radio (July 1990)
  • Amateur Radio (July 1990)
  • The "Tube" vs. The Microchip (August 1990)
  • The "Tube" vs. The Microchip (August 1990)
  • Amateur Radio (September 1990)
  • Amateur Radio (September 1990)
  • Amateur Radio (October 1990)
  • Amateur Radio (October 1990)
  • Amateur Radio (November 1990)
  • Amateur Radio (November 1990)
  • Amateur Radio (December 1990)
  • Amateur Radio (December 1990)
  • Amateur Radio (January 1991)
  • Amateur Radio (January 1991)
  • Amateur Radio (February 1991)
  • Amateur Radio (February 1991)
  • Amateur Radio (March 1991)
  • Amateur Radio (March 1991)
  • Amateur Radio (April 1991)
  • Amateur Radio (April 1991)
  • Amateur Radio (May 1991)
  • Amateur Radio (May 1991)
  • Amateur Radio (June 1991)
  • Amateur Radio (June 1991)
  • Amateur Radio (July 1991)
  • Amateur Radio (July 1991)
  • Amateur Radio (August 1991)
  • Amateur Radio (August 1991)
  • Amateur Radio (September 1991)
  • Amateur Radio (September 1991)
  • Amateur Radio (October 1991)
  • Amateur Radio (October 1991)
  • Amateur Radio (November 1991)
  • Amateur Radio (November 1991)
  • Amateur Radio (January 1992)
  • Amateur Radio (January 1992)
  • Amateur Radio (February 1992)
  • Amateur Radio (February 1992)
  • Amateur Radio (March 1992)
  • Amateur Radio (March 1992)
  • Amateur Radio (July 1992)
  • Amateur Radio (July 1992)
  • Amateur Radio (August 1992)
  • Amateur Radio (August 1992)
  • Amateur Radio (September 1992)
  • Amateur Radio (September 1992)
  • Amateur Radio (October 1992)
  • Amateur Radio (October 1992)
  • Amateur Radio (November 1992)
  • Amateur Radio (November 1992)
  • Amateur Radio (January 1993)
  • Amateur Radio (January 1993)
  • Amateur Radio (March 1993)
  • Amateur Radio (March 1993)
  • Amateur Radio (May 1993)
  • Amateur Radio (May 1993)
  • Amateur Radio (June 1993)
  • Amateur Radio (June 1993)
  • Amateur Radio (July 1993)
  • Amateur Radio (July 1993)
  • Amateur Radio (August 1993)
  • Amateur Radio (August 1993)
  • Amateur Radio (September 1993)
  • Amateur Radio (September 1993)
  • Amateur Radio (October 1993)
  • Amateur Radio (October 1993)
  • Amateur Radio (December 1993)
  • Amateur Radio (December 1993)
  • Amateur Radio (February 1994)
  • Amateur Radio (February 1994)
  • Amateur Radio (March 1994)
  • Amateur Radio (March 1994)
  • Amateur Radio (May 1994)
  • Amateur Radio (May 1994)
  • Amateur Radio (June 1994)
  • Amateur Radio (June 1994)
  • Amateur Radio (September 1994)
  • Amateur Radio (September 1994)
  • Amateur Radio (December 1994)
  • Amateur Radio (December 1994)
  • Amateur Radio (January 1995)
  • Amateur Radio (January 1995)
  • CB Radio Can Now Transmit Data (March 2001)
  • CB Radio Can Now Transmit Data (March 2001)
  • What's On Offer In "Walkie Talkies" (March 2001)
  • What's On Offer In "Walkie Talkies" (March 2001)
  • Stressless Wireless (October 2004)
  • Stressless Wireless (October 2004)
  • WiNRADiO: Marrying A Radio Receiver To A PC (January 2007)
  • WiNRADiO: Marrying A Radio Receiver To A PC (January 2007)
  • “Degen” Synthesised HF Communications Receiver (January 2007)
  • “Degen” Synthesised HF Communications Receiver (January 2007)
  • PICAXE-08M 433MHz Data Transceiver (October 2008)
  • PICAXE-08M 433MHz Data Transceiver (October 2008)
  • Half-Duplex With HopeRF’s HM-TR UHF Transceivers (April 2009)
  • Half-Duplex With HopeRF’s HM-TR UHF Transceivers (April 2009)
  • Dorji 433MHz Wireless Data Modules (January 2012)
  • Dorji 433MHz Wireless Data Modules (January 2012)

Purchase a printed copy of this issue for $10.00.

Multi-function, Intelligent RemoteControlled Dimmer You probably think that a dimmer is a dimmer is a dimmer, right? This little beauty will definitely change your mind! Main Features • by Mauro Grassi 22  S 22   Silicon iliconCChip hip Five Modes of Operation: (1) Dimmer with Time Ou t (2) ON/OFF control only (3) Sleep Mode – dims gra dually to off over the timeou t period (4) Flash mode – functions as a strobe light (5) Security mode – turns a light on and off random ly to simulate occupancy • Use almost any RC5 remote controller– it learns the remote contro l codes • Low standby power consumption (1.1W) Nin • e preset brightness levels with fine trol in between • Controls lamps up to 500W (eg, halogencon • ON/OFF control for non-dimmable compacspotlights) t fluorescents • Multi-Addressable: control up to nine dimme • Time Out Period: from 1 minute to 7 days (cars independently • Save and restore your favourite brightness n be disabled) • Remembers the last brightness level & mo level and mode • Customisable Triac triggering for finer con de if turned off using a series switch • Customisable dimming speed (advanced) trol (advanced) siliconchip.com.au The (very!) intelligent dimmer shown here with an infrared remote control. It can be used with just about any remote control which uses the RC5 protocol. You can see the infrared receiver and acknowledge LEDs through the “window” in the front panel. T HIS REMOTE CONTROLLED DIMMER will work with incandescent and dimmable CFL (compact fluorescent) lights, as well as some 12V halogen lights. It can provide mood and home-theatre lighting or operate in SLEEP mode (eg, in an infant’s room) to very gradually fade a lamp. This dimmer also has intelligence – it can automatically turn off the light after a timeout period ranging from one minute to almost a week, ensuring the light is not left on if you forget to switch it off. It can also be used to control non-dimmable CFLs. In this mode, we simply turn the CFL ON and OFF (note: it may not be suitable with some nondimmable CFLs which tend to flicker in the “OFF” state). Want to individually dim more than one table lamp in a room? No problem. You could have up to nine of these dimmers in a room independently controllable with the same remote. In addition, you can also control two or more dimmers simultaneously! You can use almost any RC5 remote control, because the light dimmer can be programmed to learn the command codes. Pretty neat, eh? You use the number keys to dim to a preset level or the VOL UP and VOL DOWN keys to dim up or down in fine increments. Button “0” dims down to off, while “9” dims up to fully on. In addition, we have attempted to provide just about every possible remote control feature in this design. It is quite a simple circuit but the microcontroller’s program provides all these features. Circuit description The circuit is based around a PIC18F1320 microcontroller which controls the Triac and responds to all the remote control commands. In addition, there is the infrared decoder IDR1, two RGB LEDs, an NPN transistor, two diodes, a zener diode, a 10MHz crystal and an inductor and a few resistors and capacitors. siliconchip.com.au The Triac is connected between the mains Active and the lamp via inductor L1. In conjunction with a 100nF 250VAC capacitor, this inductor provides suppression of electromagnetic interference caused by the rapid switching of the Triac. The micro sends gate pulses to the Triac via NPN transistor Q1 and ultra-fast recovery diode D2. The diode protects the transistor from spikes generated when the Triac changes state from conducting to non-conducting and vice versa. The micro controls the power level fed to the lamps by the Triac by varying the timing of the gate pulse during each half-cycle of the 230VAC mains waveform. If the gate pulse is early in each half cycle, the power level will be high (ie, the lamp will be bright). Conversely, if the gate pulse comes late in each half-cycle, the power level will be low (ie, the lamp will be dim). This method of power control is referred to as “phase control”. WARNING! This circuit is directly connected to the 230VAC mains. As such, all parts operate at mains potential (ie, at 230VAC) and contact with any part of the circuit could be FATAL. This includes both sides of the PC board. DO NOT connect this device to the mains unless it is fully enclosed in the specified plastic case. DO NOT remove the lid of the case or touch any part of the circuit unless the power cord is unplugged from the mains socket. This project is not for the inexperienced. DO NOT attempt to build it unless you know exactly what you are doing and are completely familiar with mains wiring practices and construction techniques. April 2009  23 100Ω 100 µF 16V 100nF IRD1 6 RGB LED1 Kb λ A 2 Kr λ A 1 Kg λ A 14 3 λ 1kΩ 470 µF 16V Vdd 1 2 10 RB4 RA2 RA1 470Ω RA0 4 RB1 MCLR Kb λ A 3 Kr λ A Kg λ A RB2 RB3 15 X1 10MHz 22pF 22pF 16 17 A1 G A Vss 5 (LINK* ) 470nF 250VAC X2 1kΩ 5W D2 UF4004 D1 1N4004 A K 100Ω RGB LED2 470Ω B Q1 BC337 18 CAUTION ALL COMPONENTS AND WIRING OPERATE AT 230V MAINS POTENTIAL. CONTACT CAN BE FATAL! C E LAMP ACTIVE 3 LAMP NEUTRAL 4 MAINS NEUTRAL NOTE* : COMPONENT VALUES SHOWN IN GREEN ARE FOR 12V AC OPERATION ONLY AND ARE REQUIRED FOR SAFE TESTING BEFORE MAINS CONNECTION 3.3M Ω 1W RB0/ 8 INT0 10kΩ 1W* 4.7nF BC337 IRD1 A SC MAINS ACTIVE 2 470 Ω 5W* A D1, D2, ZD1 2009 100nF 250VAC X2 L1 47 µH 5A A2 OSC2 OSC1 CON1 1 K 9 IC1 RA4 PIC18F1320 7 I/SO RA3 ZD1 5.6V 1W TRIAC1 BTA16-500 K E 1 K IR REMOTE CONTROL LIGHT DIMMER MODULE 3 2 BTA16-500 B C RGB LEDS CHAMFER A Kg Kb A1 A2 G Kr Fig.1: the circuit is based on a PIC18F1320-I/SO microcontroller, a Triac and an IR detector (IRD1). The two RGB LEDs give the user feedback on the operation and settings. In order to know when in each half cycle to issue the gate trigger pulse, the microcontroller must be properly synchronised to the mains waveform at 50Hz. This is accomplished by a sync pulse taken directly from the neutral mains connection via a 3.3MΩ 1W resistor. The sync signal is filtered by a 4.7nF capacitor which forms a low-pass filter with the 3.3MΩ resistor and synchronisation occurs every half-cycle of the mains waveform, at a 100Hz rate. Power supply You may wonder how the micro can be synchronised to the mains waveform by connecting it to the Neutral side of the mains supply. Isn’t this the low-voltage side of things? Yes it is but the microcontroller is actually tied to the Active side of the mains supply. Power for the micro is derived from the mains via a 1kΩ 5W resistor and 470nF capacitor. The capacitor and resistor act as a current limiting impedance for the associated 5.6V zener diode, ZD1. The supply circuit works as follows. First, for positive half-cycles of the 230VAC, current flows via ZD1, the 470nF capacitor and 1kΩ 5W resistor. At the same time, the 470μF 16V electrolytic capacitor is charged up. Then, for negative half cycles of the mains, current flows via D1, the 470nF capacitor and the 1kΩ resistor. The result is that the 470μF capacitor is charged to 5.6V - 0.6V = 5V DC. The impedance of the 470nF capacitor at 50Hz is 6.77kΩ 24  Silicon Chip and in series with the 1kΩ resistor this gives a total impedance of 6.84kΩ. Hence the 5V supply can deliver up to 23mA. Apart from the current drain of the micro itself and IRD1, the circuit must supply the gate power to the Triac and drive the two RGB LEDs. These LEDs are connected with each of the six cathodes connected to a different I/O pin of the micro, IC1. The common anodes of the two RGB LEDs are connected together and to the 5V rail via a single 1kΩ current limiting resistor. For this reason, only one LED (there are three within each RGB LED) is ever lit at any one time. The LEDs are lit to acknowledge key presses, to prompt Programming The PIC Micro If you purchase this project as a kit, the PIC microcontroller will be pre-programmed. If not, you will need to program the PIC with the file 1010409A.hex before soldering it to the PC board. To do this, refer to the “PIC Programmer SOIC Converter” published in the November 2007 issue (page 67) of SILICON CHIP. That simple project will allow you to interface the SMD PIC to a common PIC programmer with a ZIF socket. The PC board for this adaptor is available from RCS Radio. Alternatively, SILICON CHIP can supply a programmed PIC for $A25 including postage. siliconchip.com.au Parts List – Intelligent Dimmer Fig.2: this oscilloscope screen grab shows an incandescent lamp being switched using phase control. The yellow trace shows the waveform at the A2 terminal of the Triac. the user for input and to give feedback on current settings. We explain the user operation in detail below. Signals from the IR remote control are amplified, filtered and decoded by the receiver module (IRD1). The 100Ω resistor and 100μF capacitor are used to decouple its 5V supply. The data output at pin 1 of IRD1 is connected to pin 10 of IC1 and configured as a digital input. Construction The Intelligent Dimmer is built on a single-sided PC board coded 10104091 and measuring 76 x 50mm. It is housed in a sturdy polycarbonate case (125 x 85 x 55mm) with a clear lid and neoprene lid-sealing gasket. The component overlay diagrams for both sides of the PC board are shown in Fig.3. Note that the circuit diagram and Fig.3 both show three components which must initially be installed to allow the dimmer to operate at 12VAC. This enables you to check its operation at a safe low voltage before changing these parts to allow it to operate at 230VAC. To build the 12VAC version, you simply install a wire link in place of the 470nF 250VAC capacitor, a 470Ω 5W resistor instead of the 1kΩ 5W unit and a 10kΩ 1W resistor instead of the 3.3MΩ 1W unit. Check the PC board for any defects before starting the assembly. That done, the next job is to install the programmed PIC microcontroller on the copper side of the board. Note that the microcontroller is a SMD and must be the 18F1320-I/SO (in the SOIC 18-pin package). Make sure it is oriented correctly. You will need a fine-tipped soldering iron to do the job. Position the IC over the pads and solder pins 17 & 18 first. Then solder pin 9, followed by the remaining pins. Be careful not to get solder bridges between adjacent pins. If you do, a good way to remove them is to use solder wick (Jaycar NS-3026, Altronics T-1210). Once the micro is in, flip the board over and install the parts on the component (top) side. Start by installing the four wire links, plus the link in place of the 470nF 250VAC capacitor. Follow these with the seven resistors. Start with the smallest and leave the 470Ω 5W wirewound resistor until last. Install the diodes next. These are polarised so be sure to siliconchip.com.au 1 PC board, code 10104091, 76 x 50mm 1 IP65 sealed ABS plastic case with clear lid, 125 x 85 x 55mm (Jaycar HB-6246, Altronics H-0324) 1 flush-mount 3-pin mains socket (Jaycar PS-4094, Altronics P-8241) 1 IEC male chassis connector with mounting holes (Jaycar PP-4005, Altronics P-8320B) 1 10MHz crystal (X1) 1 47μH 5A inductor (Jaycar LF-1274, Altronics L-6617) 1 4-way “Dinkle” vertical socket (CON1) (Jaycar HM3114, Altronics P-2534) 1 4-way “Dinkle” screw terminal plug (Jaycar HM-3124, Altronics P-2814) 1 10A IEC mains cord Semiconductors 1 PIC18F1320-I/SO SOIC microcontroller (Farnell 9762027) programmed with 1010409A.hex (IC1) 1 IR receiver (Jaycar ZD-1952, Altronics Z-1611) 1 BTA16-500 isolated tab Triac (TRIAC1), Altronics Z-1710 – DO NOT substitute 1 BC337 NPN transistor (Q1) 2 RGB 5mm common anode LEDs (LEDs 1 & 2) 1 1N4004 diode (D1) 1 UF4004 ultrafast diode (D2) 1 1N4734 1W 5.6V zener diode (ZD1) Capacitors 1 470μF 16V electrolytic 1 100μF 16V electrolytic 1 470nF (0.47μF) 250VAC X2 metallised polypropylene (Jaycar RG-5240, Altronics R-3132) 1 100nF (0.1μF) 250VAC X2 metallised polypropylene (Jaycar RG-5236, Altronics R-3122) 1 100nF MKT (code 104, 100n or 0.1) 1 4.7nF MKT (code 471, 4n7 or 0.0047) 2 22pF ceramic (code 22p) Resistors (0.25W, 1% unless specified) 1 3.3MΩ 1W 2 470Ω 1 10kΩ 1W* 1 470Ω 5W wirewound* 1 1kΩ 2 100Ω 1 1kΩ 5W wirewound (* 12V operation only) Miscellaneous 3 M3 x 25mm Nylon screws (to secure PC board) 2 M3 x 15mm Nylon screws (for IEC connector) 3 M3 x 12mm Nylon spacers 10 M3 Nylon nuts 1 100mm of 0.7mm-dia. tinned copper wire (for links) 1 200mm length 3-core mains flex (250V 10A rating) 1 4.8mm red spade connector, fully insulated 1 4.8mm blue spade connector, fully insulated 1 4.8mm yellow spade connector, fully insulated 5 100mm cable ties Additional Parts Required For testing 1 12V AC 500mA or 1A plugpack 1 12V 300mA light globe (Jaycar SL-2656, Altronics S-4047) April 2009  25 The “normal” component side of the PC board carries most of the components . . . get their orientation correct. The zener diode and the 1N4004 go in the top righthand corner, while the UF4004 (D2) goes near the Triac. Now solder in the BC337 NPN transistor (Q1). It can only go in one way. That done, bend the leads of the Triac down by 90° about 9mm from its body, then install it so that it sits horizontally on the PC board (metal tab down) as shown in Fig.3 and the photos. Do not substitute for the Triac – check its part number carefully. The capacitors can now go in. The two larger electrolytic capacitors must be oriented correctly. The 47μH inductor is next on the list – it sits vertically on the PC board. Make sure that the enamel coating on the leads is stripped away on the tips prior to soldering. Follow with the 4-way socket (CON1) and the 10MHz crystal. . . . however there are four, including the microcontroller, mounted on the copper side (see enlargement at left). Note particularly the orientation of CON1 – it must be installed exactly as shown, with its grooved side towards the righthand edge of the PC board. Now flip the PC board over to the copper side again. There are three more components to be fitted to this side: the two RGB LEDs and the infrared receiver module IRD1. Start with the two RGB LEDs. These go in with a very specific orientation so refer to the component overlay before proceeding. Be careful not to use too much heat when you solder in the LEDs because excessive heat can easily destroy them (or the fine connecting leads inside the RGB LED). We recommend using a temperature-controlled soldering station set to no more than around 300°C. The RGB LEDs sit about 5mm from the PC board and you will need to also be careful that you don’t melt their plastic housing Another view of the completed top side of the PC board, this time mounted on the case lid (note: mains version shown). Be sure to attach the warning label to the inside of the lid, as shown. 26  Silicon Chip siliconchip.com.au Fig.3: the component overlay for both sides of the PC board. Remember that the low-voltage version (green components) MUST be built first and the module then tested using a 12V AC plugpack. Only if the low-voltage version passes testing should you proceed to install the three components needed for mains operation (marked with an asterisk – see text). as you solder the leads to the copper side. Finally, solder in the infrared receiver module (IRD1). Its mounted with its leads bent down by 90° about 10mm from its body. Make sure its domed lens faces upwards, as shown in the close-up photo. Testing on low voltage Your dimmer is now ready for its low-voltage operation tests. First, connect a 12V light bulb (Jaycar SL-2656, Altronics S-4047) between the LAMP ACTIVE and LAMP NEUTRAL connections on the 4-way screw terminal block CON1 (ie, between pins 2 & 3). That done, apply 12VAC from a plugpack supply to pins 1 & 4 of CON1. You can then use your remote control to run through the various dimmer modes and functions (see features panel). Note that the low voltage version may show signs of flickering at high-brightness settings because the synchronisation with the zero crossings of the mains will be offset by the AC plugpack. This problem should not occur with mains operation. Converting to mains operation Having successfully tested the circuit with a 12V AC plugpack and light bulb, you can now disconnect power and install the three components for mains operation: the 470nF 250VAC X2 capacitor (ie, remove the link), the 85 (LEFT-HAND END OF BOX) (RIGHT-HAND END OF BOX) ALL DIMENSIONS IN MILLIMETRES 28.5 6 55 5 18 5 6 14 33.5 10.9 19 5 CUTOUT FOR GPO A A 14 HOLES A: 3.0mm DIAMETER, HOLE B: 4.5mm DIAMETER B CUTOUT FOR IEC MAINS INPUT PLUG 9.5 15 20.75 16.75 Fig.4 (above): the cutouts you will need to make in the case to accommodate the IEC mains input connector and the 230V mains outlet on the opposite end. Fig.5 (left) shows how the PC board “hangs” from the case lid on M3 x 12mm tapped Nylon spacers. Be sure to use Nylon screws and nuts to secure the assembly siliconchip.com.au April 2009  27 SPADE CONNECTORS WITH HEATSHRINK SLEEVES DINKLE CONNECTOR (INVERTED) CABLE TIE MAINS ACTIVE LAMP ACTIVE LAMP NEUTRAL MAINS NEUTRAL A N E N IEC MALE MAINS INPUT CABLE TIE E A NOTE: USE ADDITIONAL CABLE TIES TO SECURE MAINS WIRES TO GPO LUGS – SEE PHOTO GPO MAINS PANEL OUTPUT (LOWER PART OF CASE) Fig.6: this diagram shows the wiring within the case and the lengths of mains-rated cable you’ll need. Match this with the photograph below and you can’t go wrong! 80mm LONG 120mm LONG NEUTRAL ACTIVE EARTH This close-up view shows how the GPO outlet socket is wired. Note how the wires are secured to the socket using cable ties. 3.3MΩ 1W resistor and the 1kΩ 5W resistor. Having done that, the case can then be prepared to accept the hardware. We used an IP65 sealed ABS case with clear lid and with dimensions of 125 x 85 x 55mm. You will need to make two cut-outs in the sides to fit the male chassis-mount IEC socket and the 3-pin GPO outlet socket. The template is shown in Fig.4. The IEC socket is attached using two Nylon M3 x 12mm screws and four nuts. The second nut at each location locks the first in place, to ensure that the IEC socket cannot possibly come loose. Important: do NOT use metal screws to secure the IEC socket 28  Silicon Chip (or PC board). Because all the circuitry inside the case will be at 230VAC potential we don’t want any exposed metalwork on the case, so Nylon screws must be used. For the same reason, you must house this project in the specified plastic case. DO NOT use a metal case. You now need to make the internal connections between the IEC input socket, the 4-way “Dinkle” plug connector for the PC board and the 3-pin GPO socket. Use 250VAC 3-core flex for this job. Strip the outer sheath to reveal the three coloured wires – brown is for Active, blue is for the Neutral and green/yellow is for the Earth connection. siliconchip.com.au The Dinkle connector is plugged into CON1 as shown here. Make sure that its mains Active lead is adjacent to zener diode ZD1 on the PC board, with the Neutral wires towards the 1kΩ 5W resistor. Be sure to wire the Dinkle connector plug exactly as shown in Fig.6 and the photo below it. A ratchet-driven crimping tool is needed to crimp the ends of three wires connecting to the male IEC socket with the 4.8mm spade lugs. Don’t rely on squeezing with plier-type (automotive) crimpers, as these will not give safe, reliable connections. The connections are shown in Fig.6. If you are unable to obtain fully-insulated 4.8mm connectors, then use non-insulated connectors but be sure to fully insulate them using 6mm-diameter heatshrink tubing after the leads have been crimped – see photo. Use cable ties to secure the mains wiring as shown in Fig.6 and the photos. Note particularly how the Active, Neutral and Earth leads are connected to the GPO outlet socket and secured using cable ties. The terminals are marked “L” (for Active or Live), “N” for Neutral and “E” for Earth. Check that each mains wire is run to its correct terminal on both the outlet socket and the IEC input connector. Drilling the lid The next step is to drill the mounting holes in the lid for the PC board. Fig.8 shows the mounting hole locations and can be used as a drilling template. The front-panel label can then be attached. Cover the label with clear film and cut out the window before fitting it. It can be affixed to the lid using a thin smear of neutral-cure silicone sealant as the adhesive. Finally, cut out the three PC board mounting Important Points To Check (1) Be sure to use the specified ABS plastic case & note that Nylon screws must be used to secure the IEC connector and to secure the PC board to the lid (via tapped Nylon spacers). (2) Use mains-rated cable for all connections to the IEC mains socket and to the flush-mount 3-pin mains outlet socket. Secure these leads with cable ties as shows in Fig.6 & the photos. (3) Use fully insulated spade connectors to terminate the leads to the IEC connector. A ratchet-driven crimping tool is necessary to fit these spade connectors and ensure safe, reliable connections. siliconchip.com.au Are Your Issues Getting Dog-Eared? $13.95 REAL VALUE AT PLUS P &P Are your SILICON CHIP copies getting damaged or dog-eared just lying around in a cupboard or on a shelf? Can you quickly find a particular issue that you need to refer to? Keep your copies of SILICON CHIP safe, secure and always available with these handy binders Available Aust, only. Price: $A13.95 plus $7 p&p per order (includes GST). Just fill in and mail the handy order form in this issue; or fax (02) 9939 2648; or call (02) 9939 3295 and quote your credit card number. April 2009  29 SILICON SILIC CHIP Order Form/Tax Invoice Silicon Chip Publications Pty Ltd ABN 49 003 205 490 www.siliconchip.com.au PO BOX 139, COLLAROY NSW 2097 eMAIL: silchip<at>siliconchip.com.au Phone (02) 9939 3295 Fax (02) 9939 2648 YOUR DETAILS Your Name__________________________________________________________________________________________________ (PLEASE PRINT) Address______________________________­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­___________________­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­___________________________________________________ Postcode__________ Daytime Phone No. ( )____________________ Email address ________________________________ Method of Payment: q EFT (ring or email for details) q Cheque/Money Order q Visa Card q Master Card Card No.                                Card expiry date: Signature_________________________________________________ YOUR ORDER (SILICON CHIP SUBSCRIBERS QUALIFY FOR 10% DISCOUNT (except subscriptions!) SIMPLY TICK THE ITEMS REQUIRED – DON'T FORGET TO FILL IN DETAILS ABOVE. WE'LL WORK THE TOTAL OUT FOR YOU AND SEND YOU A RECEIPT WITH YOUR ORDER SILICON CHIP SUBSCRIPTIONS (all prices include P&P) q q q q q q q q AUSTRALIA 12 MONTHS (INC. GST)..............................................................$89.50 AUSTRALIA 12 MONTHS WITH BINDER (INC. GST) ...................................$105.00 AUSTRALIA 24 MONTHS (INC. GST)............................................................$172.00 AUSTRALIA 24 MONTHS WITH BINDER (INC. GST) ...................................$203.00 NEW ZEALAND 12 MONTHS (AIR MAIL)................................................... $AU96.00 NEW ZEALAND 24 MONTHS (AIR MAIL) ............................................... $AU190.00 OVERSEAS (EXCEPT NZ) 12 MONTHS (AIR MAIL).................................. $AU135.00 OVERSEAS (EXCEPT NZ) 24 MONTHS (AIR MAIL) ................................ $AU260.00 OTHER ITEMS q SILICON CHIP BACK ISSUES – $9.50 within Australia; $13.00 overseas – includes P&P – (where in stock - photocopy of article supplied where issue is out of stock). Price is for each back issue or each article photocopy *Nominate issue and article required: Month:...................................... Year:......................... Article required if no back issue:............................................................................................. q ELECTRONICS AUSTRALIA/ETI ARTICLE PHOTOCOPIES (sorry, all back issues are now out of stock). Price is for each article photocopy – price includes P&P – .......................................$9.50 within Australia; $13.00 overseas *Nominate issue and article required: Magazine: ......................................... Month:...................................... Year:......................... Article required:...................................................................................................................... *Please attach list if more than one back issue or photocopy required. There is a 10% discount for ten or more back issues and//or photocopies q SILICON CHIP MAGAZINE BINDERS (Available Australia only)............$13.95 (P&P is $7.00 per order; buy five or more in one order for FREE P&P) P&P RATES: Subscriptions, back issues and project reprints: P&P included Binders (available Australia only): $7.00 per order; for 5 or more P&P is free. Books: Aust. $7 per order; NZ: $AU12 per book; Elsewhere $AU18 per book SILICON CHIP BOOKSHOP (P&P additional – See below) q q q q q q q q q q q q q q q p q q q q q p q q q q q q q q q AC MACHINES................................................................................................ $66.00 AMATEUR SCIENTIST CD .............................................................................. $62.00 ANALOG CIRCUIT TECHNIQUES W/DIGITAL INT........................................... $88.00 ANALOG ELECTRONICS............................................................................... $100.00 AUDIO ELECTRONICS.................................................................................. $101.00 AUDIO POWER AMPLIFIER DESIGN ............................................................ $87.00 DVD PLAYERS AND DRIVES ........................................................................ $85.00 ELECTRIC MOTORS AND DRIVES.................................................................. $55.00 ELECTRONIC PROJECTS FOR CARS.............................................................. $12.95 HANDS-ON ZIGBEE ....................................................................................... $96.50 MICROCONTROLLER PROJECTS IN C FOR 8051.......................................... $81.00 NEWNES GUIDE TO TELEVISION AND VIDEO TECHNOLOGY........................ $60.50 OP AMPS FOR EVERYONE........................................................................... $137.00 PERFORMANCE ELECTRONICS FOR CARS.................................................... $19.80 PIC IN PRACTICE........................................................................................... $60.00 PIC MICROCONTROLLERS - KNOW IT ALL................................................... $79.95 PIC MICROCONTROLLER - PERSONAL INTRO COURSE............................... $52.00 POWER SUPPLY COOKBOOK....................................................................... $109.00 PRACTICAL GUIDE TO SATELLITE TV ((NEW! 7th edition)........................... $49.00 PRACTICAL RF HANDBOOK .......................................................................... $80.00 PRACT. VARIABLE SPEED DRIVES/POWER ELECT........................................ $94.00 PROGRAMMING 16-BIT MICROCONTROLLERS IN C.................................... $80.50 RADIO, TV AND HOBBIES ON DVD-ROM ...................................................... $62.00 RF CIRCUIT DESIGN...................................................................................... $67.00 ROBOT BUILDER'S COOKBOOK..................................................................... $63.00 SELF ON AUDIO (2nd edition)........................................................................ $83.00 SOLAR SUCCESS - GETTING IT RIGHT EVERY TIME (NEW!)........................ $47.50 SOLAR THAT REALLY WORKS (NEW!).......................................................... $42.50 SWITCHING POWER SUPPLIES A-Z (inc CD-ROM)..................................... $106.00 TV ACROSS AUSTRALIA (NEW!)................................................................... $49.95 VIDEO SCRAMBLING AND DESCRAMBLING................................................. $95.00 eMAIL (24/7) MAIL FAX (24/7): (02) 9939 2648 TO PLACE silchip<at>siliconchip.com.au OR Fax this form (or a photo- OR This form to PO Box 139 OR 30  S ilicon C hiporder & credit card details with Collaroy NSW 2097 YOUR ORDER copy) with all details                *ALL TITLES SUBJECT TO AVAILABILITY. PRICES VALID FOR MONTH OF MAGAZINE ISSUE ONLY. ALL PRICES INCLUDE GST PHONE – (9-5, Mon-Fri) Call (02) 9939 3295 with siliconchip.com.au your credit card details 03/09 8 A 40 Drilling Template for Lid Recess A This view shows the prototype before the front panel was fitted. A 67.5 16 ALL DIMENSIONS IN MILLIMETRES WARNING! ALL PARTS OPERATE AT LETHAL VOLTAGE. DO NOT CONNECT TO MAINS UNLESS ENCLOSED IN CASE. Fig.8: this warning label should be affixed inside the case, eg, to the lid. HOLES “A” 3.0mm DIAMETER, COUNTERSINK Fig.8: use this diagram as a drilling template for the case lid (it fits in the recess in the top of the lid). SILICON CHIP www.siliconchip.com.au Warning: all parts inside operate at high voltage holes using a sharp knife. To improve the presentation in the magazine, we sprayed the outside of the case with a cream gloss plastic paint but this step is unnecessary for the home constructor. This was done before the label was attached and after first removing the wiring and the two sockets and masking off the holes so that no paint could get inside. The lid was left on but the top recess was masked off to leave a clear window for the LEDs and IR receiver. If you do elect to paint the case, use plastic paint and make sure that no paint gets inside as this could compromise its insulation properties. Mounting the PC board The PC board is mounted on the clear lid of the case using three M3 x 25mm Nylon screws, three M3 x 12mm Nylon spacers and six nuts – see Fig.5. Note again that you must use Nylon screws and standoffs to ensure safety. Once the board has been mounted, the Dinkle connector can be plugged into CON1. As shown in one of the photos, it should go in with its screw terminals towards the 470nF 250VAC capacitor and with the “Mains Active” wire adjacent to zener diode ZD1. Check this carefully, then attach the lid to the case. Getting it going The next step is to use your multimeter (set to a low ohms range) to check between the earth pin of the IEC connector and the earth pin of the flush-mounting mains output socket. You should get a reading of zero ohms here (this checks the integrity of the earth connection). Before applying power, refer to the warning panel earlier in the article. All the circuitry operates at 230VAC and you must NOT connect this device to a mains wall socket unless it is fully enclosed in its plastic case (ie, with the lid on). If it’s plugged in, the circuit could still be live even if the mains switch is off at the wall – ie, if Active and Neutral have been transposed at the wall socket. You have been warned! Provided the lid is fastened down, you can now plug in a lamp and apply mains power to the unit via the IEC siliconchip.com.au CUT OUT THIS WINDOW BEFORE ATTACHING LABEL t n o C e t t Remo n Intellige er m m i D rolled 500W MAX Fig.9: this full-size artwork for the front panel can also be downloaded from our website. socket. If you are using a Digitech remote control from Jaycar (Cat. AR-1726), just set it to VCR code 917 and it should just work. Check the panel on the following pages for information on using other remote controls. Reducing standby power Although the standby power is relatively low at about 1W, you may wish to eliminate this by switching power off altogether when the dimmer is not in use. The best way to do this is with an in-line switch in the mains cord to the IEC socket. Suitable inline switches can be obtained from Jaycar (PS-4075) or Altronics (P-8237). When you turn power off using the switch, the brightness setting level will be restored when you apply power next time. OVERLEAF: Dimmer features – and how to use them! April 2009  31 Dimmer Features – And How To Use Them! The remote control We tested the Intelligent Light Dimmer with a range of universal infrared remote controls, including the Digitech AR-1726 (Jaycar Cat. AR-1726). Set the Digitech remote control to the VCR-917 code (this is the code for a Philips VCR). This is the default (pre-programmed) code in the PIC micro (IC1), so if you use the Digitech remote, you don’t have to do anything else! However, the dimmer can be operated using any RC5 remote control, because the control codes can be “learnt”. There are 20 codes that the light dimmer recognises and these are listed in Table 1, together with their function. If the light dimmer senses infrared activity but it is not one of the 20 codes recognised, it will be ignored. However, if the same unrecognised code is pressed 10 times consecutively, the light dimmer will enter the remote control programming menu that lets you define the remote control codes for each of the 20 functions. Once this menu is entered (you will see the LEDs flash to indicate that the menu is being entered). You will then be prompted, by Button Name OK/ADDRESS flashing LED codes, to define each of the 20 remote control codes used to operate the light dimmer. The LED codes for each command are shown in the LED Code column in Table 1. So, for example, when you see the LED code for “1” (a single flash from the top green LED), you should press the key on your RC5 remote that you want to define for the function that “1” has (in this case, it functions both to enter settings and to set the brightness to 11% of full brightness). After all 20 remote control codes have been successfully defined, they will be stored in EEPROM, so this only needs to be done once. User operation As noted above, up to 20 keys can be programmed with separate functions. For example, the number keys are used to dim to preset levels, while the VOL UP and DOWN buttons can dim up and down in fine increments. The Channel UP and DOWN keys are used to change the operating mode (five modes), the MENU button lets you enter one of the 10 menus and the INFO button lets you see the current Function(s) LED Code In normal operation, this button is used to set the BBLUE x 2 address (OK/ADDRESS + number). If inside a menu, it can be used to exit the menu. Recommended Key Definitions for the Digitech AR-1726 remote (defaults) Press ‘OK’ TOGGLE If light is on, dims it to off. If the light is off, dims it up to full brightness. If inside a menu, this is used to toggle the sign of the number being entered. BBLUE x 1 + TBLUE x 2 (dimming up) or Press ‘MUTE’ TBLUE x 1 + BBLUE x 2 (dimming down) MODE UP Go up to the next mode. The modes are, in order: Normal, ZV, Sleep, Flashing and Security. BBLUE x 1 + TBLUE x 1 Press ‘Channel Up’ MODE DOWN Go down to the previous mode. The modes are, in order: Normal, ZV, Sleep, Flashing and Security. TBLUE x 1 + BBLUE x 1 Press ‘Channel Down’ INFO In normal operation, this button is used to get information about the current settings. Press INFO + number to get the appropriate setting according to Table 3. BGREEN x 1 + TBLUE x 1 Press ‘STOP’ MENU In normal operation, this button is used to enter a menu to change a setting. Press MENU + number to enter the appropriate menu according to Table 2. BGREEN x 1 + TRED x 1 Press ‘MENU’ Dim up finely by 4% BGREEN x 1 Press ‘Volume Up’ DOWN UP Dim down finely by 4%. BRED x 1 Press ‘Volume Down’ PLAY Recall your favourite brightness level and operating BGREEN x 2 mode (you must have previously saved those by using the RECORD button). Press ‘Play’ Press to save the current brightness and operating mode. You will then be able to recall these settings at any time by pressing PLAY. BRED x 2 Press ‘Record’ 0 Dim to off. TRED x 1 Press ‘0’ 1 Dim to 11% of full brightness. TGREEN x 1 Press ‘1’ 2 Dim to 22% of full brightness. TGREEN x 2 Press ‘2’ 3 Dim to 33% of full brightness. TGREEN x 3 Press ‘3’ 4 Dim to 44% of full brightness. TGREEN x 1 + BBLUE x 1 Press ‘4’ 5 Dim to 55% of full brightness. BBLUE x 1 Press ‘5’ 6 Dim to 66% of full brightness. BBLUE x 1 + TGREEN x 1 Press ‘6’ 7 Dim to 77% of full brightness. BBLUE x 1 + TGREEN x 2 Press ‘7’ 8 Dim to 88% of full brightness. BBLUE x 1 + TGREEN x 3 Press ‘8’ 9 Dim to full brightness. TGREEN x 1 + BBLUE x 2 Press ‘9’ RECORD Table 1: a suggested remote control code definition sequence using an RC5 remote control. This assumes you are using the Digitech AR-1726 universal remote control (although other universal remotes should be similar and may be used). Note that TGREEN denotes the top green LED, TRED the top red LED while BBLUE denotes the bottom blue LED, etc. 32  Silicon Chip siliconchip.com.au MENU Number MENU Function INFO Number INFO Function 0 Reset and restore all default settings 0 Firmware Version (HLL=version H.LL) 1 Time Out Period (Minutes) 1 Time Out Period (Minutes) 2 Flash Modulus 2 Flash Modulus 3 Quiescent Level 3 Mains Frequency (0.1 Hz) 4 Address (0=Broadcast) 4 Address (0=Broadcast) 5 Limiting Phase 0 (Positive Half Cycle) 5 Limiting Phase 0 (Positive Half Cycle) 6 Limiting Phase 1 (Negative Half Cycle) 6 Limiting Phase 1 (Negative Half Cycle) 7 Offset Phase 0 (Positive Half Cycle) 7 Offset Phase 0 (Positive Half Cycle) 8 Offset Phase 1 (Negative Half Cycle) 8 Offset Phase 1 (Negative Half Cycle) 9 Dimming Delay 9 Dimming Delay Table 2: the menu options. In each case, you press the MENU button followed by the appropriate number to choose that menu. Entering a menu is indicated by a specific sequence on the two RGB LEDs. You can then use other keys to set up the property (see text). In all cases, you press OK/ADDRESS to exit the menu. Table 3: the information options. In each case, you press the INFO button followed by the appropriate number to choose that option. The information is then displayed using the two RGB LEDs and can represent decimal numbers by different sequences of blinks (see text). settings and so on. Each time you press a recognised command, the two RGB LEDs will flash to acknowledge the command which will then be executed. When a set dimming level has been reached, there will be an additional acknowledgment LED code of the operating mode. So, for example, if you press “3”, the LED code for “3” will be shown and then the dimmer will perform the command that it corresponds to. In this case, it will dim the light up or down in brightness so that it is at 33% of full brightness. When that level is reached, the light dimmer will issue the LED code for the current operating mode. numbers have their digits codes shown in order from left to right. When a number is displayed, the sign is displayed first. For example, the code to display 128 is (POSITIVE + 1 green blink + 2 green blinks + 1 blue blink + 3 green blinks). To display -2400 however, the code is (NEGATIVE + 2 green blinks + 1 green blink + 1 blue blink + 1 red blink + 1 red blink). Once you use the light dimmer, you will quickly become used to the LED codes. Number codes The red blink indicates zero. One, two and three green blinks indicate, respectively, 1, 2, and 3. A blue blink indicates 5. Fig.10 shows all the number codes, along with the codes for plus and minus. Numbers like 128 or -2400 can also be shown. These multi-digit + 0 1 2 3 4 5 6 7 8 9 1x 2x 1x 2x 1x 1x 2x 1x (1) Normal mode Normal mode is the default. In this mode, the light can be dimmed over the full range. If the timeout is not disabled, the light automatically dims to off if no remote control activity has been detected for that period of time. The dimming speed can be changed as well (see below). In this mode, you can dim the light up or down using the VOL UP & VOL DOWN and the number keys. You can also use the TOGGLE key to dim up to full brightness or dim down to off. Pressing any of the number buttons will dim the light to the preset level of that button. For example, pressing 4 will dim to about half brightness (actually 44%). Pressing 0 will dim to off and so on. continued next page ZV MODE 1x 1x 1x There are five operating modes. In order, they are: (1) Normal, (2) ZV, (3) Sleep, (4) Flashing and (5) Security. You use the Channel UP and Channel DOWN buttons to change the mode. NORMAL MODE 3x 1x Operating modes 1x 2x 1x 3x 1x 2x siliconchip.com.au Fig.10: the LED acknowledge pattern codes for plus and minus, along with the numbers 0-9. These LEDs are clearly visible through the window in the front panel. SLEEP MODE FLASHING MODE SECURITY MODE ENTERING MENU EXITING MENU Fig.11: the LED acknowledge pattern codes for the five modes plus entering and exiting the menu. 1x 2x 1x 2x 1x 2x 1x 2x 1x 2x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x April pril 2009  33 Timeout Period Digit Code (minutes) Timeout Period Power Consumption of a 100W light for the timeout period 30 60 120 180 240 360 720 1440 9999 0000 Half an Hour 1 Hour 2 Hours 3 Hours 4 Hours 6 Hours Half a Day A Day Almost a week Disabled 0.05 kWh 0.10 kWh 0.20 kWh 0.30 kWh 0.40 kWh 0.60 kWh 1.20 kWh 2.40 kWh 16.67kWh – There are a number of menus that let you change the default behaviour of the light dimmer. To enter menu X (where X is in the range 0-9), you press MENU + X whereas to get information on a setting you enter INFO + X. The complete list of menus and information options is given in Tables 2 & 3. If you want to change the rate at which the lamp dims, you enter the menu mode, press the 9 button and then enter the dimming delay (0 to 9999) and press OK. (2) ZV mode In ZV (zero voltage) mode, the light is only ON or OFF. This may be used for non-dimmable CFLs. You use the same dimming controls as for Normal mode, except that you only need to use 0 (fully off) or 1 (fully on). The TOGGLE key still retains its former action. Sleep Mode functions the same as Normal Mode except that the light is gradually dimmed to off for the duration of the timeout period (when there is no IR activity). This is useful, for example, for setting a baby to sleep. You could set the timeout period to 30 minutes, set the dimmer to sleep mode and then set the initial brightness. While the timeout period can be anything from 1 minute to 1 week, the sleep mode function will only work with timeout periods between 1 minute and 255 minutes (4.25 hours). (4) Flashing mode In Flashing mode, the light will flash with a 25% duty cycle at a user set frequency (see below). This mode is useful for a shop front display or some form of beacon application. 34  Silicon Chip OK/ADDRESS 2x TOGGLE TO ON 1x TOGGLE TO OFF 1x MODE UP 1x MODE DOWN 1x INFORMATION 1x MENU 1x DIM UP 1x DIM DOWN 1x PLAY 2x RECORD COMMAND NOT RECOGNISED This mode will randomly turn the light on and off at full brilliance, for a period between five minutes and two hours. This simulates someone entering a room and turning a light on then later turning it off, making it perfect for giving a home an “occupied” appearance even though no-one is at home. Both the on time and the off time are random; ie, they are not the same. They could be anywhere between (and including) five minutes and two hours. Menus and Information Table 4: a selection of timeout period codes (in minutes) and what the timeout period will be. The 4-digit code in the left column must be entered when prompted in the timeout period menu to set the appropriate timeout period. To disable the timeout period function, enter a code of ‘0000’. To enable it, enter the appropriate number of minutes. The maximum timeout period is 9999 minutes, or almost a week. The longer the timeout period, the less chance that it will trigger when the light is in use, but the less power conservation protection offered. (3) Sleep mode (5) Security mode 2x 3x Timeout period The timeout period can be set anywhere between 1 minute and 9999 minutes. Setting it to 0 disables the timeout function. To view the current timeout period, go to INFO+1 whereas to set the timeout period go to MENU+1. For example, to set the timeout period to 2 hours, press MENU + 1 (then wait to enter the menu, which is acknowledged by a LED sequence – see Fig.11). Then you would type 1 + 2 + 0 + OK/ADDRESS (OK/ADDRESS is used to exit the menu). To now view the current timeout period type INFO + 1. You should see the LED code for +120. Table 4 shows some typical timeout periods. Mains Frequency Pressing INFO + 3 gives the current mains frequency in units of 0.1Hz. For example, a reading of 495 indicates 49.5Hz. Multi addressable Setting the light dimmer’s address is easy. Simply press MENU + 4. To view the address type INFO + 4. The address can be set anywhere between 1 and 9. Setting it to 0 (broadcast) disables the address function and makes the dimmer respond to remote control commands from any address. If the address is set to 4 for example, 2x the light dimmer will ignore any remote 2x control commands (except INFO commands) not addressed to that address. 1x This is useful if you want to control two light dimmers independently with the 1x same remote. You simply set them to different addresses. 1x Suppose you set dimmer one’s address to 1 and the other to 2. If you want to make 1x the first one listen, press OK/ADDRESS + 1. That sets the current address for all light dimmers in range. They then compare that address to their set address. If it matches, the light dimmer will not ignore Fig.12: the LED the received commands. acknowledge Now any subsequent commands will codes for the be executed by dimmer 1 but ignored by commands. dimmer 2. If you now press OK/ADDRESS + 3, assuming there is no other dimmer siliconchip.com.au +325V Note that if you are using the light dimmer in the ZV mode or flashing mode, the quiescent current level will be ignored. ZERO VOLTAGE DETECT VIA INT0 Save and recall options 0V 10ms 30ms 0 20ms TIME –325V Advanced settings +325V Offset(0) Offset(1) Limiting(1) 0V At any time, you can use the RECORD button to store the current brightness and operating mode to non-volatile memory (EEPROM). When you next press the PLAY button, these settings are restored. This can be used to set your favourite brightness level to be recalled at any time in one touch. 0 Limiting(0) TIME –325V Fig.13: this explains the meaning of the four advanced settings. The offset can be a positive or a negative number, while the limiting value is a single unsigned 8-bit number. nearby, both will ignore any subsequent commands! You can also disable the selective addressing by setting the dimmer’s address to 0. Press MENU + 4 to enter the ADDRESS menu. Then press 0 + OK/ADDRESS to set the address to 0 and make it listen to any address. Speed of dimming The default value for the dimming delay is 10. This gives a period of around five seconds to dim from one extreme to another. You can vary the speed of dimming by entering MENU + 9. Then enter the number. Possible values range from 0 (fastest) to 9999 (extremely slow). To set the speed of dimming to take roughly 10 seconds from one extreme to another, enter the sequence MENU + 9, then wait to enter the menu, then enter 2 + 0 + OK/ADDRESS to set the dimming delay to 20. At any time, you can press INFO + 9 to see the set value. The dimming delay will be echoed back to you as a number in LED code. Speed of flashing In Flashing mode, the frequency of flashing can be varied by entering MENU + 2. Wait to enter the menu and then you can enter a number. The higher the number, the slower will be the flashing. A value of X gives a flashing frequency of approximately 5/(X+1) Hz. So for example, a value of 19 will give a 0.25Hz flashing frequency (or a flash roughly every four seconds). The default flashing value is 10 giving a flashing rate of 0.45Hz (roughly one flash every two seconds). Minimum brightness You can set the minimum lamp brightness which will apply at all times unless the dimmer is switched off by an in-line switch. You can set the quiescent level by pressing MENU + 3. You will then be able to set the quiescent level with the usual dimming buttons (VOL UP and VOL DOWN and the number keys). Once you are happy with the set level, press OK/ADDRESS to exit the menu. siliconchip.com.au The firmware of this light dimmer allows fine tuning of the Triac response, in terms of four parameters that can be set by the user: two limiting values and two offset values (two each for each of the two half cycles of the mains waveform). Note that you will not normally need to set these values as the defaults should be suitable for most incandescent lamps, dimmable CFLs and halogen lamps. In the event that you are driving, say, a desk halogen lamp, where the 12V power is supplied by a transformer (plugpack), the load will not strictly be resistive, as the transformer would present an inductive load. In this case, this light dimmer allows you to set these four parameters to control the triggering of the Triac and to customise the dimmer response. The limiting values “limiting0” and “limiting1” are 8-bit numbers ranging from 0x00 to 0xFF (hexadecimal). The default values are 0xFF or 255. The brightness level is guaranteed to always be less than or equal to the “limiting0” value in the positive half-cycle of the mains waveform and less than or equal to the “limiting1” value in the negative half-cycle of the mains waveform. A brightness level of N corresponds to the limiting value: V = 28 x N where N is a digit from 0-9. As a percentage, the equation becomes: V = 2.55 x P, where P is the percentage of full brightness. So, for example, a brightness level of 5 corresponds to the value 140 (or roughly 55% brightness). Suppose we want to limit the positive half-cycle brightness to around 55% of full brightness. Then we would enter MENU + 5 (then wait to enter the menu). Then we would type 1 + 4 + 0 + OK/ADDRESS. This would set the limiting value for the positive half cycle to around 55%. This gives you very fine control of the Triac response. An example: driving a 12V halogen desk lamp Why would you ever need to change the default values? Suppose you are controlling a desk lamp with a 12V halogen bulb. The 12V is derived from a transformer in a plugpack and hence presents an inductive load to the light dimmer. The inductive load changes the phase relationship and we found that by choosing values of limiting0 = 0xFF and limiting1 = 0xE0, we could prevent the desk lamp from flickering when set to the maximum brightness level. The flickering occurs because the Triac triggering is occurring before the zero crossing of the mains rather than after. The offset setting is a signed 16-bit number (the default value is 0) which you can also set (it can range between -32768 to 32767). The unit is 800ns. So an offset of 1500 indicates a time offset of 1.2ms for example. Note that a half cycle of the mains (at 100Hz) equates to a 10ms period, or in other words a full SC offset of 12500. April pril 2009  35