Silicon ChipPICAXE-Powered Thermostat & Temperature Display - February 2006 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Most home theatre systems are not worth watching
  4. Review: Epson EMP-TWD1 LCD Projector by Barrie Smith
  5. Feature: Electric-Powered Model Aircraft by Bob Young
  6. Project: PC-Controlled Burglar Alarm System by Trent Jackson
  7. Project: Build A Charger For iPods & MP3 players by John Clarke
  8. Feature: Do-It-Yourself Electronic Servicing by David Reid
  9. Project: PICAXE-Powered Thermostat & Temperature Display by Michael Jeffery
  10. Feature: ZigBee: The New Wireless Standard by Stan Swan
  11. Project: Adding Infrared To Your Microbric Viper by Ross Tester
  12. Project: Build A MIDI Drum Kit; Pt.4 by John Clarke
  13. Project: Building The Ultimate Jukebox; Pt.3 by Ross Tester
  14. Salvage It: Making an adjustable loud screamer by Julian Edgar
  15. Vintage Radio: Brian Lackie’s Wireless Museum by Rodney Champness
  16. Book Store
  17. Advertising Index
  18. Outer Back Cover

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

You can view 41 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:
  • Electric-Powered Model Aircraft (February 2006)
  • Electric-Powered Model Aircraft; Pt.2 (June 2006)
Items relevant to "PC-Controlled Burglar Alarm System":
  • PIC16F877A-I/P programmed for the PC-Controlled Burglar Alarm [PCCBA.HEX] (Programmed Microcontroller, AUD $20.00)
  • PIC16F84A-04(I)/P programmed for the PC-Controlled Burglar Alarm keypad [keypad.hex] (Programmed Microcontroller, AUD $10.00)
  • PIC16F877A/PIC16F84A firmware for the PC-Controlled Burglar Alarm [PCCBA.HEX/keypad.hex] (Software, Free)
  • Host software for the PC-Controlled Burglar Alarm (Free)
  • PCB patterns for the PC-Controlled Burglar Alarm System (PDF download) [03102061/2] (Free)
  • PCB pattern for the PC-Controlled Burglar Alarm keypad (PDF download) [07203061] (Free)
  • Keypad panel artwork for the PC-Controlled Burglar Alarm System (PDF download) (Free)
  • PC-Controlled Burglar Alarm System front panel artwork (PDF download) (Free)
Articles in this series:
  • PC-Controlled Burglar Alarm System (February 2006)
  • PC-Controlled Burglar Alarm System, Pt.2 (March 2006)
Items relevant to "Build A Charger For iPods & MP3 players":
  • PCB pattern for the iPod/MP3 Player Charger (PDF download) [14102061] (Free)
Items relevant to "PICAXE-Powered Thermostat & Temperature Display":
  • PICAXE-08M software for the Thermostat and Temperature Display (Free)
Articles in this series:
  • Adding Infrared To Your Microbric Viper (February 2006)
  • A Line Tracker For Your Microbric Viper (March 2006)
  • Microbric Viper: The Sumo Module (April 2006)
Items relevant to "Build A MIDI Drum Kit; Pt.4":
  • PIC16F88-I/P programmed for the MIDI Drum Kit [drumkit16.hex] (Programmed Microcontroller, AUD $15.00)
  • PIC16F88 firmware and source code for the MIDI Drum Kit [drumkit16.hex] (Software, Free)
  • PCB patterns for the MIDI Drum Kit (PDF download) [01211051/2/3] (Free)
  • MIDI Drum Kit front panel artwork (PDF download) (Free)
Articles in this series:
  • Build A MIDI Drum Kit (November 2005)
  • Build A MIDI Drum Kit; Pt.2 (December 2005)
  • Build A MIDI Drum Kit; Pt.3 (January 2006)
  • Build A MIDI Drum Kit; Pt.4 (February 2006)
Items relevant to "Building The Ultimate Jukebox; Pt.3":
  • Ultimate Jukebox front panel artwork (PDF download) (Free)
Articles in this series:
  • Building The Ultimate Jukebox; Pt.1 (December 2005)
  • Building The Ultimate Jukebox; Pt.2 (January 2006)
  • Building The Ultimate Jukebox; Pt.3 (February 2006)

Purchase a printed copy of this issue for $10.00.

By MICHAEL JEFFERY PICAXE-Powered Thermostat & Temperature Display As demonstrated in our recent “PICAXE in Schools” series, the PICAXE-08M is a useful little chip when it comes to learning about microcontrollers. You might think that it has limited uses outside the classroom but here’s a project that proves otherwise – a simple but accurate 3-digit temperature display that can act as a thermostat. miliar to many PICAXE experimenters. The sensor can be mounted directly on the board or via short flying leads tailored to suit the application. For those interested in experimenting with 7-segment displays, this project can also be connected to the Schools Experimenter (see SILICON CHIP, May 2005) using an optional header. Power for the project can come from a three or 4-cell battery pack or better still, a regulated 5V DC supply. B Three variants RIEFLY, THIS PROJECT SHOWS the current temperature on a LED display using an absolute minimum of parts and with very good accuracy. A temperature set-point can also be entered, enabling control of external 62  Silicon Chip devices for rudimentary heating or cooling applications via a single digital output. Temperature measurement is realised with a DS18B20 digital temperature sensor IC, a device that will be fa- First up, we must mention that the author is not releasing the BASIC code for this project. Instead, you can purchase pre-programmed PICAXE-08M chips (and PC boards) for a reasonable siliconchip.com.au Fig.1: here are the complete circuit details. A DS18B20 serves as the temperature sensor (IC2) and this drives pin 4 (P3) of a PICAXE-08M microcontroller (IC1). IC1 in turn clocks three 4026B decade counters/counters (IC3-IC6) which then drive the 7-segment LED displays. price. Three distinct versions of the code have been created to cater for a variety of needs. There are two thermostatic versions, identified as “heating” and “cooling”, and a “temperature only” version. Both thermostatic versions display the temperature of the DS18B20 sensor from 1°C to 124°C and allow entry of a user-selected setpoint. Above the programmed setpoint, the “cooling” version produces a logic high (+5V) on the digital output, whereas for the “heating” version, a logic high is produced while the temperature is below the setpoint. The “temperature only” version is just that; it displays the temperature of the DS18B20 sensor, ranging from -55°C to +125°C, but has no thermosiliconchip.com.au static functions. The digital reading from the DS18B20 is accurate to ±0.5°C from -10°C to +85°C, so the displayed reading will be accurate to 1°C. The on-board LED is used to indicate negative temperature readings. Pressing S1 switches the display to read in degrees Fahrenheit, with a range of 32°F-125°F. Note: a simplified version of the “temperature only” BASIC program (named tempdisplay.bas) is available for download from our website for those that wish to experiment with their own code. How it works Looking first at the LED display portion of the circuit (Fig.1), each display is driven by a 4026 decade counter/7-segment decoder. A 4026’s counter advances by one for each highgoing pulse on its “CLK” input (pin 1) and the result is decoded to drive the necessary segment output lines (A-G). In this simple design, the 4026 segment outputs directly drive the anodes of the LEDs in the common-cathode 7-segment displays. With a 5V supply, the impedance of the MOS outputs is such that it limits LED current to only a few milliamps; current-limiting resistors are not required. After each count of 10, the “Carry out” output (pin 5) goes high, and this is used to clock the succeeding stage in the chain. So with three stages cascaded together, the maximum count is “999”. Naturally, the display is arranged so that the count progresses February 2006  63 to the CD4026) is available from STMicroelectronics at www.st.com. Power supply To avoid damaging the PICAXE, it’s positive supply (+V) must never exceed 5.5V. A diode (D1) in series with the board’s positive input provides polarity protection and drops about 0.6V, so the board can to be powered from a 4-cell battery pack if desired. However, we recommend the use of a 3-cell pack or regulated 5V supply, in which case the diode should be replaced with a wire link. Take great care with supply polarity if the diode is omitted! Experimenter’s ideas Fig.2: here’s how to locate all of the parts. Take care with the orientation of the ICs, diode and LED. Note that LED1 is installed for the heating and cooling versions, whereas LED2 and link LK1 are installed for the “temperature only” version. See text for other variations. from right to left, so the rightmost digit is the least significant. The count can be reset to zero at any time by pulsing the 4026’s “Reset” input. To provide a brief positivegoing pulse, all Reset inputs connect to output 0 (pin 7) of the PICAXE via a 100nF capacitor. Note how the piezo sounder shares output 0 of the PICAXE with the 4026 CLK inputs. The BASIC program Fig.3: the on-board PICAXE chip can be removed and the project connected to the Schools Experimenter board for those that wish to write their own programs. As shown here, an 8-way header can be installed for the hook-up. A header socket and a short length of ribbon cable will also be required. Note how pin 4 has been cut short and connected to the track below via a 100nF capacitor. 64  Silicon Chip prevents piezo “beeps” from affecting the display count but the reverse does not apply; when the count is incremented, audible noise emanates from the sounder. If this proves to be a problem, a switch could be used to disable the piezo sounder. As mentioned previously, temperature sensing is performed by a DS18B20 from Maxim/Dallas. This unique device provides accurate, direct-to-digital temperature sensing and requires only one data line for interfacing. Maxim/Dallas refer to this as their “1-Wire” interface and it allows the entire device to be squeezed into a tiny 3-pin TO-92 style package. The PICAXE-08M’s BASIC language includes support for the DS18B20 and can read its temperature over the 1-Wire bus using the readtemp and readtemp12 commands. The DS18B20’s native measurement range is from -55°C to +125°C (–67°F to +257°F). Each chip has a unique 64-bit ID code stored in an onboard ROM and includes features such as 9 to 12-bit Centigrade measurements, alarm functions and non-volatile user-programmable upper and lower trigger points. Need to know more? Well, technical data on the DS18B20 can be downloaded from the Maxim/Dallas website at www.maxim-ic.com, whereas data for the HCF4026 (a direct equivalent As an option, an 8-way header can be installed on the board for connection to the header socket (H1) on the Schools Experimenter (see SILICON CHIP, May 2005). In this case, a PICAXE micro must not be installed on the board, as the display and sensor are accessed from the experimenter board instead. As mentioned in the construction section below, a 100nF capacitor must be fitted in series with input 0 from the header in order to be able to reset the 4026 counters. If you’re feeling adventurous and need more than three digits, then the left and right sides of the PC board can be sliced off along rows of holes next to the left and right sides of IC5 and IC3. This allows multiple boards to be stacked end-to-end, thus achieving uniform digit spacing. Of course, you’d need to do this before installing any parts on the board! Construction Construction is very straightforward and should only take a few minutes once the wire links are in place. The links can be fashioned from 0.7mm tinned copper wire or similar and should be installed first (see Fig.2). Next, install all of the resistors and fit socket strips for the three displays (DISP1 – DISP3) utilising 6 x 5-pin sections. These can be cut down from longer 32 or 40-way strips. Conventional 8 and 16-way IC sockets are used for IC1 and IC3-IC5.Now install all the remaining components, noting the orientation of the flat side of the pushbutton switch (S1). The diode (D1) need only be installed if you’ll be using a 4-cell battery pack, otherwise fit a wire link in its place. siliconchip.com.au Where To Buy Parts Par t s Lis t Blank PC boards and pre-programmed PICAXE-08M microcontrollers for this project are available from Michael Jeffery, Clinch Electronic Systems, 329 Hughes Lane, Eurobin, Vic 3739. Website: http://porepunkahps.vic. edu.au/home/jef01/display.htm 1 3-digit PC board (see panel) 1 pre-programmed PICAXE-08M micro (IC1) (see panel) 1 DS18B20 temperature sensor (IC2) (available from www. microzed.com.au) 3 CD4026B decade counter/7segment decoders (IC3-IC5) 3 0.5-inch common-cathode LED displays, FND500 or similar 1 1N4004 diode (D1) 1 PC-mount pushbutton switch 1 piezo transducer 1 32-way IC socket strip (Jaycar PI-6470) 1 8-pin IC socket 3 16-pin IC sockets 1 100mm x 0.7mm wire for links 4 100mF 50V monolithic ceramic capacitors 1 22kW 0.25W 5% resistor 2 10kW 0.25W 5% resistors 1 4.7kW 0.25W 5% resistor Please note that only Australian orders will be accepted and payment must be made either by cheque or by money order. Add $4.95 to all orders for postage and packing. Current prices (including GST) are: (1) Three-digit blank PC board: $12.00 plus p&p (2) Two-digit blank PC board (not shown in this article): $10.00 plus p&p (3) PICAXE-08M pre-programmed with “heating”, “cooling” or “temperature only” version of the software (please specify version): $5.70 plus p&p Fit a LED in location “LED1” for the thermostatic variants of the project, taking care with the orientation of the flat (cathode) side. This LED is connected to output 1 of the PICAXE via a 330W resistor and will illuminate when the temperature is above or below the programmed setpoint, depending on the version of the software. However, for the “temperature only” version, this output is used to indicate negative temperature readings, so you should install the LED in location “LED2” instead. This gives a slightly more aesthetic display, as LED2 is aligned with the three digits. In this case, a link is also required in location LK1. Alternatively, the “g” segment of DISP3 can be used to display a “-“ sign for negative readings and the LEDs can be omitted. To do this, cut the track joining pads A and B (above DISP3) and install wire links in locations LK1 & LK2. If desired, the temperature sensor (IC2) can also be located on-board, in which case it can be mounted using a 3-way socket strip. If you’ll be using the board with the Schools Experimenter, an 8-way rightangle header (eg, Altronics P-5518) can be installed for CON1. Note that the header is not required for normal (stand-alone) operation! Before installing the header, cut the end of pin 4 off so that it doesn’t quite pass through the PC board. The idea is to isolate the pin from the pad underneath, while leaving a few millimetres protruding from the rear of the plastic housing. After installing the header, solder a 100nF capacitor between the cut-off pin and the track that goes to pin 15 of IC3 (see Fig.3). Setup & use immediately after the current temperature disappears from the display. Upon pressing the switch, a single beep will be heard and the display will show “000” as before. When the programmed setpoint is “tripped”, the current temperature will be displayed, followed by four quick beeps and then the set-point temperature. This repeats continuously until the temperature moves above or below the set-point. To reiterate, the “cooling” version produces a logic high (+5V) on output 1 (pin 6) of the PICAXE for any temperature above the set-point. This function is reversed for the “heating” version; any temperature below the setpoint will produce a logic high on output 1. The LED is also connected to output 1 and will illuminate when the output goes high. Spare pads are provided on the board to allow this output to be wired to external switching circuitry SC of your own invention. No setup is required for the “temperature only” version. For the thermostatic (heating/cooling) versions, the setpoint temperature must be programmed after power is applied, as follows. At power up, the display will first show “000”, then the current temperature for about five seconds, followed by three short beeps and then “088”. This sequence is repeated continuously to warn of a previous power disruption. If the switch is pressed when “000” appears, a single beep will be heard and the unit waits for 20 seconds for the set-point temperature to be entered. Each press of the switch represents one setpoint degree. Once the value has been entered and after 20 seconds have expired, three beeps will be heard and the set-point will be displayed back for verification. From this point on, set-point changes can be made by pressing the switch Table 1: Resistor Colour Codes o o o o siliconchip.com.au No. 1 2 1 Value 100kW 10kW 4.7kW 4-Band Code (1%) brown black yellow brown brown black orange brown yellow violet red brown 5-Band Code (1%) brown black black orange brown brown black black red brown yellow violet black brown brown February 2006  65