Silicon ChipAutomatic Single-Channel Light Dimmer; Pt.2 - May 2002 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: A new reactor at Lucas Heights - it's about time
  4. Subscriptions
  5. Feature: Fuel Cells: The Quiet Emission-Free Power Source by Gerry Nolan
  6. Feature: Shark Shield: Keeping The Man-eaters at Bay by Ross Tester
  7. Project: PIC-Controlled 32-LED Knightrider by John Clarke
  8. Project: The Battery Guardian by John Clarke
  9. Project: Build A Stereo Headphone Amplifier by Ross Tester
  10. Order Form
  11. Project: Automatic Single-Channel Light Dimmer; Pt.2 by John Clarke
  12. Product Showcase
  13. Weblink
  14. Project: Stepper Motor Controller by Ross Tester
  15. Vintage Radio: The AWA FS6 military transceiver by Rodney Champness
  16. Book Store
  17. Back Issues
  18. Notes & Errata
  19. Advertising Index
  20. Outer Back Cover

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

You can view 28 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:
  • Fuel Cells: The Quiet Emission-Free Power Source (May 2002)
  • Fuel Cells: The Quiet Emission-Free Power Source (May 2002)
  • Fuel Cells Explode! (June 2002)
  • Fuel Cells Explode! (June 2002)
  • Applications For Fuel Cells (July 2002)
  • Applications For Fuel Cells (July 2002)
Items relevant to "PIC-Controlled 32-LED Knightrider":
  • PIC16F84(A)-04/P programmed for the PIC-Controlled 32-LED Knightrider [KNIGHT.HEX] (Programmed Microcontroller, AUD $10.00)
  • PIC16F84 firmware and source code for the PIC-Controlled 32-LED Knightrider [KNIGHT.HEX] (Software, Free)
  • PIC-Controlled 32-LED Knightrider PCB pattern (PDF download) [08105021] (Free)
Items relevant to "The Battery Guardian":
  • Battery Guardian PCB pattern (PDF download) [05105021] (Free)
  • Panel artwork for the Battery Guardian (PDF download) (Free)
Items relevant to "Build A Stereo Headphone Amplifier":
  • Stereo Headphone Amplifier PCB pattern (PDF download) [01105021] (Free)
Items relevant to "Automatic Single-Channel Light Dimmer; Pt.2":
  • PIC16F84A-20(I)/P programmed for the Automatic Single-Channel Light Dimmer [AUTODIM.HEX] (Programmed Microcontroller, AUD $10.00)
  • PIC16F84 firmware and source code for the Automatic Single-Channel Light Dimmer [AUTODIM.HEX] (Software, Free)
  • Automatic Single-Channel Light Dimmer PCB patterns (PDF download) [10104021-3] (Free)
  • Panel artwork for the Automatic Single-Channel Light Dimmer (PDF download) (Free)
Articles in this series:
  • Automatic Single-Channel Light Dimmer (April 2002)
  • Automatic Single-Channel Light Dimmer (April 2002)
  • Automatic Single-Channel Light Dimmer; Pt.2 (May 2002)
  • Automatic Single-Channel Light Dimmer; Pt.2 (May 2002)

Purchase a printed copy of this issue for $10.00.

. . . dimming with the power of a PIC Last month we covered the features and design details of this completely new high power automatic dimmer. It is controlled by a PIC16F84 microcontroller. This month, we conclude with the construction and setting up details and the parts list. Pt.2: By JOHN CLARKE 58  Silicon Chip The Automatic Light Dimmer is constructed on three PC boards: a Display board coded 10104021 and measuring 89 x 102mm; a Controller board coded 10104022 and measuring 84 x 96mm; and a filter PC board coded 10104023 and measuring 52 x 59mm. These are housed in a diecast box measuring 171 x 121 x 55mm. You can begin by checking each PC board for any possible problems before they are assembled. In particular, check the pattern against the published artwork for any shorts or breaks in the tracks. Also check the hole sizes drilled to ensure they are suitable for each component. Note that switches S2-S4 and S6-S8 need slotted holes to suit their terminals. The component overlays for all three boards are shown in Fig.4. Start assembly of the Display PC board by installing the links and diodes. Place the four DIP20 IC sockets in the LED1-40 positions on the PC board. The 10-LED bargraphs need to be in­serted with the correct polarity. One of the corners of the LED bargraph package has a small chamfer down one edge. This is the cathode (K) side of bargraph and should be installed in the sockets as indicated on the overlay diagram in Fig.4. Now install the 8-way right angle pin headers for connec­tors CONA, B, C and D. Switch S5 can be installed with the “flat” side oriented as shown. www.siliconchip.com.au Fig.4: install the parts on the three PC boards as shown here but don’t initially mount any of the switches except for S5 (all the other switches are installed on the case lid first – see photo). Note that the two LED bargraph displays on the Display board mount in opposite directions. Do not install the remaining switches. LED41 is mounted so that the top of its convex lens is 10mm above the top of the LED bargraphs. Work can now begin on the Controller PC board by installing the links and IC2, IC3 and IC4. IC1 uses a socket. Take care with orienting the ICs and socket and note that IC3 is oriented dif­ferently to IC2 and IC1. When installing the resistors, use the resistor code table as a check when selecting each value. You can also use www.siliconchip.com.au a multi­ meter to check each value. The eight 4.7kΩ resistors near IC3 are mounted vertically, ie, end-on. Diodes D13 and D14 can be installed as well as Q1-Q5, taking care with their orientation. Install the 20MHz crystal and the capacitors, taking care to orient the electrolytic capacitors with the correct polarity, as shown. Note that the 1µF bipolar electrolytic can be installed either way. Install the PC stakes near D13 and D14. Triac1 and REG1 are mounted WARNING! Part of the circuitry used in this Automatic Light Dimmer operates at 240VAC (see Figs.1 & 6) and is potentially lethal. Do not touch any part of this circuit while the unit is plugged into the mains and do not operate the circuit outside its earthed metal case. This project is for experienced constructors only. Do not build it unless you are entirely familiar with mains wiring practices and construction techniques. May 2002  59 Table 2: Capacitor Codes     Value IEC Code EIA Code 0.1µF   100n   104 .047µF   47n  473 22pF   22p   22 the PC board, the inductor is secured with two cable ties, each wrapping around the toroid and through holes in the PC board. Install the four 8-way vertical pin headers as shown. Making the filter board The filter PC board is assembled with the 0.1µF 250VAC capacitor soldered in place next to the 4.7MΩ resistor as shown. Inductor L2 has two windings on the one Philips 4330 0303 4220 toroid, using 1mm diameter enamelled copper wire. Wind on 11 turns evenly spaced on one side of the toroid. The second winding needs to be wound as a mirror image of the first, so be careful with the winding direction. In other words, if the turns on the first winding go clockwise around the core, the turns on the second winding MUST go anticlockwise. Make sure you get this RIGHT! Wind on 11 turns as before. Terminate the windings after scraping and tinning the wire ends. We secured the toroid using two 100mm long cable ties around it and the bottom of the PC board. This holds the toroid in position but also allows some movement, preventing it from shattering if the assembled Automatic Light Dimmer is dropped. Note that this ferrite toroid is rather brittle compared to This view shows the fully assembled Display board. It’s best to attach the four 8-way cables before soldering it to the matching switch hardware mounted on the lid of the case. under the PC board as shown in Fig.5. The leads are bent at right angles and soldered to the PC board so that the device tabs are 6mm below the bottom of the PC board. Bend the leads over on the top of the PC board to secure them in position before soldering. Inductor L1 is wound on a Neosid 17-730-22 or Jaycar LO-1244 powdered-iron core using 1mm enamelled copper wire. Wind on 16 turns evenly spaced around the toroid and terminate the leads in the PC boards holes. You will need to scrape away the enamel insulation at each end of the wires and tin them with solder. After soldering the leads to the underside of Table 1: Resistor Colour Codes  No.   1   1   2   8   2   5   2   1   2   5 60  Silicon Chip Value 4.7MΩ (VR37) 100kΩ 10kΩ 4.7kΩ 2.2kΩ 680Ω 470Ω 360Ω 220Ω 47Ω 4-Band Code (1%) yellow violet green yellow brown black yellow brown brown black orange brown yellow violet red brown red red red brown blue grey brown brown yellow violet brown brown orange blue brown brown red red brown brown yellow violet black brown 5-Band Code (1%) brown black black orange brown brown black black red brown yellow violet black brown brown red red black brown brown blue grey black black brown yellow violet black black brown orange blue black black brown red red black black brown yellow violet black gold brown www.siliconchip.com.au Here’s how to wire the four cables: on each of the “A” and “B” cables, connect pin 1 on one header plug to pin 8 on the header plug at the other end, pin 2 to pin 7 and so on. Conversely, for the “C” and “D” cables, connect pin 1 of one header plug to pin 1 of the header plug at the other end, pin 2 to pin 2 and so on. Mark the ends of each cable with a felt-tipped pen as it is completed, so that you don’t get them mixed up later on. That way, when the header sockets are plugged into the pin headers on the Controller PC board, all the connections will be correct, since the headers will only fit one way. Once the cables have been completed, plug them into the Display PC board, so that it is ready for mounting onto the lid of the case. Take care not to transpose cables “B” and “D” – remember that Fig.4 shows the Display board from the component side. Drilling the case Take care when installing the switches on the lid – they must all be oriented correctly (see text) and some of the switch styles differ (see photo). The two red Perspex windows should be a force fit and can be further secured using a few drops of superglue. the more robust powdered iron toroid used for L1. Making the header cables There are four cables to be made up using polarised 8-way pin header plugs and 8-way rainbow cable. The “A” and “B” cables are 90mm long, the “C” cable is 180mm long and the “D” cable is 135mm long. The header cables are made up by first crimping the stripped wire ends into the pins. You may also wish to apply a small amount of solder to each crimp connection to ensure a good contact. The pins then clip into the header plug. Note, however, that the wiring connections to the polarised header plugs are quite critical. For this reason, be sure to follow the wiring details set out in the next paragraph exactly. The lid of the case will require drilling for the switches, LED bargraph displays and the 10mm LED. Use the front panel artwork as a guide to the hole locations and use the display PC board to measure the exact positions. The rectangular holes for the switches and LED bargraphs can be made by drilling out a series of holes within the cutout area and then filing to shape. Of course, if you buy a kit, all the drilling will have been done for you. We fitted clear red Perspex windows into the LED bargraph cutouts. When the drilling and filing of the lid is complete, attach the front panel label and cut out the holes with a sharp hobby knife. Insert the switches into the holes allocated, making note of these important points: (1) Switches S1 and S4 need to be oriented so that UM66 SERIES TO-92 SOUND GENERATOR. THESE LOW COST IC’S ARE USED IN MANY TOYS, DOORBELLS AND NOVELTY APPLICATIONS 1-9 $1.10 10-24 $0.99 25+ $0.88 www.siliconchip.com.au May 2002  61 Fig.5: both REG1 (7805) and the BTA41 insulated tab Triac are bolted to the bottom of the case as shown here. Note that the device tabs must be 6mm below the bottom of the PC board. the switch contacts are closed when set to the Flash and Rate B positions; (2) Switch S2 is oriented so that its contacts are closed when set to the Manual dimming position; and (3) Switch­ es S3, S6, S7 & S8 can be mount­ed either way but it is best to orient them all with the same switch legend positions. We elected to place these four switch­es with the double bar toward the top. The display PC board is mounted by soldering it directly onto the switch terminals. Now that the lid is finished, the case itself requires a fair amount of drilling. Mounting holes are required for the controller and filter PC boards, the regulator, Triac, earthing lug and the transformer. As well, one end of the case requires holes for the power switch S9, fuse F1, cord-grip grommet and the surface mount General Purpose Outlet (GPO) mains socket. Two Fig.6: this diagram shows the mounting details for the two earth lugs. The second nut locks the first nut, so that there is no possibility of the earth lug later working its way loose. holes are required to mount the socket and three holes are for the grommets that allow the wires to pass through the panel into the GPO terminals. Transformer T1 is mounted on the side of the case at an angle so that it does not foul the display PC board when the lid is placed on the box. One of the mounting feet needs to be bent up so that it fits against the integral pillar in the case. Use countersunk screws to mount the transformer so This is the view inside the prototype with most of the wiring completed. The headers from the Display PC board plug into matching header pins on the Controller PC board. 62  Silicon Chip www.siliconchip.com.au Fig.7: the mains wiring details. Use cable ties to bind the leads and note that inductor L2 (top) is secured with two cable ties that loop under the PC board (see photo). Be sure to use nylon screws, nuts and spacers where specified. that they are flush with the outside of the box. Installing the hardware We are now in the final assembly stage where everything is wired together, as shown in Fig.7. Install the mains cord first. Strip back about 200mm of the outer www.siliconchip.com.au sheath of the mains cord so that there is sufficient lead length for all the mains wiring. Cut off 50mm and 100mm lengths of the brown Active wire from the mains cord and solder the 50mm length to provide the connection between the filter board and the controller PC board. The 100mm length provides the connection from the fuseholder to the controller board (shown as “X” on Fig.7). Apply a smear of heatsink compound to the underside of the Triac tab and regulator tab before bolting them down. Note that the specified Triac has an isolated tab which means that the metal flange on the device is not connected to any of the pins. You can May 2002  63 to the case with 8mm long screws and nuts. Fit the mains cord into the hole in the case with a cordgrip grommet. Make sure that this cord cannot be pulled out from the case once secured in place. The green-yellow earth wires are attached to the case using crimp eyelets and a screw, two star washers and two nuts – see Fig.6. Fit switch S9, fuseholder F1, the GPO socket and its grom­mets and wire switch S9 and fuseholder F1 as shown. Be sure to sheath the fuseholder terminals, with 10mm diameter heatshrink tubing and the switch terminals with 5mm heatshrink tubing. Mount the transformer now. Note that the switch terminals will need to be bent over slightly to allow clearance for the transformer. Connect the wiring to the filter PC board and to the GPO before mounting the filter PC board on 25mm screws and 15mm Nylon spacers. Note that a Nylon screw and nut is used for the corner mounting position on the filter PC board. Do not use a metal screw in this position otherwise there is a risk of flashover. This applies to any position where we have specified Nylon screws – see Fig.7. Connect the transformer secondaries to the Controller PC board as shown. The mains wiring needs to be tied so that if one wire should come adrift it will still be secured in place with another wire connection. Use cable ties to strap the wires in place on the switch, the back of fuseholder F1 and the wires on the filter PC board. Finally, attach four rubber feet to the base of the case. Here's how to fit the folded Presspahn insulation into the case. Note that many of the parts underneath the Presspahn insulation operate at 240VAC. Presspahn insulation This view shows how the mains socket, on/off switch and safety fuseholder are mounted on one end of the case. Make sure that the mains cord is properly secured using a cordgrip grommet. check this by meas­uring the resistance between the tab and the pins with a multi­meter. If the resistance shows a short circuit then the Triac is not an isolated tab type and should not be used. An open circuit measurement will show 64  Silicon Chip if the Triac is the correct isolated tab device. Mount the controller PC board on 6mm Nylon spacers using 15mm long screws. Note that the screw near Triac1 must be a Nylon screw (see Fig.7). Secure the regulator and Triac As shown in the accompanying photo, a folded piece of Presspahn or Elephantide insulation is used to cover the high-voltage section of the circuitry (apart from the mains switch). This serves to isolate the low-voltage cable wiring from those components operating at mains potential when the lid is attached and is important for long-term reliability. Fig.8 shows the cutout and folding details for the insulation material. Testing Check your wiring very carefully, making sure all the wires are connected to the correct positions. Also check that the mains Earth lead is connected www.siliconchip.com.au Scope 4: this shows the lamp voltage when the Triac is fired at the peak of the mains waveform. The resulting RMS vol­tage is about half the 250V or 126V as measured by the oscillo­scope. Scope 5: this is the gate drive pulse as seen at pins 2 and 3 of IC1. This pulse drives the optocoupled Triac driver IC4 via a 220Ω resistor. The gate pulse width is 82µs. Fig.8: you can use this diagram as a template for marking out and cutting the Presspahn insulation material. Fold the cutout along the dotted lines in the direction indicated. to chassis and that the Earth terminal on the GPO is also connected to chassis. You can check that there is continuity from the Earth pin on the mains plug to chassis and to the Earth connection on the GPO using a multimeter. The Automatic Dimmer is best initially tested with the lid secured in place with its mounting screws. Apply power and check that the display LEDs light. If the LEDs do not light, switch off power immediately and disconnect the power plug. Check that the fuse is intact and that the switch was turned on. PLEASE NOTE! The scope waveforms in this article are shown to explain the operation of the circuit. DO NOT try to reproduce these waveforms yourself – it is much too dangerous. www.siliconchip.com.au Scope 6: the yellow trace is the mains waveform at 50Hz and 250VAC. The blue trace is the signal applied to pin 6 of IC1 to detect the zero voltage crossing point of the mains wave­form. This voltage is clipped at +5.6V and 0.6V below ground via the internal clamping diodes of IC1. May 2002  65 Parts List 1 display PC board, code 10104021, 89 x 102mm 1 controller PC board, code 10104022, 84 x 96mm 1 filter PC board, code 10104023, 52 x 59mm 1 front panel label, 116 x 168mm 1 diecast aluminium box, 171 x 121 x 55mm 2 10mm x 51.5 x 2mm clear red Perspex or Acrylic 1 sheet of Elephantide or Press­ pahn insulation, 100 x 160mm 1 30V centre-tapped 5VA mains transformer with internal thermal fuse (T1) (Jaycar MM2007 or equivalent) 1 iron powdered toroid, 25 x 13 x 10mm approx, AL 77 (L1) (Neosid 17-730-22 or Jaycar LO-1244) 1 Ferrite toroid, 37 x 22 x 16mm approx, AL 7390 (L2) (Philips 4330 0303 4220 or Jaycar LO1238) 2 SPST ultra-mini rocker switch (S1,S4) (Jaycar SK-0975, Altron­ics S-3202 or equiv.) 4 SPDT centre off spring return rocker switch (S3,S6,S7,S8) (Jaycar SK-0987 or equiv.) 2 SPST mini rocker switch (S2, S9) (Jaycar SK-0984 or equiv.) 1 snap action keyboard switch (S5) (Jaycar SP-0721, Altronics S-1096 or equiv.) 1 20MHz parallel resonant crystal (X1) 1 10A surface mount mains outlet (HPM Cat. NO.35) 1 2AG panel-mount safety fuse holder 1 10A 2AG fuse 1 10A mains plug and lead 1 cord grip grommet to suit mains lead 4 DIP20 IC sockets (for LEDs1-40) 1 DIP18 IC socket (for IC1) 3 9mm rubber grommets 8 8-way 0.1-inch polarised header plugs (Jaycar Cat. HM-3408 or equivalent) 4 8-way 0.1-inch polarised pin headers (Jaycar Cat. HM-3418 or equivalent) 4 8-way 0.1-inch polarised right-angle pin headers (Jaycar Cat. HM-3428 or equivalent) 1 550mm length of 8-way rainbow cable 2 M3 x 10mm countersunk screws 2 M3 x 8mm pan head screws 1 M3 x 12mm pan head screw 2 M3 x 20mm pan head screws 1 M3 x 15mm Nylon screw 3 M3 x 15mm metal screws 1 M3 x 25mm Nylon screw 1 M3 x 25mm metal screw 2 15mm M3 tapped plastic standoffs 4 6mm M3 tapped plastic standoffs 12 M3 nuts 2 M3 Nylon nuts 2 M3 star washers 2 crimp eyelets 4 rubber feet 1 45mm length of 10mm diameter heatshrink tubing 1 20mm length of 4mm diameter heatshrink tubing 10 100mm long cable ties 1 2.3m length of 1mm diameter enamelled copper wire Check that the LED bargraphs have been installed correctly. Also you may need to check the supply voltages on IC1 and IC2 for 5V. There should be 5V between pins 5 and 14 on IC1 and between pins 8 and 16 on IC2. Be careful when checking voltages since the righthand side of the PC board has mains voltages on it. This includes the MOC3021 (IC4), L1 and the adjacent 360Ω and 470Ω resistors and the Triac leads. If the displays are operating, you should be able to set the dim and flash levels and the rates using the up and down set level switches. Also the LED lamp indicator should light accord­ ing to the dimming level. Check operation of the autodim function and the flash. You can set the filament preheat by connecting up an in­candescent lamp via the GPO socket. Note that you must use a lamp that is at least 60W. A smaller bulb rating may flicker since the Triac holding current is too high for these. Press all three lefthand switches (Store Settings, Set UP and Dim Up switches) and wait as the slow in- 66  Silicon Chip 1 150mm length of 0.8mm tinned copper wire 3 PC stakes Semiconductors 1 PIC16F84A-20P microcontroller programmed with autodim.hex (IC1) 1 4017 decade counter (IC2) 1 ULN2803 8-way Darlington driver (IC3) 1 MOC3021 Triac driver (IC4) 1 7805 3-terminal regulator (REG1) 1 BTA41.600B 40A 600V insulated tab Triac (TRIAC1) 5 BC328 PNP transistors (Q1-Q5) 12 1N914, 1N4148 diodes (D1D12) 2 1N4004 diodes (D13,D14) 4 10-red LED bargraph displays (LED1-LED40) 1 10mm red LED (LED41) Capacitors 1 470µF 25VW PC electrolytic 2 10µF 25VW PC electrolytic 1 1µF bipolar electrolytic 2 0.1µF 250VAC X2 class 2 0.1µF MKT polyester 1 .047µF 250VAC X2 class 2 22pF NP0 ceramic Resistors (0.25W 1%) 1 4.7MΩ Philips VR37 high-voltage type (DO NOT substitute) 1 100kΩ 2 470Ω 2 10kΩ 1 360Ω 8 4.7kΩ 2 220Ω 2 2.2kΩ 5 47Ω 5 680Ω Fig.9: the is the full-size etching pattern for the filter PC board. www.siliconchip.com.au Fig.10: this is the full-size front panel artwork. Fig.11: the full-size etching patterns for the Display PC board (left) and Controller PC board. crease in voltage applied to the lamp is sufficient to provide a soft glow in the filament. Release the switches and press the Store Settings switch to www.siliconchip.com.au retain this value of preheat. Note that the dim up and set up switches may have altered settings at the time the filament preheat adjust- ment was made. You can store the dim and flash levels and A and B rates that you set on the display at any time using the store settings switch. SC May 2002  67