Silicon ChipPIC-Based Car Battery Monitor - December 2003 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Australian power stations should be solar or gas-fired
  4. Feature: What You Need To Receiver Weather Satellite Images by Jim Rowe
  5. Feature: A Self-Diagnostics Plug For Your Car by Julian Edgar
  6. Project: VHF Receiver For Weather Satellites by Jim Rowe
  7. Order Form
  8. Project: Linear Supply For Luxeon 1W Star LEDs by Peter Smith
  9. Product Showcase
  10. Weblink
  11. Feature: PC Board Design Tutorial, Pt.3 by David L. Jones
  12. Feature: SPLat Controls microPLCs by Peter Smith
  13. Project: MiniCal 5V Meter Calibration Standard by Barry Hubble
  14. Project: PIC-Based Car Battery Monitor by Alan Bonnard
  15. Project: The PICAXE, Pt.9: Keyboards 101 by Stan Swan
  16. Vintage Radio: The AWA PF car radio & the Ferrite Tranimate by Rodney Champness
  17. Book Store
  18. Back Issues
  19. Notes & Errata
  20. Market Centre
  21. Advertising Index
  22. Outer Back Cover

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

You can view 30 of the 96 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 "What You Need To Receiver Weather Satellite Images":
  • VHF Receiver for Weather Satellites PCB [06112031] (AUD $15.00)
Articles in this series:
  • What You Need To Receiver Weather Satellite Images (December 2003)
  • VHF Receiver For Weather Satellites (December 2003)
  • What You Need To Receiver Weather Satellite Images (December 2003)
  • VHF Receiver For Weather Satellites (December 2003)
  • Antenna & RF Preamp For Weather Satellites (January 2004)
  • Antenna & RF Preamp For Weather Satellites (January 2004)
Items relevant to "VHF Receiver For Weather Satellites":
  • VHF Receiver for Weather Satellites PCB [06112031] (AUD $15.00)
  • VHF Receiver for Weather Satellites PCB pattern (PDF download) [06112031] (Free)
  • Panel artwork for the VHF Receiver for Weather Satellites (PDF download) (Free)
Articles in this series:
  • What You Need To Receiver Weather Satellite Images (December 2003)
  • VHF Receiver For Weather Satellites (December 2003)
  • What You Need To Receiver Weather Satellite Images (December 2003)
  • VHF Receiver For Weather Satellites (December 2003)
  • Antenna & RF Preamp For Weather Satellites (January 2004)
  • Antenna & RF Preamp For Weather Satellites (January 2004)
Items relevant to "Linear Supply For Luxeon 1W Star LEDs":
  • Luxeon 1W Linear Power Supply PCB pattern (PDF download) [11112031/2] (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)
Items relevant to "MiniCal 5V Meter Calibration Standard":
  • MiniCal PCB pattern (PDF download) [04112031] (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)

Purchase a printed copy of this issue for $10.00.

Don’t get caught with a flat battery Car Battery Monitor This little Car Battery Monitor provides an early warning of battery problems. It has seven LEDs to indicate the battery voltage and a piezo buzzer to warn when the voltage drops below 12V. By ALAN BONNARD A CLOSE CALL on the road can really focus your mind on the importance of having a battery monitor in a car. I had been enjoying a pleasant week of travelling around the countryside at a leisurely pace and taking in the beautiful scenery each day. It wasn’t until the final day, with the big rush to return home, that I had to drive at night. My home is deep in the country and on the road I was travelling the closest petrol station may be 80km away. I was travelling through an area that is full of open-cut coal mines and large heavily loaded semi-trailers constantly pound the roads, travelling at quite high speeds. It was around 8pm at night and everything was very dark – no street lights or house lights anywhere. Just as I was going up a hill, the lights began to dim and the engine coughed. A large semi-trailer loomed in the rear-vision mirror as I pushed the clutch in and tried to restart. My Where To Buy The Kit This project is copyright to Futurlec. It is priced at $12.90 plus $4 for postage and packing. It can only be purchased from: www.futurlec.com 74  Silicon Chip speed was falling rapidly and my lights were blacked out – I was like a sitting duck in the middle of the road, as the semi-trailer came rapidly bearing down on me. I just managed to pull the car off the road, as the semi-trailer came screaming past, missing me by inches! After calling for assistance from the NRMA, the problem was found to be a fault in the alternator, which was failing to charge the battery. The battery voltage had been falling under the heavy load of the lights and at the worst possible time, there was not sufficient power for the lights or the motor. After the initial shock wore off, I put on my thinking cap to come up with a PIC-based solution to the problem. What was really needed was a display and a buzzer, to get my attention should the voltage fall outside a specified range. So my design criteria was set, a series of LEDs could indicate the voltage and a buzzer would also be used to warn of problems. Circuit details The circuit is based on PIC16F819 18-pin microcontroller which has an analog-to-digital (A/D) input to monitor the battery voltage and outputs capable of driving LEDs directly, to keep the component count down. There are seven LEDs in all, giving a good range of voltage indication. The topmost LED, LED1, comes on for voltages above 14V which will occur when the battery is fully charged. LED2 indicates for voltages between 13.5V and 14V while LED3 indicates between 13V and 13.5V. Normally, one of these LEDs will be on. LED4 covers 12.5V to 13V while LED5 covers 12V to 12.5V. LED6 covers from 11.5V to 12V while LED7 comes on for voltages below 11.5V. These two LEDs are backed up by the piezo chime which beeps for voltages between 11.5V and 12V and becomes more insistent for voltages below 11.5V. That might seem fairly conservative. After all, most cars will start with no troubles, even though the battery voltage might be a touch below 12V, won’t they? Well, no. Some modern cars will happily crank the motor at voltages below 11V but their engine management will not let the motor start unless the voltage is above 11V. So don’t think that a modern car will always start reliably. This little battery monitor could easily prevent a very inconvenient failure to start! So let’s describe the rest of the circuit. The incoming supply is connected via diode D1 which provides protection against reverse polarity while zener diode ZD1 provides protection from spike voltages. A standard 7805 3-terminal regulator is then used to provide a stable 5V to the microcontroller. The battery voltage is sensed via a voltage divider using 33kΩ and 100kΩ resistors. This brings the voltage down to within the www.siliconchip.com.au Main Features • • • • Fig.1: the circuit is based on a PIC16F819 microcontroller. This provides A/D conversion of the battery voltage and drives the indicator LEDs. 0-5V range for the A/D input of the PIC16F819. Port B (RB0 to RB7) of the microcontroller is then used to drive the various LEDs, with current limiting provided via the 330Ω resistor network. RB7, pin 13, drives a switching transistor for the piezo buzzer. Software For the software, the design follows the basic template for a PIC microcontroller. Port A and its ADC (analog-to -digital converter) function are set up while port B functions as the output for the LEDs and buzzer. Once the set-up is complete, a reading will be taken at port RA2, the input for the A/D convertor. This reading is then compared with a series of values to determine the range of the voltage. This is similar to a series of “if” statements in Basic language. If the voltage is found to be within a certain range, the relevant port B pin will be turned on. If the voltage is below 12V, the buzzer will be turned on for a brief period, to signal a low www.siliconchip.com.au battery condition. As the voltage falls below 11.5V, the frequency of the beeps will increase, to signal increased urgency. Building it All the parts are mounted on a small PC board measuring 46 x 46mm (available from Futurlec). The starting point should be the IC socket for the PIC16F819, as this is easiest to mount Fig.2: here’s how to install the parts on the small PC board. Visual indication of battery voltage Audible warning when voltage becomes low Screw terminals for easy connection Simple and easy to build while the board is bare. The next item can be the PC terminal block. The resistors and capacitors can then follow. Make sure the electrolytics are inserted with correct polarity. Make sure that you do not confuse the zener (ZD1) with the diode when you are installing them; the diode is the larger package of the two. Even more important, don’t get the 78L05 3-terminal regulator and the 2N3906 transistor mixed up; they come in identical packages. The 78L05 will be labelled as such while the 2N3906 will be labelled “3906”. And make sure you insert them the correct way around. The buzzer must also be installed with the correct polarity. The 330Ω current limiting resistors are all in a 10-pin in-line package. There are four green LEDs, two yellow and one red. They need to be installed in line and with the correct orientation. Testing Before you insert the PIC16F819 microcontroller, do a voltage check. Connect a 12V source and check for the presence of 5V between pins 14 & 5 OF IC1. If 5V is not present, check the polarity of regulator REG1 and the polarity of the diode D1. If these tests are OK, insert the IC and test the unit over a range of voltage between 9V and 15V. Make sure that all LEDs come on in sequence and the piezo buzzer beeps for voltages below 12V. Now it is matter of installing the unit in your car. It is preferable to install the unit in a visible position for the driver. However, it should not obscure any other instruments. The unit should be connected to the car’s 12V supply after the ignition switch. This will turn the unit off with the other instruments and prevent battery drain while the motor SC is not running. December 2003  75