Silicon ChipSending Picaxe Data Over 477MHz UHF CB - March 2005 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Desalination is a sensible approach for Perth's water supply
  4. Feature: The Revolution In Car Instruments by Julian Edgar
  5. Project: Build A Professional Sports Scoreboard, Pt.1 by Jim Rowe
  6. Feature: The Start Of Colour TV In Australia, Pt.1 by Keith Walters
  7. Project: A Lap Counter For Swimming Pools by Rick Walters
  8. Book Review by Greg Swain
  9. Project: Inductance & Q-Factor Meter; Pt.2 by Leonid Lerner
  10. Project: Shielded Loop Antenna For AM Radios by David Whitby
  11. Project: A Cheap UV EPROM Eraser by Barry Hubble
  12. Feature: Build Yourself A Windmill Generator, Pt.4 by Glenn Littleford
  13. Salvage It: A $10 lathe & drill press tachometer by Julian Edgar
  14. Project: Sending Picaxe Data Over 477MHz UHF CB by Stan Swan
  15. Vintage Radio: The Astor AJS: an economy universal car radio by Rodney Champness
  16. Book Store
  17. Advertising Index
  18. Outer Back Cover

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

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

Articles in this series:
  • Build A Professional Sports Scoreboard, Pt.1 (March 2005)
  • Build A Professional Sports Scoreboard, Pt.1 (March 2005)
  • Build A Professional Sports Scoreboard, Pt.2 (April 2005)
  • Build A Professional Sports Scoreboard, Pt.2 (April 2005)
  • Pro Scoreboard, Pt III (May 2005)
  • Pro Scoreboard, Pt III (May 2005)
Articles in this series:
  • The Start Of Colour TV In Australia, Pt.1 (March 2005)
  • The Start Of Colour TV In Australia, Pt.1 (March 2005)
  • The Start Of Colour TV In Australia, Pt.2 (April 2005)
  • The Start Of Colour TV In Australia, Pt.2 (April 2005)
Items relevant to "A Lap Counter For Swimming Pools":
  • PICAXE-08 BASIC source code for the Pool Lap Counter (Software, Free)
  • Pool Lap Counter PCB pattern (PDF download) [08103051] (Free)
Items relevant to "Inductance & Q-Factor Meter; Pt.2":
  • AT90S2313 firmware and source code for the Inductance & Q-Factor Meter (Software, Free)
  • Inductance & Q-Factor Meter PCB pattern (PDF download) [04102051] (Free)
  • Inductance & Q-Factor Meter front panel artwork (PDF download) (Free)
Articles in this series:
  • Inductance & Q-Factor Meter (February 2005)
  • Inductance & Q-Factor Meter (February 2005)
  • Inductance & Q-Factor Meter; Pt.2 (March 2005)
  • Inductance & Q-Factor Meter; Pt.2 (March 2005)
Articles in this series:
  • Build Yourself A Windmill Generator, Pt.1 (December 2004)
  • Build Yourself A Windmill Generator, Pt.1 (December 2004)
  • Build Yourself A Windmill Generator, Pt.2 (January 2005)
  • Build Yourself A Windmill Generator, Pt.2 (January 2005)
  • Build Yourself A Windmill Generator, Pt.3 (February 2005)
  • Build Yourself A Windmill Generator, Pt.3 (February 2005)
  • Build Yourself A Windmill Generator, Pt.4 (March 2005)
  • Build Yourself A Windmill Generator, Pt.4 (March 2005)
Items relevant to "Sending Picaxe Data Over 477MHz UHF CB":
  • PICAXE-08M BASIC source code for Data Over 477MHz UHF CB (Software, Free)

Purchase a printed copy of this issue for $10.00.

PUTTING THE PICAXE TO WORK . . . PICAXE DATA OVER 477MHz UHF CB We’ve used the PICAXE to do a whole range of things since it first came out. Now let’s do something really useful: send digital data over a UHF CB radio. Yes, it’s legal! by Stan Swan T here’s perhaps no finer recent example of remote communications than the Huygen space probe pictures direct from Saturn’s moon Titan. Even at the speed of light, these ultra-weak digital signals took about half an hour to reach Earth, yet were astoundingly clear! Although such data signalling is naturally associated with the computer age, its basics date back well over a century to Morse code and Baudot teletype. Data communication has had a rich history pre-dating even early electrical technology, with smoke signals, flashing mirrors, semaphore flags, marks in the sand, “1 if by land – 2 if by sea”, green go/red stop lights and so on. But back in the 21st century and terra firma, the cheap, licence-free 40-channel UHF CB sets mentioned last month have two channels (22 & 23) reserved for data transmission. Australian/NZ regulations originally specified this data to have a duty cycle of just 3 seconds per hour, which presumably allowed for diverse services to timeshare the two channels, since three parts in 3600 is a very low 92  Silicon Chip siliconchip.com.au ratio indeed. It was probably envisaged that much data would be simplex (one way) as occasional telemetry (measurement at a distance), indicating reservoir levels or telecommand (remote control) irrigation information, open farm gates, etc where changes over an hour would not be too dramatic. However, in light of recent traumatic tsunami sea water level changes this looks far too conservative – in the real world many things may change horrifyingly fast, with the lack of such localised digital-age warning devices in stark contrast to Titan monitoring over a billion kilometres away. Incidentally, www.manuka.orcon. net.nz/cbdata.htm links to data references and ACA UHF CB regulations. Which data protocol? The type of UHF CB data allowed is not specified. So as well as classic RS232 serial techniques (to be covered later), various DIY schemes and local protocols could be organised. Encoding and decoding, often readily addressed now by software, may lead to technical or practical limitations. Communication issues that contend with weak signals, slow speeds, error correction, interference and limited bandwidth arise as well. Hence it may be tempting to send classic human readable Morse code but that’s now officially an obsolete signalling technique and few people can understand it without considerable training. (Please, no correspondence from irate brass pounders!) Consequently, given their ease of generating serial data and assorted audio tones, it’s no contest to use a Picaxe microcontroller approach. For this initial UHF CB data treatment, a 3-lead (Maxim) Dallas Semiconductor DS18B20 temperaturemeasuring device is simply read at regular intervals by a Picaxe 08M using its inbuilt ‘readtemp’ command. The DS18B20 can read temperatures accurate to 0.5°C between -10° and 85° but can handle -55° to +125° with reduced accuracy. This Celsius value is then converted to a simple audio tone sequence relating to temperature, under a scheme where longer tones mean “tens” and shorter tones “units”. With only a brief explanation even a child could decode the temperature, as of course can any listening audience with a UHF CB receiver – no computer siliconchip.com.au IO PINS (CHANNELS) (TO PC CON2 DB9 SERIAL PORT) CHANNEL 0: PROG OR OUT CHANNEL 3: IN ONLY 2 4.7kΩ 22k 3 10k 5 1 2 3 IC1 PICAXE-08M 4 LEDS 7 0 6 1 5 2 8 3 K A 4 DS18B20 V+ 8 +4.5V (3xAA) 4 1 +V GND DATA SC 2005 PIEZO 100nF WHITE LED λ DATA DS18B20 λ LDR TO UHF CB TRANSCEIVER MIC SOCKET* 1kΩ GND (* JAYCAR DC-1030 USES 3.5mm STEREO PLUG TIP AND BASE) UHF CB DATA MODULATION While this circuit uses the 08M (as distinct from the earlier 08) connections are pin-for-pin compatible and the vast majority of functions are identical. It’s just that the 08M has more grunt in certain areas! The white LED and LDR provide an isolated means of “keying” the transmitter (ie, turning it on). or software necessary to monitor that heatwave! The temperature is preceded by pleasant attention-getting audible sliding tones (based upon a cat’s greeting in fact!), then long and short tones to suit, similar to radio time signals or PC boot error beeps. As an example, 23°C would sound as long, long, short, short, short with a tropical 31°C long, long, long, short and a cool 4°C as just short, short, short, short. Negative temperatures have a higher “frosty” tone, with zero a drawn out “l-o-n-g”. Your local conditions will readily attune your ear to a sequence (you 3.5mm STEREO PLUG TO UHF CB TRANSCEIVER PLUG BODY won’t be having many subzero values in Darwin!). Calibration, against a known temperature standard, can be made by placing the unit in the fridge, freezer or (for elevated values) a car parked in the hot sun. Extending the leads on the DS18B20 is quite feasible but avoid direct contact of exposed terminals with water, of course – cover them with neutral silicone sealant or heatshrink tubing perhaps if monitoring your home beer fridge, via UHF CB, when at work some kilometres away! Given the range of these CB sets with an external antenna (as detailed PLUG TIP PIEZO 0V 100nF 4.5V PICAXE08M 10kΩ D A 22kΩ 5 3 2 (RS232) 10kΩ 4 3 2 1 0 LDR LED +V DS18B20 K GND D 4.7kΩ +V This layout on proto-breadboard should look pretty familiar to anyone who has been following our PICAXE series (it first started back in 2003!). It’s not exactly the same as the photo opposite – follow this one if there is any confusion. March 2005  93 February 2005 SILICON CHIP), of course the opposite application may appeal – did your public building air conditioning/heating get turned on well before the attendants arrived? Connecting to the CB The Jaycar DC-1030 UHF CB set shown here comes fitted with a single 3.5mm stereo socket. This does multiple duty – internal battery charging as well as external microphone and earphones. Experimentation revealed that external audio could be fed in via the tip end and body of a matching 3.5mm stereo plug but that the transmitter would only be keyed on if a resistance, in parallel across this input, fell below around 1kW. Such a solid state transceiver switching technique is rather in contrast to historic “ker-chunk” relay or big switch action but apparently is becoming the norm on hand-held 2-way radios. The budget Dick Smith D-1793 models, however, use a smaller 2.5mm socket and may need VOX transmitter switching instead. Opto-coupled transmission A neat Picaxe way to provide this resistance is to illuminate, at the right time, a light-dependent resistor, or LDR, with a nearby white LED. A typical LDR has a “dark” resistance of some (sometimes many) megohms, dropping to the low hundreds of Ohms in bright light or sunshine. 94  Silicon Chip An offcut of dark plastic sleeving allows the opto-coupled pair to switch the transmitter when a high signal comes from output 2. A series 1kW resistor dims the LED sufficiently to reduce battery drain while still ensuring reliable switching and the optical isolation helps keep possibly confusing RF from the sensitive Picaxe circuitry. To avoid overdriving the transmitter, audio from the Picaxe output 0 is passed via a series capacitor – 100nF (0.1mF) was found suitable. A local piezo sounder attached to this channel allows the outgoing sounds to be also conveniently heard, and of course the glowing of the white LED indicates that the transmitter is being keyed on. Powering-down the sensor The DS18B20 sensor can normally draw several milliamps, even when not being read. If an extended “sleep” is underway, with attendant microamp level power drain on the Picaxe itself, it’s wasteful to “keep its motor running” by supplying such an extra component. As the 08M has a spare output channel, a technique suggested on the Picaxe forum (www.picaxe.com) is used to greatly reduce current drain. The DS18B20 is itself controlled by Picaxe output 4 which only switches it on just before it needs to be read. No significant sensor warm up time was noted, although a brief settling period was provided in the code. Abundant code space is still available on the 08M and extension for interrupts (to flag an unexpected value), or data logging is feasible. Even a store and forward scheme could be used, so that a whole package of values could be sent at a predetermined interval – akin to checking your mailbox perhaps? Construction It’s recommended once again you make up this circuit on solderless prototyping breadboard, as we’ve used in earlier Picaxe articles. If you’ve made up any previous Picaxe projects on breadboards, wiring this one should be a cinch. Note in the photo we have stuck a tiny label around the DS18B20, to avoid confusion with deceptively look-alike BC547 transistors! We’ll be using almost exactly the same layout for an extended UHF CB data approach employing faster machine readable encoding. Naturally more specialised machine decoding will then be needed too – as Morse diehards will testify, human readable data may be slower but it does have some practical benefits! Footnote: Although a well established and highly respected IC, manufacturing problems lead to DS18B20 supplies being globally very erratic in mid 2004. Hopefully this has now sorted itself out, to ensure reliable supplies for this circuit. siliconchip.com.au UHFCBDS listing (also available for download: www.picaxe.orcon.net.nz/uhfcbds.bas) ‘=> uhfcbds.bas <= 477MHz licence free UHF CB & DS18B20 combo- Ver 1.0 Boxing Day 2004 ‘For Silicon Chip Picaxe article (March 2005) via Stan. Swan => s.t.swan<at>massey.ac.nz ‘UHF CB sends audible Ch.22/23 temperature data via Dallas Semi.DS18B20 & Picaxe-08M ‘interfaced (as human readable audio tones) to a Jaycar DC1030 UHF CB 1/2W transceiver. ‘NOTE: ACA/RFS regs.say “UHF CB data Ch.22/23 max. duty cycle just 3 seconds an hour”... ‘Temp range tested from subzero freezer (~-4C) to high 30s C, but OK even higher ~55 C? ‘DS18B20 draws ~9mA,so Ch.4 used to just switch on as needed & thus enhance battery life ‘Many audible ways to pass data of course,but our simple approach suits kids & oldies! ‘Morse involves *#%<at>^! training,while technique here just involves listening & counting ‘Considerable enhancement scope as 08M memory barely half used! Store & forward EEPROM? ‘See David Lincoln’s Vol.2 ‘Expts in Mechatronics’ P.18-25 for number massaging insights ‘Refer circuit layout => www.picaxe.orcon.net.nz/uhfcbds.jpg & program .../uhfcbds.bas ‘ -------------------------------------------------------------------------------------‘b0 = direct Celsius temp value read from 3 lead DS18B20 temperature IC ‘b1 = 10s values (heard as longer pulses ) obtained by integer division ‘b2 = units value (shorter beeps up to 9 in value) by isolating remainder ‘b3 = loop multiplier for 10s- thus 20 C will have 2 longer beeps ‘b4 = loop multipier for units- so 17 C will have 1 long & 7 short beeps ‘b5 = -ve temps subzero correcting factor ‘b6 = -ve temps subzero loop multiplier to give “urgent” beeps ‘--------------------------------------------------------------------------------------tempds: wait 2 ‘transmitter “tail” hold on to avoid click confusion with beeps low 2:low 4 ‘ensure ch.2 LED & ch.4 supply (to DS18B20) are both off sleep 2 ‘master delay -alter to suit (units 2.3 sec)for other intervals high 2: high 4 ‘turn on LED/LDR combo & also DS18B20 wait 1 ‘transmitter & DS18B20 settling time before reading sound 0,(95,3,0,3,100,3,0,3,105,3,0,3,110,3) ‘ warble alert pre data arrival wait 1 ‘1 sec pause to allow listener attention for data readtemp 1,b0 if b0=0 then zero if b0>128 then subzero We have the best value, brightest LEDs available in Australia! Check these out: Luxeon 1, 3 and 5 watt All colours available, with or without attached optics, as low as $10 each Low-cost 1 watt Like the Luxeons, but much lower cost. •Red, amber, green, blue and white: Just $6 each! Lumileds Superflux These are 7.6mm square and can be driven at up to 50mA continuously. •Red and amber: $2 each •Blue, green and cyan: $3 each Asian Superflux Same as above, but much lower cost. •Red and amber: Just 50 cents each! •Blue, green, aqua and white: $1 each. Go to www.ata.org.au or call us on (03)9419 2440. ‘Picaxe 08M (or perhaps 18X) command to read ch.1 DS18B20 ‘test if DS18B20 at zero Celsius (water freezing point) ‘test for DS18B20 sensor subzero correction as b0 values >128 b1= b0/10 ‘divide original b0 temp to get 10s value b2= b0//10 ‘divide original b0 temp so remainder yields units value if b0<10 then units ‘bypass tens sounds if temps below 10 Celsius ‘debug ‘suitable spot to note b0 etc variable values when fine tuning? ‘--------------------------------------------------------------------------------------tens: for b3=1 to b1 sound 0,(100,50,0,50) ‘ longer beeps for 10s. Thus 20 Celsius = 2 long beeps next b3 ‘--------------------------------------------------------------------------------------units: if b2=0 then tempds ‘units nulling factor if temps are exact multiples of 10C for b4=1 to b2 sound 0,(100,5,0,50) ‘shorter beeps for units, so 9 C = 9 short beeps next b4 goto tempds ‘read sensor again ‘--------------------------------------------------------------------------------------zero: sound 0,(100,500) ‘prolonged tone to indicate zero Celsius goto tempds ‘read sensor again ‘--------------------------------------------------------------------------------------subzero: b5=b0-128 ‘correcting factor for DS18B20 when reading subzero for b6=1 to b5 sound 0,(120,5,0,50) ‘more alarming ‘frosty’ beeps,since now below freezing ! next b6 goto tempds ‘read sensor again siliconchip.com.au Want cheap, really bright LEDs? SC March 2005  95