Silicon ChipUSB-Controlled Power Switch - November 2004 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Fixed line phones no longer a necessity
  4. Feature: Look Mum: No Wires by Ross Tester
  5. Feature: The New Era In Car Electrical Systems by Julian Edgar
  6. Project: USB-Controlled Power Switch by Jim Rowe
  7. Project: A Charger For Deep-Cycle 12V Batteries, Pt.1 by John Clarke
  8. Project: The Driveway Sentry by Jim Rowe
  9. Project: SMS Controller, Pt.2 by Peter Smith
  10. Project: Picaxe Infrared Remote Control by Clive Seager
  11. Feature: Emergency Power When All Else Fails by Stan Swan
  12. Vintage Radio: Those troublesome capacitors, Pt.2 by Rodney Champness
  13. Back Issues
  14. Book Store
  15. Advertising Index
  16. Outer Back Cover

This is only a preview of the November 2004 issue of Silicon Chip.

You can view 23 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 "USB-Controlled Power Switch":
  • USB-controlled Power Switch PCB pattern (PDF download) [10111041] (Free)
  • USB-Controlled Power Switch label artwork (PDF download) (Panel Artwork, Free)
Items relevant to "A Charger For Deep-Cycle 12V Batteries, Pt.1":
  • PIC16F628A-I/P programmed for the Deep-cycle 12V Battery Charger [battchrg.hex] (Programmed Microcontroller, AUD $10.00)
  • PIC16F628A firmware and source code for the Deep-cycle 12V Battery Charger [battchrg.hex] (Software, Free)
  • Deep-Cycle 12V Battery Charger PCB patterns (PDF download) [14111041/2/3] (Free)
  • Deep-cycle 12V Battery Charger front panel artwork (PDF download) (Free)
Articles in this series:
  • A Charger For Deep-Cycle 12V Batteries, Pt.1 (November 2004)
  • A Charger For Deep-Cycle 12V Batteries, Pt.1 (November 2004)
  • A Charger For Deep-Cycle 12V Batteries, Pt.2 (December 2004)
  • A Charger For Deep-Cycle 12V Batteries, Pt.2 (December 2004)
Items relevant to "The Driveway Sentry":
  • Driveway Sentry PCB pattern (PDF download) [DRIVSENT] (Free)
  • Driveway Sentry front panel artwork (PDF download) (Free)
Items relevant to "SMS Controller, Pt.2":
  • ATmega8515 programmed for the SMS Controller (Programmed Microcontroller, AUD $15.00)
  • ATmega8515 firmware and source code for the SMS Controller (Software, Free)
  • SMS Controller PCB pattern (PDF download) [12110041] (Free)
Articles in this series:
  • SMS Controller, Pt.1 (October 2004)
  • SMS Controller, Pt.1 (October 2004)
  • SMS Controller, Pt.2 (November 2004)
  • SMS Controller, Pt.2 (November 2004)
Items relevant to "Picaxe Infrared Remote Control":
  • PICAXE-08M BASIC source code for the PICAXE Infrared Remote Control (Software, Free)
Articles in this series:
  • Those troublesome capacitors, Pt.1 (October 2004)
  • Those troublesome capacitors, Pt.1 (October 2004)
  • Those troublesome capacitors, Pt.2 (November 2004)
  • Those troublesome capacitors, Pt.2 (November 2004)

Purchase a printed copy of this issue for $10.00.

Tired of having to switch the power to your PC’s peripherals on and off manually, as well as switching the PC itself? Here’s a simple way to make life easier by having the PC control the power to its peripherals automatically via one of the USB cables. There’s only a handful of components involved and they can be built right inside a low-cost multi-way power distribution board. USB By JIM ROWE UP A USB-controlled Power Switch M ost of the first generation of personal computers had an ‘IEC’-type 240V outlet on the back of the box, which provided power switched by the PC’s own power switch. This allowed you to control the power to the computer’s monitor, printer and other peripherals simply by plugging in a power distribution board to this outlet and plugging the peripheral power cords into the distribution board outlets. The power switch on the front or side of the PC then controlled everything, which was very neat and convenient. Unfortunately this handy switched power outlet disappeared from later models, presumably because it became harder to implement when PC manufacturers changed over to softwarecontrolled power supplies. So, with most newer PCs, if you wanted to control everything with a single switch, you’ve been forced to use a power distribution board with its own master power switch. There is a way to get true singleswitch operation, though, if you’re using a recent model PC with at least one USB port (and that means just about any PC made in the last few years or so). This is to control the power fed to the peripherals using an electronic switch triggered by low-voltage DC from the PC itself, via its USB port. The electronic switch then turns the peripherals on when the PC is turned on, and turns them off when it’s turned off. Here’s the completed project, mounted (in this case) inside a Kambrook KPB6 Powerboard. One outlet is sacrificed in this version to accommodate the USB-UP PC board and a label is fitted over the unused outlet. 28  Silicon Chip siliconchip.com.au PLEASE NOTE: This project involves opening and modifying a mains powerboard. Do not attempt this project unless you are experienced in mains wiring and construction. Contact with the mains can cause severe injury or death. Never work on a power board with the plug in an outlet, let alone turned on. ALSO: While the original powerboard is rated at 10A, 240V (2400W) the modifications made limit the total loading to around 700-750W, or 3A. This limit should be more than adequate for the intended application: switching computer peripherals. Forgive the mess of cables: normally these would of course be behind or under the desk, out of sight. But then we wouldn’t be able to show you the USB-UP powering the monitor, amplified speakers, external IDE/ USB disk, printer, even a phone charger . . . The electronic switch needs to be optically isolated, so there’s no risk of 240VAC getting back into the low voltage circuitry of the computer via the USB port. But a high-voltage optocoupler neatly solves that problem. In this article we’ll show you how to build a USB-controlled electronic power switch right inside a low-cost power distribution board, for maximum safety and convenience. How it works When a PC is powered up, +5V DC appears on pin 1 of each of its USB port sockets. We simply tap off a few milliamps from this convenient source of 5V DC, to trigger a 240V Triac via an optocoupler. The Triac therefore switches power to your peripherals whenever the PC is powered up. The circuit is shown in Fig.1. A pair of standard USB sockets, CON1 and CON2, allow the circuit to be connected in series (ie, daisy-chained) with any normal USB peripheral cable. All of the USB connections go ‘straight through’, so the added circuitry is essentially transparent as far as USB communication is concerned. The connections to the USB port are to pin 1, the +5V line, and pin 4, the ground (0V) line. Across the two we connect the input LED of OPTO1, an MOC3021 opto-isolated Triac driver, with a 220W resistor in series to limit the current to 15mA – just sufficient to ensure reliable triggering. The optical isolation inside the MOC3021 is rated to withstand voltage ‘spikes’ of up to 7.5kV peak, which reduces the risk of flashover to a very low level. The 470W and 390W resistors and the 47nF ‘X2’ rated capacitor ensure that when OPTO1 is triggered on it in turn switches on the BT137F Triac, at very close to the zero crossings of every 240V AC power half-cycle. Finally, a series combination of a 10nF capacitor and a 39W resistor is connected directly across the Triac to form a ‘snubber’ circuit. This protects the Triac against spurious triggering caused by mains spikes or switching spikes produced by inductive loading of some of the peripheral device power supplies. Construction We have a designed a small PC board which fits into typical 6-way distribution boards like the Jaycar/Powertech MS4031 or the Kambrook KPB6. The Jaycar Powerboard has the advantage of having room inside the case for mounting without “surgery” and also contains spike and noise suppression; however it is more expensive than the Kambrook Powerboard. The only way to fit the PC board inside the Kambrook unit is to sacri- The alternative power board from Jaycar, the Powertech MS4031. It is more expensive than the Kambrook but does not need any “surgery” to fit the USB-UP PC board inside (so you retain all six outlets) and also has very worthwhile surge/spike protection built in. siliconchip.com.au November 2004  29 WARNING: WIRING & COMPONENTS IN THIS AREA ARE AT 240V MAINS POTENTIAL WHEN THE CIRCUIT IS OPERATING. CONTACT MAY BE LETHAL! 220Ω OPTO1 MOC3021 1 390Ω 2 47nF 275VAC X2 CLASS 4 MAINS ACTIVE IN TRIAC1 6 λ 470Ω 10nF 275VAC X2 CLASS A1 BT137F G 39Ω A2 MAINS ACTIVE OUT CON2 USB SKT TYPE A CON1 USB SKT TYPE B 1 Vbus 4 GND USB IN FROM PC 2 D– 2 3 D+ 3 1 4 USB OUT TO PERIPHERAL BT137F USB-up POWER SWITCH SC 2004 A2 A1 G Fig.1: the circuit diagram shows that the USB connectors are wired “straight through” so USB devices connected are unaffected. The circuit steals a few milliamps from the USB to turn on a fully isolated triac and thus the powerboard. fice one of the six outlets and mount the board in its place. We’ll explain how shortly. The PC board measures 48 x 43mm and is coded 10111041. The board has rounded cutouts in two adjacent corners, to allow them to be fitted between pillars inside typical distribution boards. Fitting the components to the PC board shouldn’t present any problems if you follow the overlay/wiring diagram carefully. Just make sure you fit the two USB sockets in the correct positions, as they are different in terms of their pin layout. Take care with OPTO1 and TRIAC1, to fit them the correct way around. The Triac body is held down against the PC board using a 6mm M3 machine screw and nut. Before mounting the PC board in a typical 6-way distribution board, you have to open up the board by removing the ‘tamper proof’ screws which fasten the upper and lower halves together. These screws can usually be removed fairly easily using a matching hex-shank bit from one of the multi-bit sets available from many electronics suppliers and bargain stores. Or you can make your own “tamper proof screw” screwdriver by filing a small (2mm or so deep) notch in the centre of a spare flat-bladed screwdriver of suitable size. Once you have the board opened, there will be a different procedure, depending on whether you are installing the PC board into the Jaycar/ Powertech MS4031 or the Kambrook KPB6. Let’s talk about the Jaycar distribution board first. Jaycar MS4031 Powerboard You can see the general arrangement from the internal photos which were taken inside a Jaycar MS4031 board. There is just enough open area in the end of these units to fit the PC board assembly. Making the connections is as follows: the short brown wire connecting the ‘Active’ bus bar of the six outlet sockets to the original RFI filter board (at the cord entry end of the case) is removed, and replaced with a 300mm length of similar brown 250VAC-rated wire running from the existing RFI filter board down to one of the mains MAINS ACTIVE OUT MAINS ACTIVE IN 10111041 10nF 14011101 275V AC 470Ω 47nF 275VAC USB IN CON1 3 2 4 1 39Ω 390Ω OPTO1 MOC 3021 220Ω TRIAC1 BT137F CON2 4 1 3 2 USB OUT Fig 2 (left): the PC board overlay, with the PC board pattern itself shown at right. In the centre is the completed PC board for comparison. 30  Silicon Chip siliconchip.com.au Parts List – USB-UP 1 PC board, code 10111041, 48 x 43mm 1 6-way power distribution board (see text) 1 Type B USB socket, PC-mounting (CON1) 1 Type A USB socket, PC-mounting (CON2) 3 25mm x M3 Nylon machine screws (Kambrook) or 9mm 6G self-tappers (Jaycar) 1 6mm M3 metal screw 4 M3 nuts & lockwashers Semiconductors 1 MOC3021 opto-isolated Triac driver 1 BT137F 600V/8A isolated-tab Triac STEP-BY-STEP: Modifying the Kambrook powerboard The Jaycar powerboard is similar but note the differences as explained in the text! After checking (twice!) that the powerboard is not plugged in to an outlet, remove the back and identify the active (brown) wire between the overload switch and the active bus (left pic). Cut this wire at both ends and remove it. Capacitors 1 47nF 275V ‘X2’ rated metallised polypropylene 1 10nF 275V ‘X2’ rated metallised polypropylene Resistors (0.25W 1%) 1 470W 1 390W 1 220W 1 39W connections on the new USB switch board. Then an additional 30mm length of the same wire is used to connect the second mains connection on the switch board to the adjacent ‘other end’ of the long brass strip forming the Active contacts of the outlet sockets. The board is mounted in the end of the case using three 9mm long 6G self-tapping screws, which mate with pillars already moulded into the inside of the upper part of the case.The only work required on this part of the case is to trim down a couple of these pillars to the same height as the shortest original one, so they form a stable support trio. This can be done quite easily using a sharp hobby knife. The Triac body is held down against the PC board using a 6mm M3 machine screw and nut. At the opposite end of the powerboard, cut the Active, Neutral and Earth bus bar straps immediately after the fifth outlet. Remove these, then cut away the plastic supports for the sixth outlet. Grind them down until they are nearly level with the case body. Cut away the appropriate slots for the USB sockets, using the drawing below as a guide. Fill in the empty outlet holes with silicone sealant. Drill the three 3mm holes in the bottom of the case to accept the three Nylon mounting screws. The completed project in the top of the Jaycar powerboard (immediate right) and the bottom of the Kambrook powerboard (far right). The Jaycar version is by far the easier to make. siliconchip.com.au November 2004  31 UPPER HALF ALL DIMENSIONS IN MILLIMETRES 11.5 10 2.5 12 18 24 14.0 JAYCAR POWERBOARD LOWER HALF SIDE VIEW UPPER HALF END VIEW ALL DIMENSIONS IN MILLIMETRES 11.5 12 18 24 10 14.0 KAMBROOK POWERBOARD REMOVE LIP ONLY LOWER HALF SIDE VIEW END VIEW These diagrams should assist you with the USB slot cutouts. At the top are the cutouts for the Jaycar powerboard with the Kambrook powerboard below. It will be necessary to make cutouts for the USB connectors in the lower half of the case. A slot is cut in the end of the case half to clear the Type A output socket, while a square hole is cut in the side for the Type B input socket. I found it fairly easy to cut the slot using jeweller’s files, but it was necessary to drill some holes in the side to ‘start off’ the rectangular hole. The idea is to work slowly and carefully, so you don’t make either cutout any larger than is necessary to clear the two sockets. That’s about it. After fitting the USB switch board into the case and making the two connections, you can reassemble the case again using either the original ‘tamper proof’ screws or some ordinary self-tappers. Kambrook 6-way powerboard The procedure in the Kambrook power board is different because there is no space at the end as in the Jaycar example. To make space, we cut the brass connecting strips between the fifth and sixth 3-pin sockets and discarded them, then removed all of the plastic contact supports for the 3-pin socket. The easiest way to do this is to carefully break out small pieces with a pair of pliers, then smooth the whole lot with a rotary grinder. To be sure, to be sure, we filled the now-vacant 3-pin socket holes with some silicone sealant to make sure nothing could be put into the holes. The other main difference between the Kambrook and Jaycar boards is that we found it much easier to mount the PC board in the base of the Kambrook unit (rather than the top as was used in the Jaycar board). The reason for this is that there is a continuous plastic barrier strip moulded into the base of the Kambrook unit which turned out to be 9mm high – the same height as the mounting spacers we used. So there was no need to cut away any of this barrier – the PC board sits on top of it, held in place by the three Nylon screws, nuts and 9mm spacers. The Nylon screws need 3mm holes. After you’ve drilled the three holes and removed any burrs, push the Nylon screws through from the outside, fit metal spacers, then the PC board. The same square cutouts need to be made to give access to the USB sockets; in the Kambrook power board matching cutouts are needed in the lip on the bottom section. In some ways, the cutouts are easier on the Kambrook case top. We simply cut down the required amount using a hacksaw blade (see diagrams for distances), then bent the waste back and forth with a pair of pliers until it snapped off. One piece snapped off nice and cleanly but Murphy’s law ensured that the other needed cleaning up with a fine file. Because the slots in the base are so shallow, the same fine file can be used to make them. Once the slots are cut and the screw-holes drilled, the board can be installed and wired up. A label is then fitted to the case to block off the slots for the now Here’s the Kambrook powerboard, completed but not yet screwed back together. 32  Silicon Chip siliconchip.com.au unused 3-pin socket. The original ‘tamper proof’ case assembly screws can be re-used again if you wish, or replaced with normal 6G selftapping screws. Using your USB power board Putting your USB power board to work is easy. All that you need to do is connect the USB ‘upstream’ socket (on the side) to one of the USB ports on your PC, using a standard USB connection cable. The power leads of your peripheral devices then plug into the distribution board’s outlets, so their power is controlled by it. Just bear in mind the Finally, the powerboard closed up again, immediately before we fitted the label over the now-unused sixth outlet. You can see the difference between the two types of USB socket in this photo. The label is shown below left, same size. USB-UP USB-Controlled Mains Switch 240 Volts, 700 Watts MAX SILICON CHIP 750W (3A) total loading. If you have USB leads from peripheral devices already plugged into all of the PC’s USB ports, that’s no problem. Simply remove one of them from a USB port socket, and plug the lead from the USB Power Switch into that socket. The lead from the peripheral can now be plugged into the output or ‘downstream’ socket on the Power Switch, so it’s reconnected to the same USB port. And Bob’s your uncle! Your peripherals will now be automatically turned on and off with the computer. SC THE AMATEUR SCIENTIST Two incredible CDs with over 1000 classic projects from the pages of Scientific American, covering every field of science... See the review in the October 2004 issue (read on line at www.siliconchip.com.au) SOL Arguably THE most AMAZING collection of scientific projects ever put together! This is version 2, Science Fair Edition from the pages of Scientific American. As well as specific project material, the CDs contain hints and tips by experienced amateur scientists, details on building science apparatus, a large database of chemicals and so much more. “A must for every science student, science teacher, science lab . . . or simply for those with an enquiring mind . . .” ONLY 49 $ 00 PLUS $7 Pack and Post 1st Shipment:OUTD SO Use the handy order form Exclusive in SILICON 2nd Shipment:OULTD on page 65 of this issue, or SOLD www.siliconchip.com.au call (02) 9979 5644 (bus hrs) Australia to: CHIP OUT 3rd Shipment: 4th Shipment Due This Month. Order now to avoid disappointment! siliconchip.com.au November 2004  33