Silicon ChipA PIR-Triggered Mains Switch - February 2008 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Microcontroller projects can be simple and complex at the same time
  4. Feature: How To Get More Than 100MPG From A Toyota Prius by Jim Fell
  5. Review: ATTEN ADS7062CA Digital Storage Scope by Mauro Grassi
  6. Project: UHF Remote-Controlled Mains Switch by John Clarke
  7. Project: UHF Remote Mains Switch Transmitter by John Clarke
  8. Project: A PIR-Triggered Mains Switch by Jim Rowe
  9. Project: Shift Indicator & Rev Limiter For Cars by John Clarke
  10. Feature: PICAXE VSM: The PICAXE Circuit Simulator, Pt.2 by Clive Seager
  11. Vintage Radio: DC-to-AC inverters from the valve era, Pt.2 by Rodney Champness
  12. Project: Mini Solar Battery Charger by Branko Justic
  13. Advertising Index
  14. Book Store

This is only a preview of the February 2008 issue of Silicon Chip.

You can view 34 of the 104 pages in the full issue, including the advertisments.

For full access, purchase the issue for $10.00 or subscribe for access to the latest issues.

Items relevant to "UHF Remote-Controlled Mains Switch":
  • PIC16F88-I/P programmed for the UHF Remote Mains Switch Receiver [1010208A.HEX] (Programmed Microcontroller, AUD $15.00)
  • PIC16F88 firmware and source code for the UHF Remote Mains Switch receiver [1010208A.HEX] (Software, Free)
  • UHF Remote Mains Switch receiver PCB pattern (PDF download) [10102081] (Free)
  • UHF Remote Mains Switch receiver front panel artwork (PDF download) (Free)
Items relevant to "UHF Remote Mains Switch Transmitter":
  • PIC16F88-I/P programmed for the UHF Remote Mains Switch Transmitter [1020208A.HEX] (Programmed Microcontroller, AUD $15.00)
  • PIC16F88 firmware and source code for the UHF Remote Mains Switch transmitter [1020208A.HEX] (Software, Free)
  • UHF Remote Mains Switch transmitter PCB pattern (PDF download) [10202081] (Free)
  • UHF Remote Mains Switch transmitter front panel artwork (PDF download) (Free)
Items relevant to "Shift Indicator & Rev Limiter For Cars":
  • PIC16F88-I/P programmed for the Shift Indicator & Rev Limiter For Cars [0510208A.HEX] (Programmed Microcontroller, AUD $15.00)
  • PIC16F88 firmware and source code for the Shift Indicator & Rev Limiter for Cars [0510208A.HEX] (Software, Free)
  • Shift Indicator & Rev Limiter for Cars PCB patterns (PDF download) [05102081/2] (Free)
  • Shift Indicator & Rev Limiter for Cars lid artwork (PDF download) (Panel Artwork, Free)
Articles in this series:
  • PICAXE VSM: The PICAXE Circuit Simulator! (January 2008)
  • PICAXE VSM: The PICAXE Circuit Simulator! (January 2008)
  • PICAXE VSM: The PICAXE Circuit Simulator, Pt.2 (February 2008)
  • PICAXE VSM: The PICAXE Circuit Simulator, Pt.2 (February 2008)
  • PICAXE VSM: It’s Time to Play; Pt.3 (March 2008)
  • PICAXE VSM: It’s Time to Play; Pt.3 (March 2008)

Purchase a printed copy of this issue for $10.00.

Switch just about any plug-in mains-powered device when a passive infrared sensor detects a person approaching. It’s easy with this low-cost and easy-to-build project. By JIM ROWE PIR-Triggered Mains Switch Y ou’ve seen those lights fitted with PIR detectors which turn on when someone approaches. But what if you want to switch on something else that’s mains powered? Perhaps it’s other security lighting? Possibly an AV recording or playback system? Maybe a fountain pump? Or just about anything else that can plug into a standard power point? Think outside the square: what about a commercial display which you’d like to spring into action when there’s an audience close by? If so, this project is for you. We take a bog-standard (and cheap!) passive infrared detector, as used in millions of burglar alarms and use it to safely turn on 240VAC mains device(s) for an adjustable pre-set period – and siliconchip.com.au that period is set by you. It’s compact and easy to build but at the same time it’ll cost you much less than commercial PIR-triggered switches with similar features. Talking of features, how are these? First, it will accept trigger signals from virtually any standard low cost PIR detector which can be located up to 20m away, if that’s what you need. The two are connected together via a length of two-pair telephone cable – and the Switch Unit also provides 12V power for the PIR detector, via the same cable. Next, the switch unit uses a heavyduty mains-rated relay to switch the power to twin 240VAC outlets. The relay contacts are rated for 20A, so the unit is quite capable of switching power for any likely load combination, up to the normal 10A limit of a standard power point. Once triggered by the PIR detector, the unit can keep the power switched on for a preset period of time, which you can set to any of 10 different periods, ranging from about just a few seconds to 128 minutes (over two hours). This should make the unit suitable for many different applications, especially as it is also provided with a manual override button which can be used to switch off the mains power to the loads at any time regardless of the hold-on time setting. Finally, the Switch Unit fits in a UB2 sized jiffy box, with all of the low voltage circuitry on a small PC board for easy assembly. In fact, the Switch Unit could itself February 2008  57 +12V PIR DETECTOR R1 S N/C RELAY DRIVER Q S-R FLIPFLOP + SET HOLD ON TIME S1 MANUAL TURN OFF R2 N E O14 C1 S2 A Q R – 240V OUTLETS MAINS RATED RELAY O6 O5 O4 A MR MULTISTAGE BINARY COUNTER N E CLK E TIMING CLOCK +17V +12V 0V POWER SUPPLY A A N N 240V POWER Fig.1: the block diagram of the PIR-triggered mains switch. It can switch up to 10A from the two outlets (the limitation of a standard power point). be battery operated and switch low voltage devices if you like (it needs about 12V <at> 80ma). In addition the ‘live’ mains wiring is all off the PC board, in the interests of safety. Before we explain how it works, you should know that development of the project has been sponsored by Jaycar Electronics. As a result, kits for it will only be available from Jaycar stores and dealers. How it works As you can see from the block diagram of Fig.1, the project is quite straightforward. At lower right is the built-in power supply, which provides regulated 12V DC to power both the remote PIR detector and its own internal circuitry, plus an unregulated ~17V DC to power the relay. The output of virtually all PIR detec- tors is a set of relay contacts, which are normally closed and open when the detector senses movement. It is this set of contacts which we use to trigger the mains switching unit, by connecting them between the input of a CMOS inverter and ground. The inverter input is also connected to the +12V line with resistor R1, so that whenever the detector contacts open the inverter’s input is pulled high by R1 and its output will switch low. This action is used to ‘set’ a set/reset flipflop which is normally resting in its reset state. When the flipflop switches into the set state its Q output switches high. This is used to activate a driver circuit and energise the relay. Power is thus switched to the two 240VAC outlets and the loads. At the same time as the S-R flipflop switches to its set state, its Q-bar output switches low. This output is connected This shot shows the IEC connector and PIR input on the left end of the Jiffy box. 58  Silicon Chip to the master reset (MR) input of a multi-stage binary counter. So when the flipflop sets, this removes the reset from the counter and allows it to begin counting. It counts the pulses from a simple clock oscillator which runs at 0.9375Hz (the reason for this rather odd frequency will become clear in a moment). The binary counter has 14 stages but makes available only the outputs from internal flipflops 4-10 (O4-O10) and 12-14 (012-O14). We use rotary switch S2 to select one of these 10 outputs, so the rotor of S2 is kept low until the selected counter output switches high. This happens as soon as the counter has received the appropriate number of clock pulses: eight pulses in the case of O4, 16 for O5, 32 for O6, 64 for O7 and so on right up to O14, which only switches high after 8192 pulses have been counted. Whenever the selected counter output does switch high, this low-to-high transition is coupled via capacitor C1 into the input of a second inverter, which is normally held low by resistor R2. So the inverter’s input is taken high briefly, as C1 charges up via R2. But this is long enough for the inverter’s output to switch low, applying a triggering pulse to the reset input of the S-R flopflop. As a result the flipflop switches back to its reset state, turning off the relay and removing 240VAC power from the loads. So as you can see, this combination of a flipflop and a multistage binary counter allows us to automatically turn the relay off again after an approprisiliconchip.com.au PIR DET CON1 +12V 1 2 3 4 5 6 100nF 10k 1 14 3 13 2 IC1d IC1: 4093B 5 16 4 12 10k +12V 1M IN 0V 680nF LEDS +12V GND IC1c A 10 10 9 MR O9 O8 Rs O7 Rtc O6 O5 Ctc O4 OUT K 9 13 4m 14 2m 6 1m 4 30s E 5 15s +17V 7 68  5W S2 SET HOLD ON TIME 1k D6 E N CAUTION: CAUTION: Area within Area withinredred dotted at at dottedline lineis is 240V 240V potential potential K TRIGGERED LED2 15k  A K 240VAC OUTLET No.1 A T1 B 0V K A K A K 6V K Q1 BD139 N A E +17V A A C E D2–D5 6V 240V RLY 1 K A 10k A B C 22nF GND 240V AC INPUT BD139 BD13 7.5s 9 D1 POWER  LED1 15 8m MANUAL TURN OFF S1 8 7 IN 11 O10 Vss 8 K 7812 A IC2 4060B IC1b 6 1k Vdd 3 128m O14 2 64m O13 1 32m O12 11 12 IC1a 100nF (RJ12) OR 3-WAY PCB TERMINAL BLOCK 100nF REG1 7812 IN 2200 F 25V +12V OUT 240VAC OUTLET No.2 GND 22 F N A E MAINS EARTH SC  2008 PIR SENSOR TRIGGERED MAINS SWITCH D1: 1N4148 A D2–D6: 1N4004 K A K Fig.2: the circuit diagram shows how simple the PIR Mains Switch is. Note that this project switches mains and great care must be taken with mains wiring. It is definitely not a project for beginners! ate number of clock pulses have been counted – as selected by S2. For example, if S2 is set to O4 of the counter, the relay will be turned off after eight pulses have been counted; if it’s set to O5, the turnoff will be after 16 pulses; to O6 and it will be after 32 pulses and so on. 0.9375Hz? The reason for that apparently odd frequency of 0.9375Hz for the counter’s clock oscillator is due to the binary relationship between all of the counter outputs. The counter’s O6 output goes high after 64 pulses have been counted but by making the clock frequency 0.9375Hz we ensure that this corresponds to 60 siliconchip.com.au seconds or one minute. (That’s because 60/64 = 0.9375.) The same clock frequency makes the switch-off times corresponding to the higher counter outputs also correspond to reasonably convenient multiples of minutes: two minutes for O8, four minutes for O9, eight minutes for O10, 32 minutes for O12, 64 minutes for 013 and 128 minutes for O14. The lower outputs also give reasonably convenient shorter times: 30 seconds for O6, 15 seconds for O5 and 7.5 seconds for O4. But what if you have set the project to hold the power on for, say, 64 minutes after triggering and then want to switch it off immediately? That’s easily fixed, because we have also provided normally open pushbutton S1, which pulls the inverter input high and causes it to reset the S-R flipflop straight away. All you have to do to turn off the load power at any time is press S1 briefly. By the way, whenever the S-R flipflop is reset (and for whatever reason), this doesn’t just turn off the relay and power to the load. It also re-applies a logic high to the MR input of the counter, resetting it and preventing it from counting. So the whole circuit is reset, ready to await the next trigger pulse from the PIR detector. Circuit details The schematic diagram of Fig.2 provides all of the circuit details. The February 2008  59 240V MAINS INPUT RELAY (RLY1) CABLE TIES T1 2851 A E HEATSHRINK SLEEVING OVER JOINTS 0V S1 MANUAL TURNOFF 7002 C 17011101 4004 4004 4004 D4 D5 + 4004 D3 HS2 Q1 BD139 1k 4004 22 F D6 BD135 EJ 680nF 10 10k 1M S2 10k 1 2 22nF IC1 4093B IC2 4060B HOLD ON TIME 15k 10k 100nF D1 4148 + DNG RELAY COIL 68 /5W 2200 F 100nF REG1 7812 1k (OPTIONAL RJ12 SOCKET OR 3-WAY TERMINAL BLOCK) PIR DET LED2 TRIG’D D2 91217002 5545CK 3728CE NI HS1 PWR HCTIWS SNIAM GIRT RIP +V 12V AC IN 100nF LED1 CON1 6V 6V N HEATSHRINK SLEEVES OVER ALL QUICK CONNECTORS 6 CABLE FROM PIR DETECTOR PLUGS IN HERE Fig.3: combined component overlay and wiring diagram. Follow this diagram exactly – you cannot take chances when mains is involved! Note the comments in the text about the RJ12 socket or 3-way terminal block (PIR input) options. S1 (ON FRONT PANEL) SUITABLE LENGTH OF 2-PAIR CABLE E A N E A N RJ11 4-PIN MODULAR PLUG (TOP VIEW) ALARM (NC) (2) (3) (4) (5) – + REAR OF MAINS OUTLET 2 REAR OF MAINS OUTLET 1 NOTE LINK TAMPER (NC) “PRESSPAHN” OR OTHER SUITABLE INSULATION COVERING OUTLETS TERMINAL BLOCK INSIDE PIR DETECTOR Fig.4: detail of the cable connecting a typical PIR detector and the Switch Unit, assuming the RJ12 socket is used on the PC board. PIR detector connects to the circuit via CON1, a ‘modular’ telephone-type connector. It receives 12V power via pins 2 and 5 of CON1, while its output (switching) contacts are connected to pins 4 and 3. Pin 4 connects to the two inputs of Schmitt gate IC1a, tied together so that it forms the input inverter. As you can see the input pins are connected to +12V via a 10kW resistor 60  Silicon Chip (the equivalent of R1 in Fig.1), while they are also connected to ground via a 100nF capacitor to bypass any RF signals which may be picked up by the cable from the PIR detector. (Once upon a time all we had to worry about was radio stations. Now there’s TV, mobile phones, cordless phones, WiFi, Bluetooth, video/audio senders and even wireless doorbells to cause problems on long cables). Cross-coupled gates IC1d and IC1b form the S-R flipflop, with the output of IC1d (pin 11) forming its Q output and that from IC1b (pin 4) forming the Q-bar output. IC2 is a 4060B device, which not only provides our 14-stage binary counter but also its clock oscillator as well. The two resistors and 680nF capacitor connected between pins 9, 10 siliconchip.com.au Same-size photo clearly shows component placement on the PC board. and 11 of IC2 set the clock frequency to 0.9375Hz. In reality, it will not be anywhere near as precise. As explained earlier, the S-R flipflop’s Q-bar output (pin 4 of IC1) is used to control the counter’s operation by pulling the MR input of IC2 (pin 12) high to prevent counting, or pulling it low to allow it to count. The remaining gate of IC1 (IC1c) is used to form the inverter for the S-R flipflop’s reset input. One input of this gate is tied to +12V, while the other input (pin 8) is pulled down to earth by a 15kW resistor (equivalent to R2 in Fig.1) and coupled to the rotor of switch S2 via a 22nF capacitor which corresponds to C1 in Fig.1. Manual turnoff switch S1 also connects between pin 8 and +12V. The Q output of IC1 (pin 11) is also connected to the base of transistor Q1, via a 10kW series resistor. Q1 is the relay driver, which energises relay RLY1 when it conducts. The relay coil is connected to +17V via a 68W 5W resistor for current limiting. Diode D6 is also connected across the relay coil to protect Q1 from damage due to the inductive ‘spike’ when the relay de-energises. LED2 and its 1kW series resistor are also connected across the relay coil, to indicate when the relay – and therefore load power – is ‘ON’. The project’s power supply uses a small (2VA) power transformer T1 driving a four-diode bridge rectifier to produce the unregulated output (about 17V) which operates the relay. Regulator REG1 then derives a regulated 12V line from the rectifier output to provide power for the rest of the circuit and siliconchip.com.au the PIR detector. LED1 and its series 1kW resistor are connected across the 12V supply to indicate when power is applied to the switch unit and PIR detector. Construction There are two parts to this circuit – the low voltage side (which mounts on a small PC board) and the mains wiring. It all fits inside a standard UB2 size (197 x 113 x 63mm) jiffy box, with room left for the off-board (mains) components: the IEC mains input plug, power transformer T1, relay RLY1, the two flush-mount mains outlet sockets and manual turnoff switch S1. In our prototype, the IEC mains input connector is mounted in the left-hand end of the box. However, we have been informed that production kits from Jaycar will probably have the IEC connector mounted on the front panel (the jiffy box lid) adjacent to the mains output sockets. The wiring is the same but take the changed position into account. Transformer T1 and the mains relay (RLY1) are bolted into the bottom of the box alongside the PC board, while the two mains outlet sockets and manual turn-off switch (S1) are mounted in the lid of the box (which forms the front panel). Rotary switch S2 actually mounts on the PC board, but its control shaft is left at its full length so that it protrudes through a matching hole in the lid, to be fitted with a small pointer knob. The overlay/wiring diagram of Fig.3 shows not only where all components go on the PC board (and their orienta- tion) but also how the wiring is made connecting the offboard components. It also shows which joints need to be provided with heatshrink sleeves, to prevent accidental contact when the box is opened. So if you follow all aspects of this diagram carefully, you should be able to build up the unit both safely and successfully. Note that there are six wire links (all 0.4” long) to be fitted to the PC board, preferably before any of the components are fitted because this is the easiest time to do so. After the links are fitted it’s a good idea to fit the seven PC pins, three of which are used to make the connections from the secondary of T1, two are for the relay coil connections while the remaining two pins are used for the wires connecting S1. Next fit the DIL sockets for IC1 and IC2, making sure you fit them with their ‘notch’ end towards the left so they’ll guide you later in fitting the ICs with the correct orientation. Then fit CON1, the RJ12 modular connector which fits at the left hand end of the board. A note here: the PC board pattern will also accommodate a 4-way PC-mounting terminal block, if you would rather “hard wire” the PIR to the PC board. After this, fit rotary switch S2, noting that it needs to be orientated with its indexing spigot in the ‘north-east’ position. After mounting it you need to remove its nut, star lockwasher and position stop plate, then refit these in reverse order after making sure the stop plate’s locating pin is entering the slotted hole between the ‘10’ and ‘11’ numerals moulded into the top of the switch body. This is to ensure that the switch is set for 10 positions. Once S2 is in place and set correctly, fit the various resistors and smaller unpolarised capacitors. Follow these with the 22mF and 2200mF electrolytics, which are of course polarised – so fit these carefully according to the overlay diagram. Then fit signal diode D1 and the five power diodes D2-D6, followed by transFebruary 2008  61 Opened-out view of the completed project. Note the heatshrink covering any exposed mains and the Presspahn shield over the mains outlet sockets. This photo is of the first prototype which used a DIN PIR input socket – now changed to either an RJ12 phone-type socket or a 3-way PC board terminal block. istor Q1 and regulator REG1. Note that both Q1 and REG1 are mounted horizontally and each device is fitted with (or on) a small U-shaped TO-220 type heatsink, with a 6mm long M3 machine screw and nut used to clamp them in place on the top of the board. The next components to fit to the board are LED1 and LED2. These need to have their leads extended using 25mm lengths of hookup wire, so that the body of each LED will protrude through the matching holes in the box lid when this is fitted. Use hookup wire with red insulation to extend the longer LED anode leads, and wire with black insulation to extend the cathode leads. Then you shouldn’t have any trouble fitting the extended leads to the board correctly – the red anode leads go towards the rear of the board, and the black cathode leads towards the front. Wiring Your PC board assembly is now just 62  Silicon Chip on complete, so place it aside while you fit the IEC mains input plug into the end of the box. It’s fastened into the matching hole via a pair of 10mm long countersink-head M3 machine screws, fitted with star lockwashers and nuts on the inside. Then mount the power transformer T1 in the bottom of the box, using another pair of M3 countersink-head 10mm long screws with flat washers, star lockwashers and nuts. Once it’s in position, fit another star lockwasher to the mounting screw nearer the IEC mains plug, and then slip on a solder lug followed by a further lockwasher and finally a second nut. Tighten this last nut firmly with a nut driver or tube spanner so there’s no chance of the solder lug coming loose. (The lug is used to connect the transformer core and frame to mains earth, for safety.) Now relay RLY1 can be bolted into the bottom of the box in much the same way, except that its plastic case needs no earthing. So in this case just use a pair of 10mm x M3 countersink head screws with flat washers, star lockwashers and nuts. Next is a 50mm length of mainsrated figure-8 wire, used to connect S1 to the board just before the box lid is fitted. Solder one end of these to the PC pins marked “S1” on the PC board and leave the other end for the moment. We specify mains-rated cable here due to the fact that inside the box is mains wiring which (while the chance is very remote), could possibly come loose and move around. The figure-8 itself only carries low voltage but its insulation is mains rated to prevent any possible contact. At this stage you can mount the PC board assembly into the box using four 15mm long M3 tapped spacers, with four 10mm long x M3 countersink head Nylon machine screws to attach the spacers to the bottom of the box and four 6mm long pan head M3 screws to attach the board to the top of the spacers. Again, Nylon screws are specified “just in case” – these screws pass from the inside of the case, where there is mains wiring, to the outside. Then you can make the connections between the secondary winding of T1 and the three PC pins on the board just near T1. Do this by cutting all three leads to about 50mm long, removing about 6mm of insulation from the end of each wire and then soldering them to the terminal pins. The two wires with yellow insulation connect to the outer pins, while the wire with white insulation connects to the centre pin. After this prepare two 60mm lengths of mains-rated insulated hookup wire by baring about 5mm of wire at each end, and then fitting a female ‘quick connect’ spade connector to one end of each wire. Then slip a 25mm length of 6mm diameter heatshrink sleeving over each connector, and use a hot air gun or the barrel of your soldering iron to shrink the sleeves down snugly around each connector. After this, tin the other end of each wire and finally, solder them to the PC board terminal pins just to the left of the heatsink for Q1. These wires are used to connect between the board and the coil lugs of RLY1 - which are the two closer-spaced lugs on its left (assuming you’ve fitted it the correct way around). So once the wires have been soldered to the PC board pins, siliconchip.com.au Parts List – PIR-Triggered Mains Switch 1 1 2 1 1 1 1 Here’s a close-up view of the Presspahn insulation over the mains outlet sockets just before it was secured in place. push their quick connector ends down firmly over the relay lugs as far as they’ll go. Next fit the two flush mounting mains outlets to the lid of the box, and also fit pushbutton switch S1 into its hole in the lid near the other end. Then if you turn the lid and place it near the right-hand end of the box, you should be able to add all of the remaining off-board mains wiring between the IEC mains plug, the primary winding of T1, the switching contacts of RLY1 and the mains outlets. Do this by carefully following the overlay/wiring diagram, which shows all of the wiring fairly clearly. How do you know if the insulation on the cable you want to use is mains-rated? A good source of “guaranteed” mains-rated cable is from a length of discarded mains lead. It’s always handy to keep some in the junk box for purposes such as this! Each of the three terminals (A, N and E) on the IEC mains input connector has two wires connected to it First the earth: a short length of green/yellow mainsrated wire is used to make the connection between the IEC connector’s centre earth lug and the solder lug fitted to the left-hand end of T1, while another much longer piece of the same wire (~160mm) is used to connect to the earth connection of each mains outlet. Both wires should be soldered to the IEC plug’s centre lug together, to ensure a good reliable connection for them both. The mains (Active and Neutral) wires don’t solder to the lugs on the IEC socket but to quick-connect female spade connectors. Each of these connectors has a 25mm length of heatshrink insulation fitted after soldering so they are completely covered. Cut two 25mm lengths of heatshrink, pass the two wires through and slide the heatshrink well up before soldering. Otherwise they may shrink from the heat of soldering before you get them over the quick-connect spade terminals. The “A” terminal of the IEC connector has the brown (Active) wire from the transformer primary, along with a 160mm-long mains-rated wire with brown (or red) insulation which goes to one of the switching terminals of the relay, again via a quick-connect female spade connector. Another, similar, length of the same wire (also fitted with an insulated spade connector) goes from the other switching terminal of the relay with its opposite end going to both the “A” screw terminals of the mains sockets. The second primary wire from the transformer (with blue siliconchip.com.au PC board, code EC8273, 147 x 69mm UB2 jiffy box, 197 x 113 x 63mm Heatsinks, 19mm square TO-220 type Pushbutton switch, SPST (S1) Rotary switch, 1 pole 12 position (S2) Pointer knob with removable pointer inset 6-pin RJ12 socket, PC board mtg (CON1) OR 3-way PC board mounting terminal block (see text) 1 14-pin DIL IC socket (for IC1) 1 16-pin DIL IC socket (for IC2) 1 Power transformer, 12.6V/2VA, 2851 type 1 20A mains rated relay, chassis mtg (RLY1) 1 IEC mains plug, panel mounting 2 Mains sockets, flush mounting panel type 4 15mm long M3 tapped spacer 10 Nylon M3 machine screws, 10mm long CSK head 6 M3 machine screws, 6mm long pan head 8 M3 nuts with flat and star lockwashers 1 Solder lug 8 Nylon cable ties, 100mm long 6 Quick connectors, female spade type 6 25mm lengths of 6mm diameter heatshrink tubing 7 PC board terminal pins, 1mm diameter 1 90 x 104mm piece “Presspahn” or similar insulation Semiconductors 1 4093B quad Schmitt NAND (IC1) 1 4060B binary counter (IC2) 1 7812 12V regulator (REG1) 1 BD139 NPN transistor (Q1) 1 5mm LED, green (LED1) 1 5mm LED, red (LED2) 1 1 N4148 silicon diode (D1) 5 1N4004 1A power diode (D2-D6) Capacitors 1 2200mF 25V RB electrolytic 1 22mF 16V RB electrolytic 1 680nF MKT metallised polyester 3 100nF MKT metallised polyester 1 22nF MKT metallised polyester Resistors (0.25W 1% unless specified) 1 1MW 1 15kW 3 10kW 2 1kW 1   68W/5W wirewound The design of this kit and PC board are Copyright (C) 2007 to Jaycar Electronics. Kits (cat no KC5455) will be available from Jaycar Electronics stores and resellers shortly after this issue goes on sale. insulation) attaches via an insulated female spade terminal to the “N” terminal of the IEC connector, along with an even longer wire (about 300mm) whose opposite end screws into both the “N” terminals of the mains output sockets. When you have soldered all wires to their female spade connectors, slide the lengths of heatshrink back down the wires so that the connectors are fully covered, then shrink February 2008  63 with a heat gun. When you push the female spade connectors onto their appropriate male spade terminals, there should be no exposed mains wiring or metalwork visible. Once you’ve completed the mains wiring, it’s a good idea to tidy it all up using about six small cable ties as shown in the overlay diagram. This doesn’t just make the wiring look tidier; it also helps ensure that in the unlikely event of a live wire breaking off anywhere, it can’t ‘wander’ far enough to make contact with any of the low voltage wiring. With the cable ties fitted, the next step is to swing the box lid around so it’s just in front of the box, so you can solder the two wires coming from the PC board pins (just to the left of the socket for IC1) to the lugs on the rear of pushbutton S1. We also covered these joins in heatshrink – just in case. You will note from our photographs that we also shielded the two mains outlet sockets with an insulating material – again, just in case. In the past, the most usual material to use was a product called “Presspahn” but that is becoming rather difficult to get these days (at least in small quantities). We used a piece of cardboard which has a PVC insulation on one side. Other ideas that spring to mind are thin plastic or perhaps a sheet of plastic laminated paper. The U-shaped shield, the dimension of which are shown in Fig.5, is fixed to the case by slightly undoing the mains socket mounting screws and “sandwiching” the insulation between the back of the mains socket and the case (tightening the screws again to keep it in place). After this the final assembly step is to plug the two ICs into their sockets, making sure you fit them with their ‘notch’ ends towards the left in each case. The internal wiring of your PIR Triggered Mains Switch will now be complete and you can swing the box lid up and lower it in position, carefully making sure that the control spindle BEND DOWN 90 o 25mm 7mm BEND DOWN 90 o 40mm BEND DOWN 90 o 25mm 7mm BEND UP 90 o 90mm Fig.5: the detail for the insulating shield over the mains outlet sockets. It secures under the outlet backs. of S2 and the two LEDs pass through their corresponding holes and that no internal wiring is pinched between box and lid. You should then be able to fit the pointer knob to S2’s spindle, and also screw the lid down using the four small self-tapping screws provided. If you find the pointer on the knob doesn’t point to the right place, the knob specified has a small inset plate at the top which can be prised off and rotated to get the pointer in the correct position. PIR Wiring There is no testing or adjustment procedure required for this project; it should operate as soon as power is applied. However you will no doubt have to make up a cable to connect the project to the PIR detector unit you have chosen to use with it. Needless to say the cable will need to be long enough to run for the distance between them. It should be very easy to make up the cable, because we’ve made the connector for the Switch end an RJ12 modular socket and used only the four centre pins of it. As a result you can make the cable easily by ‘converting’ a standard low cost modular telephone extension lead, sold in Jaycar stores (and many others as well) in lengths up to at least 15m. These leads are fitted with an RJ12 (6P/4C) plug at each end, so all you need to do is cut off the RJ12 plug at one end, and then remove the outer sleeve at that end to reveal the four wires which will be used to connect to the PIR Detector’s terminals. The PC board also has provision for a standard 3-way terminal block if you prefer to wire the PIR detector in that way. Both inputs are shown on the overlay diagram. The way to make the connections at the PIR Detector end of the cable is shown in Fig.4. As you can see it’s quite straightforward: the 12V power wires from pins 2 and 5 of the RJ12 plug connect to the positive and negative power terminals, while the wires from pins 3 and 4 of the plug connect to the two end terminals of the four provided for connections to the normally closed ‘detect’ contacts and the ‘tamper’ (or box opening) sensor switch. Then the two centre terminals are linked by a short length of wire as shown, to connect the two pairs of normally closed contacts in series. That’s about it. When you connect up the PIR Detector to your completed Switch Unit and also connect a 240V IEC power lead to the Switch Unit’s IEC input plug, on power-up you should find that the green power LED (LED1) on the Switch Unit will turn on to show that the circuit is active. As soon as the PIR Detector senses any movement, the Switch Unit’s red LED2 should also turn on to indicate that the mains switch has been triggered on. It should continue glowing for whatever period of time corresponds to the setting of switch S2 – anywhere between 7.5 seconds and 128 minutes. And if you plug some lights etc into one of the Switch Unit’s mains outlets, they should also receive power for the same period of time following a trigger event. Check that the timing period is correct (see comment above about moving the pointer on the knob) and also check that pushbutton S1 turns off the load power (and LED2) when pressed. SC Capacitor Codes Resistor Colour Codes No. o   2 o   1 o   2 o   6 Value 1MW 15kW 10kW 1kW 64  Silicon Chip 4-Band Code (1%) brown black green brown brown green orange brown brown black orange brown brown black red brown 5-Band Code (1%) brown black black yellow brown brown green black red brown brown black black red brown brown black black brown brown Value 680nF 100nF 22nF mF Code IEC Code EIA Code 0.68mF 680n 684 0.1mF 100n 104 .022mF 22n 223 siliconchip.com.au