Voltage monitor for car battery


Closed Thread
Results 1 to 40 of 51

Hybrid View

  1. #1
    Join Date
    May 2007
    Posts
    66

    Default Voltage monitor for car battery

    Can one use the ADC converter of a pic to measure the voltage of a 12V car battery?
    I know one can use the ADC to monitor voltages on small batteries but I am scared of the high
    currents involved with a car battery.
    If one can use the pic itself, what additional measures should be put in place or should I rather
    go for a dedicated voltage transducer to monitor the car battery?

  2. #2
    Join Date
    Oct 2003
    Location
    holland
    Posts
    251


    Did you find this post helpful? Yes | No

    Default

    Yes you can, but first you have to lower the supply voltage for the picprocessor. This can be done by using a LM78L05 and some capacitors.
    Then you have to build a voltage divider for the measuring of the 12 volts, because the adc in the picprocessor may not come above the supply voltage.
    Say bluid a divider of 3 so that 4 volts measuring is 12 volts of the battery.
    In the software you can multiply than by 3 again.

  3. #3
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mat janssen View Post
    Yes you can, but first you have to lower the supply voltage for the picprocessor. This can be done by using a LM78L05 and some capacitors.
    I don't think that would work. The regulator will simply give you a 5v supply from the 12v battery, it will never fall below 5v because the car battery would never get this low. The simple way is to use a voltage divider made by connecting two resistors accross the 12v line and then connect the pic to the junction between the two.

    If you used a 58K and 41K with a 12v supply you would get 5v, however the state of a car battery is such that it's voltage will vary under charge and drain, so you would need to make allowances for that. You might find that under charge the voltage could be around 13.8v, falling to 10v under load.

  4. #4
    Join Date
    Nov 2005
    Posts
    51


    Did you find this post helpful? Yes | No

    Default

    use an op-amp set up has a devider you can then put upto 20v in and get 0-5v out and for safety tie a 5V zener diode to prevent damage to the pic or just a resistor devider

    I personal use op-amp has i can measure up to 60V

  5. #5


    Did you find this post helpful? Yes | No

    Default

    Hello. I've been using the attached circuit and the following code to measure the battery condition on a 12V sealed rechargable gell cell. The code goes like this:
    batterycondition var byte

    adcin 1, batterycondition
    if batterycondition < 192 then beep

    Perhaps tweaking the adcin value would work for lead acid. It may have a different discharge curve.
    Attached Images Attached Images

  6. #6
    Join Date
    May 2007
    Posts
    66


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by chuck View Post
    use an op-amp set up has a devider you can then put upto 20v in and get 0-5v out and for safety tie a 5V zener diode to prevent damage to the pic or just a resistor devider

    I personal use op-amp has i can measure up to 60V
    Chuck / Jerry

    Thanks for the advice! Could you be specific with regard to where the 5V zenere diode must be placed. (I'm rather new to electronics!)

    THANKS!

  7. #7
    Join Date
    Jul 2007
    Location
    Grass Valley CA
    Posts
    16


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by malc-c View Post
    I don't think that would work. The regulator will simply give you a 5v supply from the 12v battery, it will never fall below 5v because the car battery would never get this low. The simple way is to use a voltage divider made by connecting two resistors accross the 12v line and then connect the pic to the junction between the two.

    If you used a 58K and 41K with a 12v supply you would get 5v, however the state of a car battery is such that it's voltage will vary under charge and drain, so you would need to make allowances for that. You might find that under charge the voltage could be around 13.8v, falling to 10v under load.
    The OA didn't say use the regulator for the sensed voltage, but for the supply voltage. He also recommended a 3:1 voltage divider for the sense. Personally, I'd use a 4:1 because the car battery can get up into the mid-14 volt range with some charging systems.

    I have no idea where you get 58k and 41k resistors; these aren't standard RETMA values. I'd use a 100k and a 22k-10k variable in series to set the voltage accurately, or do some other tricks in software for calibration.

    Jim

  8. #8
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default

    passion1, Use a 10.2K 1% and a 2.55k 1% for the voltage divider. This gives you 25.00 volts full scale or a 20% division. I often use these values when not being concerned about the 1mA. current draw @ 12 volts.

    Dave Purola
    N8NTA

  9. #9
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    I will but in here
    I use a 3 to 1 divider to monitor my solar battery bank. Two 10Ks in series from (+) and one 10K from (-). if peak voltage is 15 you get 5. Voltage drops to 10, you get 3.3.
    This works for me.
    Dave
    Always wear safety glasses while programming.

  10. #10
    Join Date
    May 2007
    Posts
    66


    Did you find this post helpful? Yes | No

    Default

    Hi All

    Thank you very much for the advice!

  11. #11
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by weirdjim View Post
    The OA didn't say use the regulator for the sensed voltage, but for the supply voltage.
    Sorry, mis-read the post

    Quote Originally Posted by weirdjim View Post

    I have no idea where you get 58k and 41k resistors; these aren't standard RETMA values.
    Whislt not standard a quick google will show that they do exist, or simple enough to make up the value.

  12. #12
    Join Date
    Mar 2004
    Location
    UK-Midlands
    Posts
    84


    Did you find this post helpful? Yes | No

    Default

    Hi,

    Don't forget to suppress the voltage spikes! A cars electrical system can generate spikes easily above 50v. Try to take the measurement points as close to the battery as possible. Also damp the takeoff point from the resistor divider with a small capacitor (10uF). I would also use some inductors in the supply line to protect the regulator and PIC.

    Bob

  13. #13


    Did you find this post helpful? Yes | No

    Default

    I would suggest that you wire your battery monitor circuit the other side of the ignition switch. Otherwise, it will will be slowly draining the battery all the time it is connected - it is (reasonably) unlikely that you would want to monitor the battery while you are not in the car.

  14. #14
    Join Date
    Mar 2006
    Location
    Pennsylvania, USA.
    Posts
    130


    Did you find this post helpful? Yes | No

    Default

    I wired three 10K ohm resistors in series (because I had lots of 10K resistors!) to form a simple voltage divider. After double checking with a multimeter, I connected porta.0 of a 16f877 to the resistor node that was less than 5 volts, and used the following code to read and display the battery voltage;

    /code
    '************************ DEFINE ADCIN PARAMATERS
    Define ADC_BITS 10 ' Set number of bits in result
    Define ADC_CLOCK 0 ' Set clock source (Fosc/2)
    Define ADC_SAMPLEUS 50 ' Set sampling time in uS
    ADCON1 = %10001110 'Right justify, channel 0 is analog
    '*************************** END ADCIN SETUP
    adcin 0,bat_volts 'read battery voltage
    bat_volts = (bat_volts */500)>> 2
    lcdout $fe,$80+15,dec(bat_volts/100 *3),".",dec1 bat_volts
    /endcode

    Please note that the Pic itself is powered via a 7805 regulator as suggested in an earlier post, with appropriate capacitors, and a fuse just to be safe. I didn't use precision resistors, I didn't need great accuracy. You might add a zener diode for extra protection.

    I hope this helps get you started.

    Jerry.
    If your oscilloscope costs more than your car...

  15. #15
    Join Date
    Mar 2006
    Location
    Pennsylvania, USA.
    Posts
    130


    Did you find this post helpful? Yes | No

    Default Thanks Melanie!

    I did not know that about zeners. I like many others have been taught that a zener doesn't conduct until you reach or exceed the avalance voltage. After reading your post I pulled out one of my textbooks, which states that this is the case. I then put together a little test circuit, and just as you predicted, my 5.6 volt zener diode was conducting at right around three volts! I had always assumed they would be within twenty percent or so.

    Thanks again for sharing your hard won knowledge and experience.

    Jerry.
    Last edited by b1arrk5; - 6th August 2007 at 03:25. Reason: typo
    If your oscilloscope costs more than your car...

  16. #16
    Join Date
    May 2007
    Posts
    66


    Did you find this post helpful? Yes | No

    Default

    Hi Everyone

    Thank you for EXCELLENT advice!

  17. #17
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,611


    Did you find this post helpful? Yes | No

    Wink some more practical details ...

    Hi, Passion

    we just had forgotten the reverse diode ( 1N400x) from regulator output to its input ...

    to be fully "bullet-proof" ... ( see 78L datasheet ...)

    But ... , If some LCD (or LEDs ) are used as a display ( we didn't talk about that ...) , that could make you need a 7805 instead of the 78L05 ( in all cases will improve the 5v ref voltage stability ... see output impedance of the 78L series vs. 78 series ... )

    Alain

    PS: No, it's not the LCD that will draw current .... but it's backlighting !!!
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  18. #18
    Join Date
    Apr 2006
    Location
    New Hampshire USA
    Posts
    298


    Did you find this post helpful? Yes | No

    Smile latest from the circuit committee

    I am still playing with Paint.net to draw the occasional schematic for the forum.
    Here is the latest from the circuit committee.
    Put a fuse in place of the input resistor. Added the wrap around diode.
    I am learning to not put values onto the schematic. Then people can discuss different values and the schematic does not change.
    <img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=1918&stc=1&d=118650657 1">
    The entire drawing was drawn in the paint.net (freeware) program, anyone have a better way to go?
    -Adam-
    Attached Images Attached Images  
    Ohm it's not just a good idea... it's the LAW !

  19. #19
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,611


    Did you find this post helpful? Yes | No

    Default

    Hi, Adam

    Did you try that : http://www.diptrace.com/downloads/dipfree_en.exe

    ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  20. #20
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,588


    Did you find this post helpful? Yes | No

    Default

    I've been going through the thread and trying to plug values and names on all the components discussed so far. Keeping detailed information out of the picture is fine and dandy for a discussion, but it doesn't help me when I save the pic in my schematics folder for future reference.

    I could use help with D1 and Z1, zener is not enough for a noob like me.

    I've used a LD1084 5V 5A 'cause I don't know exactly how much current I will need for the final application (backlighting is a hog). I also have a LD1085 ADJ 3A voltage regulator standing by in case I can get away with a smaller model, both of these are automotive grade and available at DigiKey.
    Attached Images Attached Images  
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  21. #21
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    For D1 a 1N54xx should work. It is rated at 3 amps.
    http://www.onsemi.com/pub_link/Collateral/1N5400-D.PDF
    Or if you do have to go with a 5 amp circuit then a MR75x at 6 amp rating.
    http://www.onsemi.com/pub_link/Collateral/MR750-D.PDF

    For the zener... That is to protect the regulator from a higher voltage than it is designed to handle on the input. If you regulator can handle say 35 volts then a 22 volt zener would work, but what are the chances of the voltage going over 35 in a car? Z1 may not be needed. IMO
    Dave
    Always wear safety glasses while programming.

  22. #22
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,588


    Did you find this post helpful? Yes | No

    Default

    Dave, I took the vocational progam through high school so yeah (switched to computers in college), I agree my '92 Jimmy will not generate 35 V, under normal circumstances. But that's the problem, car parts have been known to fail and cause the most unusual effects.

    If I can decipher all the sensor signals as planned, I will be spending a lot of time and energy on this project. I've already invested time and money as it is. If a potential problem only has a 0.01% chance of happening and it DOES occur, I'm gonna be one very ******ed off person if I skimped on a $2 safety component. I can afford a zener, it's not like I'm trying to survive on a student budget living in the boondocks (although that doesn't seem that far in the past ).

    I also have ZNRs and a few other types of surge/clamping devices on hand that I've ordered for other projects, I'm just not sure what rating I should use. But since the voltage regulator is supposed to handle up to a maximum of 30V, I assume it would be wise to use something that would start clamping at 15-20V. That way I'd stay away from pushing the voltage regulator to the extreme rating.

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

Similar Threads

  1. Battery pack cell reader
    By steiner in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 9th March 2008, 07:41
  2. Expanded Scale Voltmeter
    By Pic_User in forum Schematics
    Replies: 6
    Last Post: - 8th February 2008, 21:32
  3. Help with final project
    By OvERKiLL in forum General
    Replies: 4
    Last Post: - 15th December 2006, 21:35
  4. Measuring Battery voltage
    By BobP in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 4th December 2006, 00:07
  5. Help with setting adcon1 for 16f877
    By jessey in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 16th August 2005, 12:13

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts