Silicon Chip8-Channel PC Relay Board - September 2000 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Electrical licence to build a kit is ridiculous
  4. Feature: How They're Bringing You The Games by Ross Tester
  5. Project: Build A Swimming Pool Alarm by John Clarke
  6. Feature: Network Troubleshooting With Fluke's NetTool by Greg Swain
  7. Product Showcase
  8. Project: 8-Channel PC Relay Board by Ross Tester
  9. Product Showcase
  10. Order Form
  11. Project: Fuel Mixture Display For Cars, Pt.1 by John Clarke
  12. Feature: LA-CRO - A Must-Have For Students by Peter Radcliffe
  13. Project: Protoboards: The Easy Way Into Electronics, Pt.1 by Leo Simpson
  14. Project: Cybug - The Solar Fly by Ross Tester
  15. Vintage Radio: HMV's Nippergram: a classic 1950s portable radiogram by Rodney Champness
  16. Notes & Errata: PC Controlled VHF FM Receiver / 40V/1A Adjustable Power Supply / Loudspeaker Protector & Fan Controller
  17. Book Store
  18. Market Centre
  19. Outer Back Cover

This is only a preview of the September 2000 issue of Silicon Chip.

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

Items relevant to "Build A Swimming Pool Alarm":
  • Swimming Pool Alarm PCB pattern (PDF download) [03109001] (Free)
  • Swimming Pool Alarm panel artwork (PDF download) (Free)
Items relevant to "8-Channel PC Relay Board":
  • QBASIC source code for the LPT 8-Channel Relay Board (Software, Free)
Items relevant to "Fuel Mixture Display For Cars, Pt.1":
  • PIC16F84(A)-04/P programmed for the Fuel Mixture Display [AIRFUEL.HEX] (Programmed Microcontroller, AUD $10.00)
  • PIC16F84 firmware and source code for the Fuel Mixture Display [AIRFUEL.HEX] (Software, Free)
  • Fuel Mixture Display PCB patterns (PDF download) [05109001/2] (Free)
  • Fuel Mixture Display panel artwork (PDF download) (Free)
Articles in this series:
  • Fuel Mixture Display For Cars, Pt.1 (September 2000)
  • Fuel Mixture Display For Cars, Pt.1 (September 2000)
  • Fuel Mixture Display For Cars, Pt.2 (October 2000)
  • Fuel Mixture Display For Cars, Pt.2 (October 2000)
Articles in this series:
  • Protoboards: The Easy Way Into Electronics, Pt.1 (September 2000)
  • Protoboards: The Easy Way Into Electronics, Pt.1 (September 2000)
  • Protoboards: The Easy Way Into Electronics, Pt.2 (October 2000)
  • Protoboards: The Easy Way Into Electronics, Pt.2 (October 2000)
  • Protoboards: The Easy Way Into Electronics, Pt.3 (November 2000)
  • Protoboards: The Easy Way Into Electronics, Pt.3 (November 2000)
  • Protoboards: The Easy Way Into Electronics, Pt.4 (December 2000)
  • Protoboards: The Easy Way Into Electronics, Pt.4 (December 2000)

Purchase a printed copy of this issue for $10.00.

Control devices via your PC parallel port with this Eight-Channel Relay Board by Ross Tester H ave you ever wanted to turn something on or off with a command from your com- puter? Here’s a simple project that does just that – in fact, it will control up to eight external devices via your computer’s parallel port. Most of us have at some stage thought “wouldn’t it be nice if I could get the computer to do X” (fill in your own “X”!) but then have done nothing more because, well, how do you interface a computer with the real world? It’s surprisingly easy! As you would no doubt realise, your computer already “talks” to external devices via its parallel port (more than likely a printer; perhaps a scanner or some other peripheral). It’s that same parallel port which you can use to control external “things”. It’s especially easy if those things only need to be turned on and off. You’ve probably seen parallel port interfaces in the past which have used perhaps half a dozen chips and scads of other components. This one uses a tad less – zero ICs and less than ten other components per “channel”. Normally, to talk to a printer the computer sends various pins in its parallel port high or low at breakneck speed. The various combinations of highs and lows are interpreted by the printer to place ink at a certain position on the page. In this simple interface, we also send various pins high or low – in fact, eight pins (D0-D7). But there’s no combination of pins to worry about. If any of those pins go high, a relay associated with it closes. If the pin is low, the relay opens. With eight output pins, we can control up to eight relays. All control circuits are the same, so our circuit The project is capable of switching eight different devices, with the two larger relays (right end of PC board) being mains rated. The cable underneath which connects to your PC’s parallel port must be a “straight through” D-25 male to D-25 female type, not a crossover cable often used with 25-pin serial ports. 32  Silicon Chip diagram (Fig.1) shows only one (there are seven more just the same on the PC board). When the output pin in the parallel port is sent high by the software, it lights a LED inside an opto-isolator. (The opto-isolator is used to ensure complete isolation between the circuit and your computer). A phototransistor inside the opto-isolator is then turned on, providing bias to another (external) transistor. When this transistor turns on, it energises the relay in its collector circuit. The relay pulls in, switching its contacts over. The relay is a double pole, double throw type (DPDT) so your options for controlling external devices are many. Across the relay coil is a diode, which prevents large induced voltage spikes (from the collapsing relay coil magnetic field) damaging or destroying Q1. There is also a LED/resistor combination which gives a visual indication that the relay is energised. And that’s all there is to the control circuit. There are seven more identical circuits packed onto the PC board with the relay outputs all connected to onboard terminal blocks located around the edge of the board. Actually, they’re not quite identical. Two of the relays (D and E) are mains-rated so can be used to switch 240VAC – if you know what you’re doing, of course. The tracks on the PC board under these relays are also significantly wider, with wider spacings to provide mains isolation. But please, if you’re going to switch mains voltages be very, very careful. For convenience, a 12V regulated supply on board is included, consisting of a bridge rectifier, an electrolytic capacitor and a 12V positive regulator. This supply will operate from about 12-18V AC or 14-18V DC. DC polarity doesn’t matter – the bridge rectifier automatically takes care of that. Construction First check your PC board for any obvious defects. This is rare these days but occasionally there are boards which have tracks missing due to Fig.1: the circuit consists of eight nearidentical sections plus a regulated 12V supply to drive them all. SEPTEMBER 2000  33 Use the PC board pattern (fig.3, above) to check your board etching before starting construction, using the component overlay (fig.2, left). Note that all resistors are mounted “end on” to save space. over-etching, or tracks joined due to under-etching. First components to mount are the resistors. All stand “on end” – and your PC board looks a lot better if all in a group are aligned the same way. Next solder in the eight relay spike suppression diodes, noting which way around they go. The same comment applies to the transistors and LEDs. Solder in the power supply components (again, all polarised) making sure the 3-terminal regulator is soldered far enough off the PC board to allow its U-shaped heatsink to be attached. All of the relays are the next components to mount. Note that the two larger relays, “D” and “E” are placed at one end of the board, while all the rest mount along the edges. Finally (at least as far as the top of the board is concerned) mount the terminal blocks and the 25-pin “D” connector. The D-25 connector has very close pin spacing, so take care that you don’t bridge between its solder pads. The eight opto-isolators mount on the solder side the PC board, not far from the D-25 connector. These look like a small, 4-pin IC with pin 1 marked with a dot. Holding the board solder-side up with the D-25 connector on the left, pin 1 of each opto-isolator is at the top left . Again, pin spacing is pretty tight, so be careful when soldering. That completes the construction side. Give your board a double-check against the component overlay (Fig.2) 34  Silicon Chip and make sure you don’t have any solder dags, bridges or dry joints. The software To drive the relay board, software is required for your PC. This tells the parallel port which pin(s) to take high or low to get the desired result. Incidentally, the software will work with any PC – even that pensioned-off XT clunker! We present the software in two forms. First is an “.exe” or executable file which can simply be run from DOS or a DOS box under Windows. It simply places a graphic representation on screen which shows which outputs are high and low. When you press any of the appropriate keys (A to H) on the keyboard, the corresponding parallel port output pin toggles high or low. This is all very well as a demonstration and to prove your relay board works properly but it is not entirely practical nor useful. What we need is software which can be incorporated into other programs so the ports can be commanded high or low by events, times, actions or other factors. For this reason, we have also shown the Q-BASIC listing from that .exe file. This can be used as is, or sections of it can be added to existing or new software which actually does something useful! Each of the sections of the program are clearly identified so you can use as much or as little as The complete project is mounted inside a plastic case for safety. The red terminal block, connected to relays E and D, can handle mains – if you are doing so, be careful! Supplied PC boards will be silkscreened to make component placement even easier. you want. Alternatively, experienced readers may wish to write their own code to accomplish their specific tasks. DOS box under Windows. Fig.3 shows the screen you should see. When you press any of the keys A through H, the corresponding LED should light and you may hear the relay click over. Touch the same key again and the LED should go out and the relay also drop out. Check each relay/LED one-by-one, on and off, to ensure they’re all working properly. If the LED works but you cannot hear the relay pull in, check with a multimeter across the relay output: the relay may be working fine but it is too soft to hear. Conversely, if the relay works but the LED doesn’t, it’s usually a sure sign that you have mounted the LED back-to-front. If neither work, check the voltage between ground and the exposed end of the appropriate 1kΩ resistor near the D-25 socket. You should get about 1.5V or so with the port high and somewhat less with the port low. If this is OK, check the voltage at the base of its switching transistor. It should switch between (almost) the full supply voltage (say about 11V) and close to zero volts, depending on Checking it out As we said, the executable file is ideal for checking that the relay driver board works as intended. Connect your relay driver board into the parallel port of your PC via a suitable 25-pin male to 25-pin female lead. Note the cable must be wired "straight through” – some cables have crossovers, designed to connect two serial ports together. These are not suitable. In fact, it may be that you don’t even need a cable – the D-25 plug on the PC board could plug directly into the parallel port on some computers, assuming there is room. (In our case we did this but had to remove the D-25 plug nuts as they stopped the plug going right in). Apply power to the board via the two-way terminal block situated right in the middle of the board. Unless you’ve made any mistakes, nothing at all should happen! Now run Rly.exe from DOS or a Fig.3: the screen from the relay.exe software which “drives” the relay interface board. Here keys A, D and G have been pressed to toggle their corresponding I/O ports high. This causes the corresponding relays on the interface board to pull in. Pressing the same letters again will toggle them off again. SEPTEMBER 2000  35 QBASIC LISTING – RLY.BAS (This file and relay.exe are also downloadable from www.siliconchip.com.au) SCREEN 12, 5 a=1 b=1 c=1 d=1 e=1 f=1 g=1 h=1 CLS ppx = 1 OUT &H378 + 0, 0’clear port OUT &H278 + 0, 0’clear port ’*************************************** ’ SCREEN BORDER AND LEGEND LINE (10, 10)-(630, 10) LINE (13, 13)-(627, 13) LINE (630, 470)-(630, 10) LINE (627, 410)-(627, 13) LINE (627, 410)-(13, 410) LINE (627, 413)-(13, 413) LINE (630, 470)-(10, 470) LINE (10, 470)-(10, 10) LINE (13, 410)-(13, 13) LINE (627, 467)-(13, 467) LINE (627, 467)-(627, 413) LINE (13, 467)-(13, 413) ’*************************************** ’ OATLEY LOGO COLOR 9 LOCATE 3, 22: PRINT “ OATLEY ELECTRONICS” LOCATE 25, 24: PRINT “C copyright Oatley Electronics” CIRCLE (187, 390), 10, 1 COLOR 15 LINE (190, 50)-(404, 50), 4 LINE (210, 30)-(210, 70), 4 LINE (195, 35)-(225, 65), 4 LINE (225, 35)-(195, 65), 4 LINE (215, 38)-(205, 62), 4 LINE (205, 38)-(215, 62), 4 LINE (198, 55)-(222, 45), 4 LINE (198, 45)-(222, 55), 4 CIRCLE (210, 50), 7, 3 PAINT (210, 50), 4, 3 CIRCLE (210, 50), 7, 4 ’**************************************** ’ SCREEN TEXT SETUP CIRCLE (35, 260), 7, 15 PAINT (35, 260), 4, 15 CIRCLE (35, 280), 7, 15 PAINT (35, 280), 2, 15 LOCATE 18, 8: PRINT “LO” LOCATE 17, 8: PRINT “HI” LOCATE 6, 31: PRINT “ PC PARALLEL PORT “ LOCATE 7, 31: PRINT “ RELAY INTERFACE “ LOCATE 12, 5: PRINT “RELAY A B C D E F G H “ LOCATE 10, 5: PRINT “I/O No.” LOCATE 10, 16: PRINT “D 0 D 1 D 2 D 3 D 4 D 5 D 6 D 7 “ LOCATE 9, 5: PRINT “PIN No.” LOCATE 9, 17: PRINT “2 3 4 5 6 7 8 9 “ LOCATE 14, 5: PRINT “STATUS” LOCATE 28, 27: PRINT “www.oatleyelectronics.com” ’**************************************** ’ TABLE GRAPHIC LINE (25, 120)-(611, 120), 15 LINE (25, 166)-(611, 166), 15 LINE (25, 200)-(611, 200), 15 LINE (25, 230)-(611, 230), 15 LINE (99, 120)-(99, 230), 15 36  Silicon Chip LINE (25, 120)-(25, 230), 15 LINE (163, 120)-(163, 230), 15 LINE (227, 120)-(227, 230), 15 LINE (291, 120)-(291, 230), 15 LINE (355, 120)-(355, 230), 15 LINE (419, 120)-(419, 230), 15 LINE (483, 120)-(483, 230), 15 LINE (547, 120)-(547, 230), 15 LINE (611, 120)-(611, 230), 15 PAINT (160, 210), 2, 15 PAINT (224, 210), 2, 15 PAINT (288, 210), 2, 15 PAINT (352, 210), 2, 15 PAINT (416, 210), 2, 15 PAINT (480, 210), 2, 15 PAINT (544, 210), 2, 15 PAINT (608, 210), 2, 15 ’**************************************** ’ INPUT ppp: LINE (385, 275)-(405, 275) ‘input underscore LOCATE 17, 23: INPUT “Enter LPT Number, 1 or 2 “; b$ IF b$ = “1” THEN LOCATE 19, 29: PRINT “Current output to LPT1” IF b$ = “1” THEN ppx = &H378 IF b$ = “2” THEN LOCATE 19, 29: PRINT “Current output to LPT2” IF b$ = “2” THEN ppx = &H278 LOCATE 17, 50: PRINT “ “ IF b$ > “2” THEN GOTO ppp io: COLOR 15 LINE (385, 275)-(405, 275) ‘input underscore LOCATE 17, 31: PRINT “ “ LOCATE 21, 32: PRINT “Type ‘x’ to exit”; LOCATE 22, 25: PRINT “All pins are set to L O on exit” LOCATE 17, 22: INPUT “ Enter relay letter”; a$ ’**************************************** ’ ERROR CONTROL AND INPUT SELECT ’IF a$ = “A” THEN GOTO aset1 IF a$ = “B” THEN GOTO bset1 IF a$ = “C” THEN GOTO cset1 IF a$ = “D” THEN GOTO dset1 IF a$ = “E” THEN GOTO eset1 IF a$ = “F” THEN GOTO fset1 IF a$ = “G” THEN GOTO gset1 IF a$ = “H” THEN GOTO hset1 IF a$ = “X” THEN CLS IF a$ = “X” THEN OUT ppx + 0, 0 ‘clear port IF a$ = “X” THEN END IF a$ = “a” THEN GOTO aset1 IF a$ = “b” THEN GOTO bset1 IF a$ = “c” THEN GOTO cset1 IF a$ = “d” THEN GOTO dset1 IF a$ = “e” THEN GOTO eset1 IF a$ = “f” THEN GOTO fset1 IF a$ = “g” THEN GOTO gset1 IF a$ = “h” THEN GOTO hset1 IF a$ = “x” THEN CLS IF a$ = “x” THEN OUT ppx + 0, 0 ‘clear port IF a$ = “x” THEN END SOUND 150, 5 GOTO io aset1: IF a = 2 THEN GOTO aset2 suma = 1 a=2 PAINT (160, 210), 4, 15 GOTO sumall aset2: suma = 0 a=1 PAINT (160, 210), 2, 15 GOTO sumall bset1: IF b = 2 THEN GOTO bset2 sumb = 2 b=2 PAINT (224, 210), 4, 15 GOTO sumall bset2: sumb = 0 b=1 PAINT (224, 210), 2, 15 GOTO sumall cset1: IF c = 2 THEN GOTO cset2 sumc = 4 c=2 PAINT (288, 210), 4, 15 GOTO sumall cset2: sumc = 0 c=1 PAINT (288, 210), 2, 15 GOTO sumall dset1: IF d = 2 THEN GOTO dset2 sumd = 8 d=2 PAINT (352, 210), 4, 15 GOTO sumall dset2: sumd = 0 d=1 PAINT (352, 210), 2, 15 GOTO sumall eset1: IF e = 2 THEN GOTO eset2 sume = 16 e=2 PAINT (416, 210), 4, 15 GOTO sumall eset2: sume = 0 e=1 PAINT (416, 210), 2, 15 GOTO sumall fset1: IF f = 2 THEN GOTO fset2 sumf = 32 f=2 PAINT (480, 210), 4, 15 GOTO sumall fset2: sumf = 0 f=1 PAINT (480, 210), 2, 15 GOTO sumall gset1: IF g = 2 THEN GOTO gset2 sumg = 64 g=2 PAINT (544, 210), 4, 15 GOTO sumall gset2: sumg = 0 g=1 PAINT (544, 210), 2, 15 GOTO sumall hset1: IF h = 2 THEN GOTO hset2 SUMH = 128 h=2 PAINT (608, 210), 4, 15 GOTO sumall hset2: SUMH = 0 h=1 PAINT (608, 210), 2, 15 GOTO sumall sumall: SOUND 600, 2 OUT ppx + 0, suma + sumb + sumc + sumd + sume + sumf + sumg + SUMh GOTO io Parts List 1  PC board, 81 x 117mm, (Oatley Electronics) 6  DPDT mini relays, PC mounting, 12V coil 2  SPDT mains-rated relays, PC mounting, 12V coil 1  D-25 male connector, PC mounting 12 3-way screw terminal blocks, PC mounting 2  3-way screw terminal blocks, PC mounting, different colour 1  2-way screw terminal block, PC mounting 1  D-25 male to D-25 female extension lead, straight through connections, suitable length 1  U-shaped heatsink to suit regulator 1  suitable insulated mounting box or plate (see text) Semiconductors 8  PC814 Opto Couplers 8  C8050 NPN transistors 8  1N4004 silicon diodes 8  5mm LEDs, colours as desired 1  W04 bridge rectifier 1  7812 12V positive regulator Capacitors 1  100µF 35VW PC-mounting electrolytic Resistors (0.25W, 5%) 8  100kΩ 16 2.2kΩ 8 1kΩ whether the parallel port is high or low. The voltage at the collector of the transistor should be the inverse – when the base is high, it should be close to zero (anything less than 1V or so is OK); when the base is low, it should be close to the full supply voltage Safety first! No particular case has been specified for this project; indeed the photo-graphs show the PC board mounted just on the plastic lid of a disposals case, without the case! (It also came from Oatley Electronics, by the way). Regardless of whether or not you plan to switch mains voltages with this project, it should be mounted in a fully insulated (ie plastic/ABS) case because it CAN switch mains voltages. It is essential that the PC board tracks not be exposed because it would be so easy to pick the PC board up and make contact with these tracks – and the tracks under the mains-rated relays could be bitey! SC Where do you get it? This project design and the PC board are copyright (C) Oatley Electronics Pty Ltd. They have available a kit of parts which includes the PC board and all on-board components for $40.00. The cable sells for $8.00. Freight is extra – $6.60 Contact Oatley Electronics at PO Box 89 Oatley, NSW 2223, Phone (02)9584 3563, Fax (02) 9584 3561, email sales<at>oatleyelectronics.com.au, website www.oatleyelectronics.com.au SEPTEMBER 2000  37