Silicon ChipBike Computer To Digital Ammeter Conversion - February 2007 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Let's not vacillate on nuclear power
  4. Feature: Viganella: Solar Power With A Twist by Ross Tester
  5. Feature: New “Naked” WiFi Distance Record by Ermanno Pietrosemoli
  6. Project: Remote Volume Control & Preamplifier Module; Pt.1 by Peter Smith
  7. Project: Simple Variable Boost Control For Turbo Cars by Denis Cobley
  8. Project: Fuel Cut Defeater For The Boost Control by Denis Cobley
  9. Review: Teac GF350 Turntable/CD Burner by Barrie Smith
  10. Review: Jaycar Gets Into Wireless Microphones by Ross Tester
  11. Feature: Mater Maria College Scoops Technology Prize Pool by Silicon Chip
  12. Project: Low-Cost 50MHz Frequency Meter; Mk.2 by John Clarke
  13. Project: Bike Computer To Digital Ammeter Conversion by Stan Swan
  14. Vintage Radio: The quirky Breville 801 personal portable by Rodney Champness
  15. Book Store
  16. Advertising Index
  17. Outer Back Cover

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

You can view 37 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 "Remote Volume Control & Preamplifier Module; Pt.1":
  • ATmega8515 programmed for the Remote Volume Control & Preamplifier Module [DAVOL.HEX] (Programmed Microcontroller, AUD $15.00)
  • ATmega8515 firmware and source code for the Remote Volume Control and Preamplifier (Software, Free)
  • Main PCB pattern for the Remote Volume Control and Preamp (PDF download) [01102071] (Free)
  • Display PCB pattern for the Remote Volume Control and Preamp (PDF download) [01102072] (Free)
  • Power supply PCB patterns for the Remote Volume Control and Preamp (PDF download) [01102073/4] (Free)
Articles in this series:
  • Remote Volume Control & Preamplifier Module; Pt.1 (February 2007)
  • Remote Volume Control & Preamplifier Module; Pt.1 (February 2007)
  • Remote Volume Control & Preamplifier Module; Pt.2 (March 2007)
  • Remote Volume Control & Preamplifier Module; Pt.2 (March 2007)
Items relevant to "Simple Variable Boost Control For Turbo Cars":
  • Variable Boost Controller PCB [05102072] (AUD $5.00)
  • PCB pattern for the Variable Boost Control (PDF download) [05102072] (Free)
Items relevant to "Fuel Cut Defeater For The Boost Control":
  • Fuel Cut Defeater PCB [05102071] (AUD $5.00)
  • PCB pattern for the Fuel Cut Defeater (PDF download) [05102071] (Free)
Items relevant to "Low-Cost 50MHz Frequency Meter; Mk.2":
  • PIC16F628A-I/P programmed for the Low-Cost 50MHz Frequency Meter, Mk.2 [freqenc2.hex] (Programmed Microcontroller, AUD $10.00)
  • PIC16F628A firmware for the Low-Cost 50MHz Frequency Meter, Mk.2 [freqenc2.hex] (Software, Free)
  • PCB patterns for the Low-Cost 50MHz Frequency Meter, Mk.2 (PDF download) [04110031/2/3] (Free)
  • Low-Cost 50MHz Frequency Meter, Mk.2 panel artwork (PDF download) (Free)

Purchase a printed copy of this issue for $10.00.

Off Ya Bike & Onto Ya... PICAXE! More words of wisdom from STAN SWAN Electronics is just as much about adaptation as it is invention. Here Stan takes a cheap bike computer and turns it into a digital amphour meter with the aid of his No.1 favourite chip, the mighty Picaxe! T he white-hot rate of change in technology may leave many gasping but one spin-off is that “leading edge” soon becomes “old hat”, often begging for enterprising use in other fields. Well, I’ve yet to see any MP3 players being used as audible fishing lures but it’s rapidly becoming “suck it and see” when it comes to persuading even last year’s hi-tech to work with “engines” such as the ever-appealing Picaxe family. I was reminded of this when overhearing a competitive mountain bike rider saying “Magnetic pickup bike computers are so 1990s. . .” His handlebars were so festooned with electronic devices, including a mapping GPS, that he looked more like a low-flying jumbo jet pilot. Probably even the average pedestrian now sports more computing power than the entire western world had 30 years ago and it is becoming increasingly 78  Silicon Chip common to see hikers with handheld GPS units as part of their portable electronics payload. But . . . bike computers? Although some are Hall effect or wireless, these traditionally used a magnet attached to a wheel spoke to trigger a fork-mounted reed switch as the wheel spun, with a display then showing, at least, speed (both peak and average) and distance travelled. The unit’s internal clock, following formulas such as speed = distance/ time, handles the basic calculation for you. No doubt others have pondered adapting these little gadgets in the past for windspeed, water flow, battery drain and the like but with recent attractively lowered prices (we’ve seen them for around $15) they now appeal for all manner of microcontroller work. Their even-cheaper pedestrian mate, the near ubiquitous pedometer, offers fewer display options but with today’s “10,000 daily steps for health” era, it won’t be long before they turn up in cornflakes packets. Prior to investigating these devices, it was considered that connection to a Picaxe would need replication of the magnetic make and break circuitry, along with possible de-bouncing and pulse shaping for reliable operation. All manner of classic switching techniques were pondered but to my delight it transpired that the hard work had already been done and that just standard Picaxe High/Pause/Low/ Pause generation was adequate. Ladies and gentlemen, it couldn’t be easier! Here’s sample code for an output at Picaxe-08M pin 4: Bikepedo: High 4 Pause 200 Low 4 Pause 200 Goto bikepedo siliconchip.com.au A solar cell charger being monitored with Stan’s Picaxe ammeter. You could also charge small SLA batteries (as shown at top) and even use one of Jaycar’s small wind generators (just visible top right of photo) instead of the solar cells. A paralleled red LED (with dropping resistor) allows visual pulse verification as well. Naturally the Pause value could be replaced with a b0, b1, etc variable (perhaps a DS18B20 style Readtemp b1?) that related to the condition being monitored. Direct Picaxe output pin connection looked dubious, so after some exploring with dropping resistors it was found that signals could be sensed siliconchip.com.au via just a 100nF capacitor. Usefully, this blocks any errant DC – it was noted several volts from the inbuilt battery were on the bike computer’s sensing leads. Pedometer After unscrewing and removing the small swinging magnet arm, a pair of wires can be simply soldered across the reed switch and run to the Picaxe driving circuit. The minimum pulse duration looked around a quarter of a second (250ms), which is consistent with a very brisk walk. Each time the Picaxe “high” transits “low” the pedometer counter advances by one. Hence with an upper display limit of 99,999 if an event provides a high/low transition every 10 seconds then 360 will occur hourly, and the counter can handle 99,999/360 = 277 hours worth (nearly 12 days). February 2007  79 CON2 DB9 2 22k 3 5 10k 1 2 3 7 IC1 PICAXE-08M 4 (TO PC SERIAL PORT) IO CHANNELS 0 6 1 5 2 8 PEDOMETER 00031 3 100nF 4 LED λ 330Ω The circuit for the simple Picaxe Pedometer adaptation, with a photo of the breadboard layout below. Connection to the Pedometer is simply across the internal reed switch, as shown at the bottom of the page. 80  Silicon Chip Cyclo (“bike”) computer 3--5V SUPPLY The bargain (but well thought of) Cat Eye Velo 1 bike computer simply had its magnetic pickup twin leads cut and inserted in the Picaxe circuit where the pedometer had previously been. Although wheel diameter can be adjusted, the unit was used straight out of the box. Incidentally, if you’re not familiar with the Velo 1, it’s from the Japanese firm CatEye, the worlds largest bike computer manufacturer (see www. cateye.com). Their products are available in most bike shops. I’ve not checked other bike computers but it’s possible that other brands might be just as easily adapted and driven. Cateye also have the Velo 5 which should be just as easily driven as the budget Velo 1. In fact the Velo 5 apparently reads to 300km/h which will even better suit Ah meter applications. The display, toggled to km/h, showed speeds inversely related to the High/Low pause length. Hence Pause 1000 (about as long as was possible before the displayed “zeroed”) equated to 3.6km/h stroll, while Pause 100 gave 36km/h, and Pause 40 (about the upper speed limit) showed 90km/h. Note this clearly meant the product of pause (ms) x speed (km/h) was 3600, so Pause 50 related to 72km/h and Pause 200 a slower 18km/h. These values may need calibrating in your own application of course, especially with a more involved program. It was naturally tempting to exploit the bike computer’s integration (summation over time) feature, particularly measuring a solar panel’s DC charging current in Amps as speed and accumulated amp-hours as distance (distance = speed x time of course). A range of monitoring techniques were explored (opto-coupling, thermal and Hall Effect, etc) but Picaxe–08M processing delays gave non linearity at higher currents (and thus shorter pauses), somewhat frustrating more elegant circuitry and time consuming on-board look-up tables. Hall-effect sensors, such as the Allegro UGN3503U, offer an attractive benefit in that they can monitor current both coming (+ve) or going(-ve) from a supply. There are extensive Halleffect, “Picaxable” insights at Glenn’s DIY wind site www.thebackshed.com A possible solution is to use TWO siliconchip.com.au Picaxes, with one doing the slow decision making and number crunching while the other (fed by a suitable Serout/Serin) handles the Pauses. Each Picaxe will need separate programming, so a very clear head will be in order. Don’t try this after a big day out celebrating the cricket wins! Amp and Amp-hour meter Frustration with more enhanced (and costly) current sensing techniques eventually lead to considering just measuring the voltage drop across a low value series resistor in the PV supply line. This classic technique, well known in automotive electrical work, exploits the fact that when currents are large (such as in a car with tens or even hundreds of Amps being drawn) a measurable voltage drop will develop across the very-low-resistance battery earthing strap. If, say, 10A passes through a .01W cable then Vacross= Ipassing x Rvalue = 10 x .01 = 0.1V = 100mV will be “dropped”. That’s a value now easily measured with a DMM (or Picaxe - see below). As this bike computer has an upper reading of 100km/h, user convenience should ideally give a direct readout of current so that “50” will mean 50mA is passing. If 12V solar panels are used this allows use of the abundant 12V 1W solar car battery trickle chargers, as even in very bright sun their output will be under 100mA. Furthermore, a 1W 1W series resistor being read as a shunt will easily handle the power and develop a bright sun maximum of Vacross = Ipassing x Rvalue = 0.1A x 1W = 100mV across it. Although the resistor is somewhat wasteful in series with the battery, most 12V solar (photovoltaic) cells deliver outputs up to 18V and therefore its effectwill be negligible. NB: larger panels will naturally deliver higher currents and this resistor should be suitably rated for the task, perhaps with a group in series parallel to present the right resistance but handle the higher currents. Ten 10W 1W resistors in parallel will present 1W but now handle 10W and be adequate for a larger 10W photovoltaic cell. Reading this mV-level voltage In contrast to the original Picaxe-08, which had only a 4-bit low-res ADC feature, the Picaxe-08M can read to siliconchip.com.au CON2 DB9 +4.5V 2 22k 3 10k 5 2 3 7 IC1 PICAXE-08M 4 (TO PC SERIAL PORT) IO CHANNELS 1 0 6 1 5 2 8 + RECHARGEABLE BATTERY – EG, 10x AA Nicad/ NiMH (12V) OR SMALL 12V SLA SMALL SOLAR PANEL OR WIND TURBINE GENERATOR 10kΩ 1Ω 1W 100nF 3 100nF 4 _ 1N4004 etc 12.34 LED λ LED ZENER + K A SC 2007 8 CAT EYE VELO 1 330Ω 4 1 BIKE COMPUTER Picaxe BIKE COMPUTER AMMETER Extending the idea of the Pedometer circuit on the facing page and using a popular Bike Computer we come up with this Picaxe Ammeter. A breadboard layout is shown below (note there are several differences between this and the photo overleaf). BIKE COMPUTER V+ SOLAR PANEL (+) 100nF 22kΩ A PICAXE08M LED K 4.5V (3x “AA” ALKALINE) * SOLAR PANEL (--) RECHARGEABLE BATTERY (+) K 10kΩ 330Ω 1N4004 10kΩ 0V * OR 4.8V (4x NiCd OR NiMH) 0 1 2 3 4 I/O CHANNELS 100nF 3 2 5 TO PC RS232 PORT (FOR PROGRAMMING) 10 bits as “word” (w) variables. With a 5V supply this means 210 = 1024 steps, allowing resolutions to 5V/1024 = ~ 5mV. Although the dropped voltages across our 1W resistor will be very low (pleasingly), this means the Picaxe-08M can read them directly under readadc10 and an otherwise traditional op amp circuit will not be needed. The downside to this simplicity however is that the display accuracy is influenced by the Picaxe supply voltage, although at 4.5V (3 x AA) it was found to be acceptably close to a series ammeter over a wide PV current range. In conjunction with a Zener regulator (3.3V was used here) higher Picaxe supply voltages showed 1Ω 1W RECHARGEABLE BATTERY (--) BIKE BIKE COMPUTER COMPUTER acceptable readings which actually improved as the batteries aged, but naturally a stable supply (perhaps using a 7805 for 5V) and software w2 tweaking should eliminate this drift. Calibration The charging of a wide variety of secondary batteries can be monitored by this set up, and since the sun (or wind) is an erratic energy source the “fuel gauge” will be particularly revealing of energy actually gathered over a period. Do you suspect your PV has seagulls perching on it some days? Dirt and leaves on the panel? Weather cloudy while you were elsewhere? This will tell you! Naturally, indoor (ie, mains-based) charging can enjoy a steady supply. February 2007  81 battery charging is rather a black art, as significant “wastage” arises with battery heating and self-discharge. The mAh rating on many Nicad & NiMH batteries is best viewed as indicative only – just because a NiMH “AA” cell is branded as 2500mAh it doesn’t mean this is sacred! Even if correct when new (!) it’ll decrease with age, storage and use. Traditionally, AA NiCd/NiMHs need to be over-filled anyway, with a 10-hour theoretical charge typically needing 14 hours to ensure full capacity. The winking LED used initially has been retained in this conversion, since it’s pulsing usefully shows the charging rate at a glance. Extension: Here’s a photo of the Picaxe/Bike Computer ammeter, albeit with a few components removed for simplicity. With 600mAh Nicad cells readily available from gutted solar garden lamps, it’s suggested that these be used in the test bed. However, small 12V SLAs could fit the bill – just keep in mind that larger batteries will take much longer to charge at low currents. Hence a 7Ah SLA may theoretically take 70 bright sun hours, meaning perhaps a fortnight or more with nonideal solar conditions. A 600mAh Nicad could be charged in a sunny day or two – a particularly attractive benefit for educators. A simple “known good” series ammeter in the PV supply line will allow verification of the bike computer’s reading as charging occurs. If display inconsistencies arise, perhaps due to an unusual solar PV or bike computer, then try altering pause w2 values to suit. It’s worth keeping in mind that 82  Silicon Chip This second circuit is again built on breadboard, following the now well established Picaxe-08M layout, since it still offers considerable scope for further investigation, perhaps as part of an educational project. Enthusiasts are advised to consider unified power supplies at least, since the bike computer “coin cell” will probably not last long if subject to extended use. The option switch built into the computer could probably also be brought out to a more convenient larger type. The Hall Effect approach mentioned earlier potentially offers a more versatile design of course, but this “1W” method is certainly cost effective and easy to get working! SC BIKEAMPH.BAS code listing (also downloadable at www.picaxe.orcon.net.nz/bikeamph.bas) ‘bikeamph.bas for Picaxe-08M driven ‘CATEYE Velo1’ bike computer conversion. ‘Suits educational output current monitoring of small 1W PV or wind gene ‘via simple 1W 1 Ohm supply shunt resistor, with voltage readadc10 measured. ‘Schematic (draft)=> www.picaxe.orcon.net.nz/bikeamph.gif -suits breadboard! ‘Initial solderless small PV layout =>www.picaxe.orcon.net.nz/bikeamph.jpg ‘Thanks to Glen’s A1 wind gene site => www.thebackshed.com for initial ideas ‘For ‘Silicon Chip’ article Feb. 2007. Via=> stan.swan<at>gmail.com 23/12/2006 shunt: readadc10 1, w1 ‘sertxd (#w1,13,10) if w1 <=1 then shunt ‘ approx w1 range 1 at 5mA to 30 at 100mA thru’ 1 Ohm ‘ useful w1 ‘F8’ check point-comment in/out as need be ‘ gives bike comp. zero reading on very low I (~<5mA) w2=600/w1 ‘ adjust top ‘600’for Picaxe supply calib. (600=~4.5V) high 4 pause w2 low 4 pause w2 ‘ Output pulse code for bike computer,fed to pin 4 ‘ via 100nF capacitor & parallel LED. Some scope for ‘ tweaking,but bike comp.times out if pause >~1000ms ‘ and upper detection range ~30mS (~100km/hr) goto shunt siliconchip.com.au