Silicon ChipCeiling Fan Timer - October 2005 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Valve amplifiers and self-delusion
  4. Feature: Google Earth by Ross Tester
  5. Review: NetComm NP210: Ethernet Over Power by Ross Tester
  6. Project: Dead Simple USB Breakout “Box” by Stan Swan
  7. Project: Studio Series Stereo Preamplifier by Peter Smith
  8. Project: Video Reading Aid For Vision Impaired People by Jim Rowe
  9. Project: Simple Alcohol Level Meter by John Clarke
  10. Project: Ceiling Fan Timer by John Clarke
  11. Feature: The iButton – A Hard “Nut” To Crack by Clive Seager
  12. Feature: The DS1921 iButton Datalogger by Clive Seager
  13. Salvage It: A $5 2-channel vibration sensor by Julian Edgar
  14. Book Store
  15. Vintage Radio: The Harbros 12/54B transceiver by Rodney Champness
  16. Advertising Index
  17. Outer Back Cover

This is only a preview of the October 2005 issue of Silicon Chip.

You can view 41 of the 112 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 "Studio Series Stereo Preamplifier":
  • 4-Output Universal Regulator PCB [18105151] (AUD $5.00)
  • PCB pattern for the Studio Series Preamplifier power supply (PDF download) [01109052] (Free)
  • Studio Series Stereo Preamplifier main PCB [01109051] (AUD $20.00)
  • Studio Series Stereo Preamplifier Main PCB pattern (PDF download) [01109051] (Free)
Articles in this series:
  • Studio Series Stereo Preamplifier (October 2005)
  • Studio Series Stereo Headphone Amplifier (November 2005)
  • Studio Series Remote Control Module (April 2006)
Items relevant to "Video Reading Aid For Vision Impaired People":
  • Video Reading Aid PCB pattern (PDF download) [02110051] (Free)
  • Video Reading Aid front panel artwork (PDF download) (Free)
Items relevant to "Simple Alcohol Level Meter":
  • Bilge Sniffer/Alcohol Meter PCB [05109051] (AUD $10.00)
  • RBT BAC Checker/Bilge Sniffer PCB pattern (PDF download) [05109051] (Free)
Items relevant to "Ceiling Fan Timer":
  • PIC16F88 firmware and source code for the Fan Timer [fantimer.hex] (Software, Free)
  • Fan Timer PCB pattern (PDF download) [10110051] (Free)
  • Fan Timer front panel artwork (PDF download) (Free)
Items relevant to "The iButton – A Hard “Nut” To Crack":
  • PICAXE-08M BASIC source code for the iButton reader (Software, Free)

Purchase a printed copy of this issue for $10.00.

By JOHN CLARKE FAN TIMER This Timer can run the fan in your bathroom or toilet for a fixed time after you turn it on. This avoids having the fan run for hours if you forget to turn it off. You can build it to operate in one of two modes – immediate or delayed. U NLESS YOU CAN KEEP your windows open all the time, you really do need ceiling exhaust fans in your toilet and bathroom to clear steam and odours. Good ventilation stops mould growing on the ceilings and walls and minimises water condensation on the walls and windows if you are having a long, hot shower. 76  Silicon Chip This Fan Timer is housed in a plastic box which is installed near the fan, usually in the ceiling. When you build it, you can set the Timer for one of two modes of operation which we have called “immediate” and “delayed” modes. In the “delayed” mode, you switch the fan in the normal way using the wall switch. The fan then runs for as long as the switch is left on. When you flip the wall switch off, the fan will then run for a preset period before it switches off automatically. In the “immediate” mode, the fan is also switched on using the wall switch but in this case, the fan will then run for a preset period before it switches off automatically. If you need to run it for a longer time, you flip the switch to its other position to make the fan run for the same preset period. Alternatively, you can extend the fan running time by the same preset period, by flipping the wall switch to its other position before the fan stops. If you do this, the fan timer will acknowledge the time extension by giving a short beep. siliconchip.com.au In fact, you can do this twice, to run the fan for three times the normal preset period. Switching a third time turns the fan off. Each mode has its advantages. The “immediate” mode has the advantage that the fan switch does not need to be manually switched off. This mode is ideal for a household with children! The “delayed” mode is more suited to people who want to run the fan as long as they are in the bathroom or toilet and who always remember to manually switch off the fan when they leave (letting it run for the preset time). Our choice would be to use the “immediate” mode – that way you don’t have to remember to switch off! The preset running period can be selected from 20 seconds up to 22 minutes. Depending on the room and size of the exhaust fan, a setting of around 5-10 minutes would usually be selected. Switch wiring Fig.1 shows the way the Fan Timer connects to the fan and switch. Fig.1(a) shows the normal fan wiring. The Neutral is permanently connected to one of the fan terminals while the Active side of the fan connects to the switch. Fig.1(b) shows the wiring when the Fan Timer is installed, interposed between the mains Active and the fan. Note that the Fan Timer also requires Active and Neutral power connections. Note that the fan switching in your home might be more complex, depending on whether the fan is wired in parallel with ceiling lights or is separately switched. The fan might also be part of a fan/heat/light setup like an IXLTastic or similar brand. Which ever fan/light setup you have, the Fan Timer is installed in the ceiling cavity and you will need the services of a licensed electrician to legally make the connections. As shown in the photos, the Fan Timer is housed in a small plastic box and it incorporates screw terminals to allow the 240VAC mains connections to be made. Circuit description Fig.2 shows the Fan Timer circuit which is based on a PIC16F88 microcontroller (IC1) and a sensitive-gate Triac. There is not much else: several diodes, a piezo transducer and a few resistors and capacitors. The microsiliconchip.com.au SWITCH A A A SWITCH SW A FAN TIMER FAN FAN A N N FAN N N N (a) (b) Fig.1(a) at left shows how the fan is normally connected, which Fig.1(b) shows how the Fan Timer is interposed between mains Active and the fan. controller senses the selected mode and the setting of the wall switch, operates the piezo transducer and drives the Triac gate for the preset time. Before discussing the circuit of Fig.2, we need to demonstrate how we derive the 5V supply to power the timer circuitry. We have shown this in simplified form in Fig.3. In effect, we need to produce a 5V rail capable of powering the PIC microcontroller and delivering several milliamps gate current to the Triac. Since we only need a few milliamps of DC, we can derive this directly from the 240VAC mains via the relatively high reactance of a 470nF capacitor (C1) combined with a 1kW 5W resistor (R1). This means that there is very low power dissipated in the timer box. The circuit works as follows. For positive half-cycles of the 240VAC mains voltage, a current i1 flows from the Active through the 470mF capacitor, diode D1, resistor R1 and capacitor C1. For negative half-cycles of the 240VAC, a reverse current i2 flows via C1, R1 and zener diode ZD1. So successive positive half-cycles charge up the 470mF capacitor until WARNING! This circuit is directly connected to the mains and all parts operate at 240VAC. As such, contact with ANY part of the circuit could result in serious injury or even death! DO NOT operate this circuit unless it is fully enclosed in the specified ABS plastic case and DO NOT touch any part of the circuit while it is connected to the mains. A licensed electrician must be used to connect this unit to fixed electrical wiring. its voltage is limited by the 5.6V zener diode ZD1. Subtract the 0.6V voltage drop of diode D1 and this results in a supply voltage to the timer of 5V. Note that the zener diode works in two modes: limiting the voltage across the 470mF capacitor for posi- Main Features • • • • • • Fan runs for preset time period Connects to standard fan wiring using original switch Adjustable time period from 20 seconds to 22 minutes Immediate timer start or delayed timer start (selected by single on-board jumper link) Up to three times period extension using immediate timer mode Piezo sound indication for switch on and period extension October 2005  77 K 1k 5W A R1 K A ZD1 5.6V 1W 470F 16V PIEZO TRANSDUCER 2.2k 4 MCLR 14 Vdd 10 D1 1N4007 9 RB3 RB1 RB2 A C1 470nF 250VAC CLASS X2 RB4 VR1 10k TIME 18 RB5 AN1 RB6 IC1 PIC16F88 RB0 13 RB7 RA3 SC FAN TIMER A G 10 11 A2 12 A1 1k 1W TRIAC1 BTA08600TW FAN 2.2k 6 SW 22F 16V 1.5M 2 N VR25 Vss 4.7nF 5 NOTE: EARTH SYMBOL DOES NOT REPRESENT MAINS EARTH, BUT CIRCUIT COMMON 2005 K 8 JP1 IN = DELAYED OUT = IMMEDIATE CONTACT MAY BE LETHAL! 47nF 250VAC CLASS X2 D2 UF4003 470 7 10k WARNING: ALL COMPONENTS AND WIRING OPERATE AT 240V MAINS POTENTIAL. 100F 16V 100nF BTA08-600TW ZD1 A D1, D2 K A K A1 A2 G Fig.2: the circuit is based on a PIC16F88 microcontroller (IC1). This senses the selected mode and the setting of the wall switch, operates a piezo transducer and drives the gate of Triac1 to turn on the fan for the preset time period. tive half-cycles and conducting as a conventional diode for negative halfcycles. The derived 5V DC supply is tied to the mains Active; ie, it floats at 240VAC and so is hazardous! Now that we know how the circuit is powered, it is somewhat easier to see how it works – see Fig.2. Microcontrol- ler IC1 does all the work, sensing when the wall switch is operated, driving the gate of the Triac to turn it on, driving the piezo transducer to produce an audible beep (as mentioned above) and a few other functions which we will get to shortly. Most of the time, IC1 is in sleep Fig.3: here’s how the 5V DC rail is derived for the timer circuitry. The dashed lines (i1 and i2) indicate the direction of current flow on alternate half cycles, with successive positive half-cycles charging the 470mF capacitor. The voltage across this capacitor is limited to 5.6V by ZD1. Subtract the 0.6V across D1 and you get 5V DC. Note that this 5V DC rail “floats” at 240VAC. 78  Silicon Chip mode, waiting for a signal from its interrupt input at pin 6 (port RB0). The wall switch provides that signal via a 2.2kW resistor, with the 22mF capacitor providing filtering to “debounce” the switch signal and also make it less sensitive to any interference signals picked up by the switch wiring. Normally, pin 6 is pulled low by its associated 10kW resistor. However, when the wall switch is closed, to turn on the fan, it pulls pin 6 high to +5V (actually to the 240VAC Active line). This causes the microcontroller to wake up and begins its timing function for the fan. After the preset time, the microcontroller reverts to sleep mode, waiting for the next throw of the switch. Five outputs of IC1 (ports RB1RB6) are paralleled to drive the gate of Triac1 via a 470W resistor and fast diode D2. The resistor limits the gate current to around 7mA when the five port outputs go low to pull current out of the gate of the Triac to turn it on to run the fan. A snubber network comprising a 47nF 250VAC capacitor and 1kW 1W siliconchip.com.au Par t s Lis t 1 PC board, code 10110051, 89 x 81mm 1 sealed IP65 ABS box, 115 x 90 x 55mm (Jaycar Cat. HB-6126) 1 4-way PC-mount terminal barrier with cover, 9.5mm pitch (Jaycar Cat. HM-3162) 1 low-profile piezo transducer (Jaycar Cat. AB-3440) 4 M4 x 10mm screws 2 M4 x 15mm screws 2 M2 x 10mm screws 6 M2 nuts 1 2-way pin header (2.54mm) 1 jumper shunt (JP1) 2 PC stakes 1 25mm length of 0.8mm tinned copper wire 1 10kW (code 103) horizontal trimpot (VR1) Semiconductors 1 PIC16F88 microcontroller programmed with fantimer.hex (IC1) resistor is connected across the Triac to damp any voltage spikes from the fan motor that may damage the Triac. Incidentally, the specified BTA08-600TW Triac is listed as a “snubberless” type, which means that it supposedly does not require an external snubber network. However, we have included the components anyway, to be sure 1 BTA08-600TW 8A 600V 5mA logic drive Triac (TRIAC1) – do not substitute 1 5.6V 1W zener diode (ZD1) 1 1N4007 1A 1000V diode (D1) 1 UF4003 fast recovery diode (D2) Capacitors 1 470mF 16V PC electrolytic 1 100mF 16V PC electrolytic 1 22mF 16V PC electrolytic 1 470nF 250VAC class X2 metallised polyester 1 100nF MKT polyester 1 47nF 250VAC class X2 metallised polyester 1 4.7nF MKT polyester Resistors (0.25W, 1%) 1 1.5MW VR25 (ie, high voltage – do not substitute) 1 10kW     1 1kW 1W, 5% 2 2.2kW    1 470W 1 1kW 5W, 5%     1 10W that it can handle a wide range of AC fan motors. The Triac is also referred to as a “logic level” type but this is not because it requires a 5V logic signal to turn on (like a logic-level Mosfet) but because its low 5mA gate current means that it can be easily turned on by logic circuitry. This circuit does not use a crystal oscillator but instead relies on an internal oscillator inside IC1, running at about 4MHz. The 1.5MW resistor and 4.7nF capacitor at pin 2 of IC1 allow the microcontroller to detect the phase of the mains waveform, so the fan can be switched on and off at the zero crossing point of the 240VAC sinewave. Note that the 1.5MW resistor is a Philips VR25 high-voltage type, specified because it has the full mains voltage applied to it at all times. Pin 4 is a brownout input. Should the supply drop below about 4V, the IC will be held reset until the voltage rises back above 4V. This brownout reset ensures that the microcontroller will operate correctly after any brownout condition has ended. Linking options Pin 13 (RB7) selects the delayed or immediate mode of operation, depending on whether a link is connected (delayed mode) or omitted (immediate mode). When the microcontroller is reset or first powered up, the RB7 input is pulled high via an internal pull-up resistor and it checks to see if the pin is high or pulled low via the link. Once it “knows” the answer, the internal pull-up resistor is deselected and no current flows through the link (if present). Pin 9 (port RB3) drives the piezo transducer via a 10W limiting resistor. The transducer is driven with a square wave at around 2kHz to produce an TAKE YOUR PIC Picaxe.com.au DISTRIBUTOR: MicroZed.com.au Developed for students, & professional performance makes PICAXE the most easy-to-use micro ever: PICAXE “programmer" is two resistors and a 4.5V battery! PHONE (02) 4351 0886 8.30-4.30 AEST Mon-Fri FAX (02) 4351 0889 24 Hours ALL PICAXE ITEMS ON OUR SHELVES! STOCKISTS siliconchip.com.au In AUSTRALIA: In NEW ZEALAND sicom.co.nz altronics.com.au (Retail and Mail Order) oatleyelectronics.com surplustronics.co.nz School Electronic Supplies (John - 03 8802 0628 – School orders only) October 2005  79 15001101 REMIT NAF WARNING: ALL PARTS OPERATE AT HIGH VOLTAGE PIEZO TRANSDUCER 47nF 250VAC CLASS X2 10 A 1N4007 VR1 NAF TRIAC1 BTA08-600TW 470 2.2k IC1 PIC16F88 ZD1 D1 JP1 ACTIVE 1k 1W 100nF 470F audible beep when the timing period is increased. Finally, there is the question of selecting the preset times for the fan to run. Trimpot VR1 is connected across the 5V supply rail and its wiper can be set to provide between 0V and 5V to pin 18 (AN1). This input monitors the voltage and an internal analogto-digital (A/D) converter produces a digital value which determines the preset timing period. Fig.5 shows the expected delay times for different settings of VR1. D2 4.7nF UF4003 1 22F 10k 100F WS 2.2k N FAN SWITCH Construction NEUTRAL Before starting construction, be sure to read the warning panel at the start of this article. All parts of this circuit operate at 240VAC and are potentially lethal if accidentally touched while it is connected to the mains. The Fan Timer is built on a PC board coded 10110051 and measuring 89 x 81mm. Fig.4 shows the parts layout. Begin by checking the PC board against the published pattern to ensure there are no shorts between tracks or breaks in the copper. That done, install two PC stakes to accept the piezo transducer connections, then install the 2-way header for jumper plug JP1. Follow these with the wire link and the resistors. Table 1 shows the resistor colour codes but you should also use a multimeter to check the values, as some of the colours can be difficult to decipher. Note that the 1.5MW resistor must be a VR25 high-voltage type (do NOT substitute). 1.5M VR25 10k 470nF 250VAC CLASS X2 1k 5W Fig.4 (above): follow this parts layout diagram to build the PC board. Take care with component orientation and note that the 1kW 5W resistor should be mounted slightly proud of the board to aid cooling. Below: leave jumper JP1 out if you want the timer to operate in immediate mode, or install it for extended mode operation. Table 2: Capacitor Codes Value 470nF 100nF 47nF 4.7nF μF Code IEC Code EIA Code 0.47µF 470n 474 0.1µF 100n 104 .047µF   47n 473 .0047µF   4n7 472 Table 1: Resistor Colour Codes o o o o o o o No. 1 1 2 1 1 1 80  Silicon Chip Value 1.5MW (VR25) 10kW 2.2kW 1kW 5% 470W 10W 4-Band Code (1%) brown green green yellow brown black orange brown red red red brown brown black red gold yellow violet brown brown brown black black brown 5-Band Code (1%) NA brown black black red brown red red black brown brown NA yellow violet black black brown brown black black gold brown siliconchip.com.au Note also that the 1kW 5W resistor should be mounted 3-4mm proud of the PC board to allow the air to circulate beneath it for cooling. Next, install a socket for IC1, making sure the orientation is correct – the notched end goes towards the 100mF capacitor as shown on Fig.4. That done, the capacitors can be installed but watch the polarity of the electrolytics. Diodes D1, D2 and ZD1 can go in next, again making sure they are all correctly oriented. Also, be careful not to get D1 and D2 mixed up – D1 is a 1N4007, while D2 must be a UF4003 fast recovery type. Now for the Triac. This must be installed with its metal tab facing towards the terminal block. Push it as far down onto the PC board as it will comfortably go before soldering its leads. Note: be sure to use the specified Triac – do not substitute for this part. The piezo transducer can go in next. It’s secured to the PC board using two M2 screws and six M2 nuts, with four of these nuts (two on each side) acting as spacers (ie, they go between the transducer and the PC board). That done, slide some smalldiameter heatshrink tubing over the transducer’s leads and solder them to the adjacent PC stakes (the polarity isn’t important). The heatshrink can then be slid down over the PC stakes and shrunk down to insulate (and strengthen) the connections. The large shrouded 4-way screw terminal strip is next on the list – just push it all the way down onto the PC board and solder it at the four central points. The two outer mounting points are not used here – ie, leave the mounting screws out. Finally, finish the PC board assembly by inserting the programmed PIC microcontroller (IC1) into its socket. Installing it in the case The completed PC board is housed inside a sealed IP65 ABS plastic box measuring 115 x 90 x 55mm. The specified unit (see parts list) is made of high-impact ABS material and features wall-mounting holes that are fully isolated from the internal compartment. It also features four integral mounting pillars with threaded brass inserts on the base and the lid-fixing screws also go into threaded brass inserts at the corners. siliconchip.com.au The PC board is fastened to integral tapped pillars inside the case using four M3 x 10mm screws. FULLY ANTICLOCKWISE 20 SECONDS FULLY CLOCKWISE 6 MINUTES 11 MINUTES 16 MINUTES 22 MINUTES VR1 TIME SETTINGS Fig.5: here’s how to set trimpot VR1 for various delay time intervals. Note that this trimpot operates at high voltage, so don’t attempt to adjust it after the Fan Timer has been connected to the mains unless you use a fullyinsulated tool. Do not substitute for this case, as it’s ideally suited to the job. For safety reasons, it’s vital that the PC board be fully enclosed inside the case, with no protruding metal parts. Don’t even think of using a metal case! The plastic case will need to be drilled so that there is access for the external wiring to connect to the screw terminals. These holes also allow the sound from the piezo transducer to escape from the box. Before installing the board, go over your work carefully and check that all parts are in their correct locations and that all polarised parts are oriented correctly. Check also for any short circuits due to solder bridges on the copper side of the PC board. Once you are sure that everything is correct, the board can be installed in the box. It’s simply secured to the four tapped integral pillars using M3 x 10mm screws. You now have to decide on the time that you want the fan to run for and adjust trimpot VR1 accordingly. Fig.5 shows the expected time periods for several positions of VR1. Do not attempt to adjust VR1 after the circuit has been connected to the mains, unless you use a fully-insulated tool (the trimpot operates at mains potential). You also have to decide on the operating mode that’s required. Leave JP1 out if you simply want the fan to run for a set time after if has been turned October 2005  81 50801001 MAINS ACTIVE REMIT NAF A NAF WS N A SWITCH FAN SW A FAN N N MAINS NEUTRAL Fig.7: these two warning labels should be cut out and affixed to the inside walls of the case. Fig.6: here’s how the Fan Timer is connected to the mains and the fan. on (this is the “immediate” mode). Alternatively, install jumper JP1 if the want the fan to continue running for a set time after it has been switched off (“delayed” mode). By the way, don’t be tempted to substitute a conventional pot for trimpot VR1. That would be much too dangerous. Remember – it operates at 240VAC. Finally, the front panel label should be affixed to the case lid, while the two warning panels should be cut out and attached to a couple of inside walls. Installation There is no safe way to test the Fan Timer circuit before it is installed – see the warning panel. It really is a matter of installing it and then seeing if it works correctly. Note that this unit should only be connected to the house wiring by a licensed electrician. Note that the specified box has mounting holes adjacent to the four corner pillars, which means that it can be secured to a timber beam or floor joist using wood screws. These mounting holes are fully isolated from the internal circuitry, so this is safe to do with the specified case. When the Fan Timer is powered up, the switch will initially have to be “switched over” a couple of times to turn the fan on. This will also have to be done if there has been a power blackout or brownout. This feature prevents the fan from starting up on its own when power is initially applied to the circuit. Once the fan has been switched on, the switch then acts as normal, according to the timing mode set by JP1. Dealing with a thermostat Fig.8: above are the full-size artworks for the front panel & the PC board. 82  Silicon Chip Finally, note that some exhaust fans are incorporated into heater lamp assemblies – eg, the IXLTastic range, as used in bathrooms. In these units, the fan will automatically start and run when the temperature reaches a certain level within the fan enclosure. The switching is done using a thermostat and is necessary to provide cooling inside the housing. The thermostat switch is connected between mains Active and the fan and will therefore operate in parallel with the Triac of the Fan Timer. This means that the thermostat will override the Fan Timer when closed, with the Fan Timer then operating normally when SC the thermostat opens. siliconchip.com.au