Silicon ChipThe PICAXE, Pt.8: The 18X Series - November 2003 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: The valve circuit we said we would never publish
  4. Feature: Electronic Noses Smell A Big Future by Peter Holtham
  5. Order Form
  6. Feature: Logging Your Every Driving Moment by Julian Edgar
  7. Project: A 12AX7 Valve Audio Preamplifier by Jim Rowe
  8. Project: Our Best LED Torch EVER! by John Clarke
  9. Product Showcase
  10. Weblink
  11. Project: Smart Radio Modem For Microcontrollers by Nenad Stojadinovic
  12. Project: The PICAXE, Pt.8: The 18X Series by Stan Swan
  13. Project: A Programmable PIC-Powered Timer by Trent Jackson
  14. Feature: PC Board Design Tutorial, Pt.2 by David L. Jones
  15. Vintage Radio: The 1953 4-Valve Precedent Mantel Receiver by Rodney Champness
  16. Notes & Errata
  17. Market Centre
  18. Advertising Index
  19. Back Issues
  20. Book Store
  21. Outer Back Cover

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

You can view 27 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 "A 12AX7 Valve Audio Preamplifier":
  • 12AX7 Valve Audio Preamplifier Main PCB [01111031] (AUD $7.50)
  • 12AX7 Valve Audio Preamplifier Power Supply PCB [01111032] (AUD $10.00)
  • ETD29 transformer components (AUD $15.00)
  • 12AX7 Valve Preamplifier PCB patterns (PDF download) [01111031/2] (Free)
Articles in this series:
  • A 12AX7 Valve Audio Preamplifier (November 2003)
  • A 12AX7 Valve Audio Preamplifier (November 2003)
  • Using The Valve Preamp In A Hifi System (February 2004)
  • Using The Valve Preamp In A Hifi System (February 2004)
Items relevant to "Our Best LED Torch EVER!":
  • 1W Star LED Torch PCB pattern (PDF download) [11211031] (Free)
Items relevant to "Smart Radio Modem For Microcontrollers":
  • Smart Radio Modem PCB patterns (PDF download) [06111031/2/3] (Free)
Items relevant to "The PICAXE, Pt.8: The 18X Series":
  • PICAXE-18A Temperature Logger source code (Software, Free)
Articles in this series:
  • PICAXE: The New Millennium 555? (February 2003)
  • PICAXE: The New Millennium 555? (February 2003)
  • The PICAXE: Pt.2: A Shop Door Minder (March 2003)
  • The PICAXE: Pt.2: A Shop Door Minder (March 2003)
  • The PICAXE, Pt.3: Heartbeat Simulator (April 2003)
  • The PICAXE, Pt.3: Heartbeat Simulator (April 2003)
  • The PICAXE, Pt.4: Motor Controller (May 2003)
  • The PICAXE, Pt.4: Motor Controller (May 2003)
  • The PICAXE, Pt.5: A Chookhouse Door Controller (June 2003)
  • The PICAXE, Pt.5: A Chookhouse Door Controller (June 2003)
  • The PICAXE, Pt.6: Data Communications (July 2003)
  • The PICAXE, Pt.6: Data Communications (July 2003)
  • The PICAXE, Pt.7: Get That Clever Code Purring (August 2003)
  • The PICAXE, Pt.7: Get That Clever Code Purring (August 2003)
  • The PICAXE, Pt.8: A Datalogger & Sending It To Sleep (September 2003)
  • The PICAXE, Pt.8: A Datalogger & Sending It To Sleep (September 2003)
  • The PICAXE, Pt.8: The 18X Series (November 2003)
  • The PICAXE, Pt.8: The 18X Series (November 2003)
  • The PICAXE, Pt.9: Keyboards 101 (December 2003)
  • The PICAXE, Pt.9: Keyboards 101 (December 2003)
Items relevant to "A Programmable PIC-Powered Timer":
  • PIC16F628A-I/P programmed for the "Master of Time" PIC-based Programmable Timer [MOT.HEX] (Programmed Microcontroller, AUD $15.00)
  • PIC16F628A firmware for the "Master of Time" Programmable Timer [MOT.HEX] (Software, Free)
  • Programmable PIC-Powered Timer PCB pattern (PDF download) [04111031] (Free)
Articles in this series:
  • PC Board Design Tutorial, Pt.1 (October 2003)
  • PC Board Design Tutorial, Pt.1 (October 2003)
  • PC Board Design Tutorial, Pt.2 (November 2003)
  • PC Board Design Tutorial, Pt.2 (November 2003)
  • PC Board Design Tutorial, Pt.3 (December 2003)
  • PC Board Design Tutorial, Pt.3 (December 2003)

Purchase a printed copy of this issue for $10.00.

MOVING UP IN THE PICAXE WORLD BIG BROTHER IS WATCHING YOU. . . (Picaxe’s big brother, that is) OK, Picaxe enthusiasts – you’ve diligently followed our “08” articles and can rightly claim your Picaxe “drivers licence”. Time to hit the highway, maybe? by Stan Swan A s hinted during our earlier articles, the Picaxe range in cludes seven big brothers, grouped into 18, 28 and even 40-pin families. Although the baby “08” remains supreme for simple control circuits, it’s rather like using a two-door hatchback for a cross country workout. Consider the 18s as perhaps akin to 4WDs, 28s as Rally cars, while 40s. mmm – well you get the idea! The 40X is so long in fact that it looks like a toy aircraft carrier! These larger devices, although featuring powerful further commands, still obey the key 35 “08” instructions, so all you’ve learnt so far can be immediately put to use – but it’s obviously a waste to spend much more to just flash a few LEDs with them! Although this month’s coverage relates to the 18A, we’ve also shown a summary of the family overall (including the recently-released fire-breathing 18X). All enjoy the usual wide supply voltages (3-5.5V), 4MHz clock and direct ~20mA output drive but larger versions have dedicated Input or Output pins rather than the versatile I/Os of the “08”. Note that the basic 18 and 28 74  Silicon Chip Picaxes, inferior to the “A” and “X” versions, are obsolete and no longer marketed. Incidentally, no “A” or “X” updates are planned for the “08” series. Since Picaxes of course are PIC based, it’s worth comparing the pin compatible 18-pin models with the ubiquitous PIC16F84 – now itself obsolete as replaced by the cheaper and more powerful 16F627 with an internal oscillator as well. The enhanced PIC16F627 (the 16F819 – only released by Micro-Chip in January 2003), is the PIC that the Name Mem I/O Out (Pins) lines pins 08 18 18A 18X 28 28A 28X 40X 40 40 80 600 80 80 600 600 5 1-4 13 8 13 8 14 9 20 8 20 8 21 9-17 32 9-17 In- ADC puts (Low) 1-4 5 5 5 8 8 0-12 8-20 1L 3L 3 3 4 4 0-4 3-7 “18A” (bootstrapped by Rev. Ed of course) is based on. Picaxe-18A features: New features include (with associated commands in italics) – 1) Accurate digital temperature sensor interface for direct Celsius readings using the Dallas Semiconductor (Maxim) “1 wire bus” DS18B20 I.C. – readtemp 2) Direct PC keyboard interface allowing inputs 6 and 7 interface     – keyin, keyled 3) Interrupts to immediately respond Data Polled mem. Interrupt 128-prog 128-prog 256 256+I2C 64+256 64+256 128+I2C 128+I2C Yes Yes Yes Yes Yes PIC type Cost (A$) (approx) 12F629/675 $4 16F627 16F819 $10 16F88 ~$14 16F872 16F872 $15 16F873A $20 16F874 $28 Here’s a summary of the currently-available Picaxe chips which also gives their various parameters, allowing you to pick (no pun intended!) the right one for you. The 18X is the new kid on the block, released only last month. www.siliconchip.com.au Here’s the pinout comparison between the PICAXE-18A and the PIC 16F family, on which it is based. to input changes while otherwise busy – setint 4) Infrared detection to enable remote control from a TV style handset –infrain 5) Accurate clock chip interface for precise time keeping      – readowclk, resetowclk 6) iButton interface to allow electronic keys to be used within projects – readowsn 7) Servo control to directly drive up to eight radio controlled servos     – servo Additionally the readadc command, previously only a low resolution “08” feature, now allows high resolution 256- step ADC inputs on pins 0, 1 and 2. Phew! There’s enough here for such a swag of circuits that you’ll be busy for months. And the new “18X” introduces a further half-dozen features (I2C memory enhancement especially) that’ll keep us happy until Christmas (note we didn’t say which Christmas!). We’ll work up designs each month Circuit diagram and protoboard layout for this month’s PICAXE fun. Again, there are some differences between the photo below and this layout (redrawn for clarity) but electrically they are identical. The normal “08” programming cable is still used. The basic circuit arrangement for a PICAXE-18A and DS18B20 temperature sensor. Getting data in is as simple as connecting them together! www.siliconchip.com.au November 2003  75 DATADS18.BAS (Also downloadable from: http://www.picaxe.orconhosting.net.nz/datads18.bas) ‘PICAXE-18A TEMP. DATALOGGER for Nov 2003 “Silicon Chip” article. Ver 1.00 1/9/03 ‘Use with DS18B20 temp sensor IC etc to Picaxe-18A In 1. Via=> s.t.swan<at>massey.ac.nz ‘DS18B20 reads -10C to +85C to +/- 0.5C,but wider with less accuracy. Supply 3- 5.5V ‘N.B.Subzero “bug”-temps <0 C read as ascending from 128. Ex 129 = -1C, 130 = -2C etc ‘Possibly address by 2’s complement or subtracting value from 128. Thus 128-131= -3 ‘Program is “hi res” enhancement of lo res datalog8.bas as in Sept.’03 SiChip article ‘When “18A” powered up,any prior stored EEPROM values sent as pin 2 serial port data ‘-suit display via any terminal program -LCD,BananaCom,F8,StampPlot- or.csv Excel too. ‘NB-Gives you 30secs to turn unit OFF before fresh storage begins & thus progressively ‘wiping existing values ! For security however this data can’t easily be bulk erased ‘***BUT CARE - BE PROMPT ! REPROGRAMMING/RELOADING “18A” TOTALLY WIPES DATA TOO ****. ‘As set up logs direct Celsius temp every 15 secs for ~1 hr. Alter WAIT value to suit? ‘A further tempting ’18A” enhancement uses DS2415 or DS 1307 clock chip for improved ‘logging times. Both these & DS1820 can now be PICAXE-18A read, but not-sniff- by “08” ‘————————————————————————————————————— ‘PICAXE18A has hi-res data values 0-255(via “readadc” command),but also READTEMP for ‘direct DS18B20 Celsius readings! Values stored in non program space too (unlike “08”) ‘“Data compression” scope that’ll maybe give 512 values ? 18X + I2C better if pushed ‘If power saving needed use SLEEP instead of WAIT ex. 25x2.3secs ~1min delay (+/- 1% ) ‘Alter to suit.Ex. Sleep 391 =256 x 1/4 hr =64 hrs.Some interpreter o’head/drift noted ‘Solderless “PICNIK” breadboard setup pix => www.picaxe.orcon.net.nz/datads18.jpg ‘Sample Excel graph resulting (1 hour run)=> www.picaxe.orcon.net.nz/datads18.gif ‘Program hosted=> www.picaxe.orcon.net.nz/datads18.bas & circuit=> ... /picxds18.gif ‘————————————————————————————————————— ‘ASCII INPUTS 3-5V +supply OUTPUTS DS18B20 pinouts ‘ art + + + + + + + + + + + + + + + + + + (top view ) ‘ | | ‘ DS18B20 | _Serial _Piezo ** ‘ | | ———— | | * * ‘ | 0 1 2 6 7 =| PICAXE |=0 1 2 3 4 5 6 7 * * ‘ | =| 18A |= L * * ‘ |__0V ———— E ———— ‘ | D / / / ‘ ||| | |||||||| / / / ‘Prog. - - - - - - - - - - - - - - - - - - 0V | V+ ‘input Common ground for serial,DS18B20,piezo & supply data ‘————————————————————————————————————— ‘READ/PLAYBACK ROUTINE serout 2,n2400,(12,”PICAXE-18A Temp.Datalogger “)’ASCII values 12=FF(= cls), 44=comma for b0=0 to 255 ‘stored data values readout to terminal or LCD read b0,b1 ‘polls & reads out stored eeprom values ( .csv) serout 2,n2400,(#b1,44) ‘Actual value <at> pin 2,then comma for Excel .csv pulsout 2,500 ‘paralled output 2 LED flashes to confirm data next b0 ‘read next stored EEPROM value serial out serout 2,n2400,(10,13,10) ‘Forces fresh line for new data run(10=CR,13=LF) wait 30 ’30 secs “reading” delay -modify if too short etc ‘——————————————————————————————————— ‘WRITE/DATA LOGGING ROUTINE for b0= 0 to 255 ‘begin 256 data readings at time set by SLEEP sound 7,(75,10) ‘Beep to alert data logging commencing pulsout 2,500 ‘brief flash from pin 2 LED indicates datalogging readtemp 1,b1 ‘direct Celsius reading of DS18B20 temp. returned serout 2,n2400,(#b1,44) ‘Now allows display of data as gathered too ! write b0,b1 ‘sequentially write values to EEPROM locations wait 15 'Checks every 15 secs (max 65)-alter to suit etc next b0 ‘Gathering automatically stops after 256 samples ‘——————————————————————————————————— Note: the “ASCII art” in the middle of this text listing appears scrambled but when downloaded from the website lists perfectly. 76  Silicon Chip to keep you stimulated, with a style that gives command insights to start followed by applications such as the enhanced data logger this month. Let’s go! Right – seat belts fastened? When testing any new micro controller it’s traditional to first flash a LED. Flash a LED – that’s kids stuff for any Picaxe! Let’s do this instead with panache and “get the ice broken” while also measuring temperature. Digital temperature sensors For years the only real practical way of measuring temperature in projects was with “hard to calibrate” non-linear NTC thermistors (as used in the September 2003 article). However, digital temperature sensors, of which the 3-wire Dallas Semiconductor DS18B20 is probably best known, output the exact temperature in degrees Celsius and are now available at much the same price as thermistors. Initial DS1820s (note the missing “B”) were somewhat taller but proved drift-prone and are no longer supported. Incidentally, this “BC547 lookalike” is NOT a transistor. The Picaxe connection is very straightforward indeed – below is a code snippet that switches our pin 2 LED on and off at exactly 25° Celsius. Simplicity itself! And of course you want to try this out right away! But how do you house this 18-pinner for testing? Ideally, it would be with something like the Rev-Ed AXE-30 “18A” Starter Pack (retail A$40), which includes References and parts suppliers . . . (also refer to previous months articles) 1. Revolution Education (www. picaxe.com) gave generous permission to reproduce 18A data and graphics. 2. Australian Picaxe agent Micro-Zed (www.picaxe.com.au) supply most Picaxe parts, including the DS18B20 (~A$3). 3. Dallas Semiconductor (recently merged with Maxim) www. maxim-ic.com/1-Wire.cfm 4. Authors’s Picaxe resource page www.picaxe.orconhosting.net.nz –   includes program listings www.siliconchip.com.au main: readtemp 1,b1 if b1 > 25 then LEDon low 2 goto main ‘read temp at pin 1 via DS18B20 ‘LED on if temp (b1) beyond 25C ‘temp <=25 so LED goes/stays off ‘keep looping and measuring LEDon: high 2 goto main ‘temp >25 so turn on LED output 2 ‘keep looping and measuring If you just want to experiment without loading the complete code opposite, try this little program chunk. cables, CDs, battery box, 18A and PC board. It’s an elegant, if costly, solution – but fortunately our (cheap!) solderless PICNIK box conveniently allows a 300 hole breadboard swap-out that just accommodates an 18A version instead. Not all I/O lines need be fitted (especially if you are not using them!) and even the reset push button at pin 4 may be surplus but it’s suggested the wiring style and colour coding shown is followed to allow versatility for later circuits. Just in case you hadn’t twigged, input and output 0 (zero) are black, 1 are brown, 2 are red, etc, etc . . . Now where have we come across that colour coding before? Note the more usual “supply above, ground below” rails on this breadboard (the “08” had unusual supply pins). Useful development space remains on the breadboard, which easily accommodates the DS18B20 temperature sensor. This could of course be mounted remotely to measure the temperature of something, rather than the air around it! Once all hardware is ready, ensure your Picaxe Editor is a recent one (3.5.1 suggested – popular Ver 3.0.3 was 2002 era and did NOT of course support the 18A) and switched to the 18A mode (View >Options >Mode). The same programming cable and technique is otherwise used, although the larger memory of the 18A results in two “sweeps” as the program transfers. Extension Given the deceptive simplicity of the low resolution “08” temperature data logger detailed in September, it’s naturally tempting to enhance this with the high resolution “18A”/ DS18B20 combo just mentioned. Since up to 256 values can now be directly recorded in the EEPROM in degrees Celsius, with simultaneous display enjoyed as the data is gathered, it presents a serious device for real world data temperature monitoring – and even possible alerts if out of range values arise. Exactly the same layout as used in the test circuit above can be used – refer to the breadboard diagram. SC NEXT MONTH: More 18A (&18X?) magic – PC keyboard interfacing and interrupts, plus a preview of a versatile Picaxe datalogging kitset – ideal for school training or project use. Yikes! That home brew is stewing . . . a sample Excel plot from the DS18B20 and PICAXE-18 circuit used this month. This does have sufficient accuracy to be used for serious applications, www.siliconchip.com.au November 2003  77