Silicon ChipDual PICAXE Infrared Data Communication - April 2007 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Banning incandescent lamps will have negligible effect on greenhouse gases
  4. Feature: The Proposed Ban On Incandescent Lamps by Leo Simpson
  5. Review: SPLat CC16 OEM Controller by Peter Smith
  6. Project: High-Power Reversible DC Motor Speed Controller by Leo Simpson & Brank Justic
  7. Project: Build A Jacob's Ladder by Leo Simpson
  8. Project: GPS-Based Frequency Reference; Pt.2 by Jim Rowe
  9. Project: Programmable Ignition System For Cars; Pt.2 by John Clarke
  10. Project: Dual PICAXE Infrared Data Communication by Stan Swan
  11. Vintage Radio: How to build a super crystal set by Rodney Champness
  12. Book Store
  13. Advertising Index
  14. Outer Back Cover

This is only a preview of the April 2007 issue of Silicon Chip.

You can view 36 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 "Build A Jacob's Ladder":
  • Jacob's Ladder PCB pattern (PDF download) [11104071] (Free)
Items relevant to "GPS-Based Frequency Reference; Pt.2":
  • PIC16F628A-I/P programmed for the GPS Frequency Reference [GPSFrqRfv3.HEX or GPSFrqRfv4.HEX] (Programmed Microcontroller, AUD $10.00)
  • PIC16F628A firmware for the GPS-Based Frequency Reference (v3 & v4) (Software, Free)
  • Updated PCB pattern for the GPS-Based Frequency Reference (PDF download) [04103073] (Free)
  • Display PCB pattern for the GPS-Based Frequency Reference (PDF download) [04103072] (Free)
  • GPS-based Frequency Reference front and rear panel artwork (PDF download) (Free)
Articles in this series:
  • GPS-Based Frequency Reference; Pt.1 (March 2007)
  • GPS-Based Frequency Reference; Pt.1 (March 2007)
  • GPS-Based Frequency Reference; Pt.2 (April 2007)
  • GPS-Based Frequency Reference; Pt.2 (April 2007)
  • GPS-Based Frequency Reference: Circuit Modifications (May 2007)
  • GPS-Based Frequency Reference: Circuit Modifications (May 2007)
  • Improving The GPS-Based Frequency Reference (September 2011)
  • Improving The GPS-Based Frequency Reference (September 2011)
Items relevant to "Programmable Ignition System For Cars; Pt.2":
  • Programmable Ignition System main PCB [05104071] (AUD $10.00)
  • Programmable Ignition System Trigger Module PCB [05104072] (AUD $5.00)
  • Programmable Ignition System Hand Controller PCB [05104073] (AUD $10.00)
  • PIC16F88-E/P programmed for the Programmable Ignition System [ignprgm.hex] (Programmed Microcontroller, AUD $15.00)
  • PIC16F88 firmware and source code for the Programmable Ignition System (Software, Free)
  • Sample timing maps for the Programmable Ignition System (Software, Free)
  • Programmable Ignition System PCB patterns (PDF download) [05104071/2/3] (Free)
  • Programmable Ignition System front panel artwork (PDF download) (Free)
Articles in this series:
  • Programmable Ignition System For Cars; Pt.1 (March 2007)
  • Programmable Ignition System For Cars; Pt.1 (March 2007)
  • Programmable Ignition System For Cars; Pt.2 (April 2007)
  • Programmable Ignition System For Cars; Pt.2 (April 2007)
  • Programmable Ignition System For Cars; Pt.3 (May 2007)
  • Programmable Ignition System For Cars; Pt.3 (May 2007)
  • A Knock Detector For The Programmable Ignition (June 2007)
  • A Knock Detector For The Programmable Ignition (June 2007)
Items relevant to "Dual PICAXE Infrared Data Communication":
  • PICAXE-08M software for "Dual Core PICAXE Datacomms" (Free)

Purchase a printed copy of this issue for $10.00.

If Intel can do it with a Pentium. . . so can we with a Picaxe! Dual Core Picaxe Datacomms by Stan Swan What’s this? Twin Picaxes? Is this Stan’s idea of an April Fools Day Joke? Maybe he’s just seeing double . . . Dual Picaxes! The left Picaxe is the “sensor” while the right Picase is the “doer”. Each must be programmed individually. 86  Silicon Chip siliconchip.com.au I n contrast to their ceaseless quest for raw computing speed (typically now 3GHz) computer manufacturers have recently adopted multiple slower CPUs, with two (“duo”) and even four (“quad”) microprocessors under the PC lid. Doubled-up chips such as as Intel’s popular “Core Duo” offer paired microprocessors working at slower speeds (typically 1.5GHz), resulting in lower overall system energy consumption and reduced waste heat. Given the trend towards ever slimmer and lighter computers, these benefits are especially welcomed, since laptop battery life can be greatly enhanced, weight trimmed and noisy cooling fans reduced in size or even dispensed with altogether. Paired computing hardware may be akin to a twin engine aircraft – two smaller engines providing more performance than one larger engine – but the concept has even lead to Microsoft’s imaginative MultiPoint PC mouse software, potentially offering great appeal in developing world education. (Refer => www.microsoft.com/ presspass/features/2006/dec06/1214MultiPoint.mspx) Multiple USB mice may seem like a video game controller octopus but in resource-constrained countries with limited classroom computers, the ability to connect many mice (each with their own coloured screen icon) may allow valuable student collaboration, enhanced learning and simulation. Naturally, programs will need to be specially written to exploit the Multipoint’s potential. INFRARED SENSOR 3 λ 2 (EG, JAYCAR ZD1952) 1 1 siliconchip.com.au +4.5V IO CHANNELS 2 330Ω 22k 3 10k 1 2 7 IC1 3 PICAXE-08M “SENSOR” 6 4 5 (TO PC SERIAL PORT) 0 1 8 LED1 YELLOW + λ – 330Ω 2 3 4.7 µF PIEZO SOUNDER 4 +4.5V CON2 DB9 IO CHANNELS 2 22k 3 IC2 10k 5 1 2 3 PICAXE-08M 7 0 6 1 4 5 2 (TO PC SERIAL PORT) 8 BOTH PICAXE 08M HAVE COMMON SUPPLY & EARTH LED2 RED SERIAL DATA LINE “DOER” 330Ω 3 λ LED K 8 SC 2007 4 4 A 1 dual Picaxe infrared datacomms A Picaxe driving a Picaxe – not too different an approach now being taken by computer manufacturers. Ours is just a bit cheaper but you definitely won’t be able to play “Doom”. V+ 4.7kΩ 330Ω Seeing double already? There’s no reason why us Picaxe “little guys” can’t adopt the same paired approach, especially since the bare 08(M) chips are now so cheap (~$5) and their inbuilt features allow easy interconnection. Most Picaxeaware schools and hobbyists will, by now, have bulk stocks of the Picaxe08M as well, which makes for convenience against ordering specialized ICs. But just why would we want to do such doubling up? Given their modest energy demands (typically only a few tens of milliwatts) it’s obviously not going to help fight global warming! Although having extra system data memory available is appealing (especially for simple data logging), the real Picaxe benefit arises from SENSOR 4.7kΩ CON2 DB9 5 3 INFRARED 2 3 4 3 4 IR SENSOR + 4.7 µF 22kΩ PICAXE08M 4.5V (3x “AA” ALKALINE) * 330Ω IC1 IC2 5 3 2 330Ω 2 1 0 LED 1 22kΩ PICAXE08M LED 2 5 3 2 2 1 0 10kΩ 10kΩ 0V * OR 4.8V (4x NiCd OR NiMH) PIEZO SOUNDER BLUE NUMBERS – PROGRAMMING PINS GREEN NUMBERS – I/O CHANNELS Here’s how to put it together using our standard Picaxe “breadboard” approach (albeit on a protoboard!). This layout is basically identical to the photo at left. April 2007  87 enhancing the sequential nature of their program execution, since limited branching and interruption is normally tolerated. Several Picaxe commands even lead to the controller just sitting and endlessly waiting for a data signal, with most background tasks agonisingly ignored. It’s a bit like neglecting such boring tasks as doing the dishes while awaiting a possible phone call! Serial input (SERIN) in particular leads to a system hang-up if data fails to arrive and is only normally broken out of by resetting the Picaxe. Future Picaxes apparently may have a timeout setting to overcome this limitation. The example shown this month utilises a Picaxe 08M pair, with one working as a slaved “sensor” (for Infrared data – in tribute to Robert Adler, the TV remote co-inventor, who recently passed away => www.nysun.com/ article/48949) and the other a master “doer” (here accepting serial data and concurrently flashing a LED). If you’ve still got supplies of the original 08 then these could be used for the doer but only the 08M can read IR signals. For those who have just come in and are new to Picaxes, the inbuilt infrared (IR) commands of the more recent 08M have near-revolutionised IR datacomms, with both receiving (via a standard 3-leg receiver) and 38kHz sending (via an IR LED) seamless and cheap. But rather than using yet another 08M to generate IR codes, the sensor Picaxe here just accepts signals from any standard Sony-style IR remote. Your household junk cupboard is probably stuffed full of them. If you have several infrared remotes and are not sure if they are still working (perhaps the original equipment they came with has died?) it’s quite easy to check to see if the remote has output by aiming it at a video camera. Most video cameras are sensitive to infrared and the series of pulses will show up as either white or bright green/purple flashes. And how do you tell if it is a Sonytype infrared remote? If it’s not actually from a Sony device (that makes it really easy!) that is significantly more difficult without being able to read the timing of the pulses (eg, on a ’scope). All we can suggest here is to first determine that the infrared is still working, then try it out with the Picaxe circuit. Perhaps you might be able to borrow a known Sony infrared remote to ensure that the Picaxe circuit is working as it is supposed to. By the way, sophisticated universal IR remotes are increasingly turning up PICAXE BASIC LISTINGS – IRDO.BAS AND IRSENSE.BAS ‘IRSENSE.BAS for Picaxe-08M, supporting April 2007 Silicon Chip ‘Uses 2x 08Ms,one sensing & the other a doing Picaxe. ‘See companion program (IRDO) & duo layout ‘=> www.picaxe.orcon.net.nz/duo.jpg ‘Via => stan.swan<at>gmail.com 27th Feb. 2007 irsense: infrain2 if infra >9 then error high 4:pause 100 sound 2,(100,10) serout 4,t2400,(#infra) low 4 goto irsense ‘waits endlessly until IR data received ‘detects non numeric IR remote key push ‘pin set high alerts ‘doer’ 08M data RTS ‘Piezo + parallel LED key press confirm ‘send IR key value as ‘infra’ (a.k.a. b13) ‘handshake pin set low for ‘doer’ Picaxe ‘loop for further IR remote key presses error: sound 2,(60,5,0,5,60,5,0,5,60,5,0,5,60,5,0,5) ‘fruity wrong key alert goto irsense 88  Silicon Chip cheaply in “Dollar Shops”, so check them if your home junk box collection doesn’t feature a Sony type. Incidentally, although numeric keypads are available for around $10, their Picaxe driving is quite involved, so it may even be worth using such an IR remote as a “poor man’s keypad” when entering numbers to a Picaxe program. Naturally the wiring will be reduced and the sophisticated 127 codes of INFRAIN2 may appeal, as will full wireless control. When compared with Bluetooth, ZigBee and WiFi, IR datacomms is very slow and line of sight (LOS) but it offers ranges typically of 5m in sunlight and 20m in darkness and can readily be bounced around and directed by cheap lenses and mirrors. Of course you can still use the remote when watching TV as well! The “sensor” Picaxe is essentially devoted to just reading (via INFRAIN2) modulated IR signals at the 3 terminal receiver – here a Jaycar ZD1952 (~$8) although cheaper generic versions abound. These powerhouse sensors include an inbuilt detector, limiter, 38kHz band pass filter, demodulator, integrator and comparator. Naturally they need to be looking at the IR source for best response. A piezo sounder and (paralleled) yellow LED provides user key-push You can download from www.picaxe.orcon.net.nz/irsense.bas and www.picaxe.orcon.net.nz/irdo.bas ‘IRDO.BAS for Picaxe-08M supporting April 2007 Silicon Chip ‘Uses 2x 08Ms,one sensing & the other a doing Picaxe. ‘See companion program (IRSENSE) & duo layout => ‘www.picaxe.orcon.net.nz/duo.jpg ‘The received IR data values could be used in many ways, ‘perhaps as program variables,or actioned under SEROUT ‘for LCD display etc. Via => stan.swan<at>gmail.com irdo: if pin4=1 then serial high 2:pause 100 low 2:pause 100 goto irdo ‘RTS alert for serin to accept data ‘Sample ongoing activity-LED flashing ‘here but could be any Picaxe action ‘loop until RTS pin 4 detected high serial: serin 4,t2400,#infra b12=infra+1 if b12=10 then zero sertxd (#b12,13,10) goto irdo ‘Accept serial data pin 4 (‘infra’=b13) ‘Align IR remote keys & ‘infra’ values ‘Test for ‘0’ key which shows as ‘10’ ‘Use F8 to display IR remote key pressed zero: b12=0 sertxd (#b12,13,10) goto irdo ‘Ensure ‘10’ key shows as ‘0’ ‘Display on Editor’s F8 terminal program siliconchip.com.au feedback, with key presses other than the numeric 0-9 even sounding a fruity incorrect key warning. The correct serial data is then sent out from pin 4, preceeeded by a short HIGH signal to alert the recipient Picaxe data is about to follow. The “doer” Picaxe here simply flashes a LED as a background task, and continually looks at the status of the serial line (again Pin 4 here) while looping. If this is sensed high (logic 1) as a voltage sent from the “sensor” Picaxe, then the serial receiving routine is branched to and the data (here just the IR remote key number) accepted. Although still not entirely foolproof, as the handshaking Ready To Send (RTS) alert may be a false alarm causing the “doer” to endlessly wait, data should usually follow a RTS OK. The concept is perhaps akin to the phone ringing (thus RTS) as an alert that someone wants to speak with you (data) – it’s rare that a ringing phone will not have a caller on the other end of course! Since the INFRAIN2 values do not align with the actual key label, the Power Supplies number 1 is added to give compatibility. The 0 key label delivers a 10 on most remotes, so this too has a routine to ensure only a 0 is finally shown. Leaving the Picaxe programming lead connected to the “doer”, and running the editor’s inbuilt “F8” terminal program will usefully show these IR key press numbers on screen. Numerous enhancements of course are possible, perhaps using key values as b0-b9 variables in further programs or for LCD readout. The circuitry is again shown assembled on our now standardised three AA battery powered solderless breadboard Picaxe layout, with supply and ground common to each. Note that each Picaxe will have to be individually programmed! The programming lead will need to be swapped to the correct input points and although the order is incidental, ensure the “sensor” Picaxe has IRSENSE.BAS ported to it, with the 2nd 08M “doer” IRDO.BAS. If you look at the protoboard photo on page 86 you’ll see some purple ink around the three programming input pins (these are also shown clearly in Oscilloscopes RF Generators the component layout diagram on P87). There’s no reason why further Picaxes can’t be chained together in the style we’ve shown and serial communicated with to form – gasp - a simple network! Refer => http://www.kranenborg. org/ee/picaxe/twowirenetwork.htm Readers just at the HIGH 1: WAIT 1: LOW 1 stage, who are still exploring Picaxe LED flashing and the like, may find such a concept daunting. It perhaps may be best understood if related to everyday message and voice communications. “Alert. Message for Smith to hand. Message reads “....”etc”. Enthusiasts are encouraged to extend the multiple Picaxe concept, as all manner of control applications, including remote powering, can be performed by simple two-wire (power/signal and ground) links between microcontrollers, that would otherwise need multiple contact switches and numerous wires. Aside from circuit versatility, the present astronomical price of copper (around $10/kg), means it may make real sense to substitute silicon for costly copper in even modest projects. SC Frequency Counters Spectrum Analysers HAMEG Instruments have always been recognised for the consistent quality and nocompromise value of German engineering. And now the news is even better! With more new products, an attractive educational discount scheme and lower prices for 2007 you owe it to yourself to find out more. Call us please on 1-300-853-407 Test Equipment: Sales, Service and Calibration siliconchip.com.au 1-300-853-407 www.triosmartcal.com.au April 2007  89