Automotive Voltage Monitor using PIC12F683

Description

Recently I got a new motorbike and on my second trip out, with only 50 miles on the clock the rectifier/regulator unit failed.Β  The battery on a bike is pretty small and with the head light permanently on and all the ECU, ignition and fuel injection stuff it didn’t take long to run the battery flat.Β  Fortunately I’d stopped and there wasn’t enough charge left to turn the engine over, but it’s possible for the battery to discharge and the bike to cut-out while riding – not good.

After a bit of research it became apparent that this type of failure is common, with the regulator either not charging the bikes battery, or overcharging it.Β  Despite the ECU monitoring the voltage it doesn’t generate any indication of a low voltage condition to alert the rider.Β Β 

This project aims to provide the rider with an early warning of a fault to the bikes battery/charging system by connecting to the electrical supply on the bike and continually measuring the voltage.Β  If it goes outside of programmed set points it alerts the rider by activating an LED.Β 

The design can be applied to cars as well as motorbikes and could also be used for other voltage monitoring applications.

Download schematic in PDF

Component values shown on the schematic are for operation with a 12 volt automotive electrical system.Β Β 

Circuit Description

Hardware

The circuit use a PIC12F683 microcontroller programmed with firmware (see download section) that measures the vehicle supply voltage using an Analogue to Digital Converter (ADC) and compares it to set voltage points, activating the bi-colour LED to alert the rider when the voltage goes outside the expected normal operating range.

The vehicle supply voltage feeds IC2, an LM2931AC-5.0, Low Drop Out (LDO) voltage regulator IC to power the microcontroller. This part is designed for use in automotive applications and can withstand load dumps and reverse transient.Β  There are several variants of this part, so make sure to get the β€˜AZ’ or β€˜AC’ variant as these have a +/-3.8% or 2.5% tolerance output.Β  Diode D1 protects the circuit from accidental reverseΒ polarity of the input supply voltage.Β  Capacitors C2 and C3 are required to stabilise the regulator as per the datasheet for the device.Β  The design uses a 47Β΅FΒ capacitor for C3, but a 22Β΅F part can also be used.Β 

Voltage Monitor

The LM2931 was chosen because it is designed for use on automotive electrical systems where the electrical supply is quite hostile.Β  For other applications the following devices could be used as an alternative to the LM2931.Β 

An LM78L05 is cheap and easy to find, it’s not ideal but should work. If you do use it, you can omit C3, but will need to replace C2 with a 1Β΅F / 25 volt electrolytic.

For a precision 5 volt LDO regulator look at the LP2950CZ-5.0, this will need a 1Β΅F / 25 volt electrolytic capacitor for C2 and 1Β΅F / 6.3 volt or 10 volt electrolytic for C3.

The status LED is a 5mm bi-colour common cathode part, We used an HLMP4000 part although any bi-colour LED should work here.Β Β  It should have a milky white or defused body since it needs to β€˜mix’ the red and green to get orange.Β  Clear LEDs don’t do this so well.

The PIC12F683 contains a 10-bit internal Analogue to Digital Converter (ADC) that compares the voltage on the AN2 input (Pin 5) with a reference voltage.Β  This design uses the Vdd 5 volt supply to the PIC as the reference voltage (Vref).Β 

Since the range of voltages in a 12 volt automotive system can go up to about 15 volts, and higher if the alternator regulator fails the input voltage needs to be scaled down so it falls within the range 0 to 5 volts when presented to the PIC.Β  This is done using a voltage divider comprising R1/R2 which are 1% precision resistors to help with accuracy.Β  There is an optional capacitor C4 which can be used to filter the input, however this isn’t used here.

Should the supply voltage exceed 20.16 volts the output from voltage divider R1/R2 will exceed 5 volts.Β  TheΒ  PIC has internal clamp diodes on the inputs connected to Vdd and Vss, the excess voltage will be clamped by the diode while resistor R1 limits current to just a few milliamps.

 

For more detail: Automotive Voltage Monitor using PIC12F683


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.