Making best used of ADC resolution for reading battery voltage

Discussion in 'The Projects Forum' started by axeman22, Oct 5, 2009.

  1. axeman22

    Thread Starter Active Member

    Jun 8, 2009
    53
    0
    Hi,

    trying to make a PICAXE circuit which does a few things(not shown) but also monitors the battery voltage by way of taking a reading on the ADC0 input. The voltage divider network I have seems ok. The 14M has 1024 bits of ADC so resolution should be good. From my readingthe voltage on the ADC cannot exceed Vcc for the Picaxe chip so max voltage ever presented no higher than 5V. With the divider network I have 13Volts at the battery should present 5 volts at ADC0. given that the batery will nevr be below 10Volts unless it's dead I would like to make a circuit which gives me the ability to do an offset zero voltage reading. i.e zero Volts at ADC0 input equals 10 Volts battery boltage and 5 Volts ADC0 input equals 13 volts battery voltage. This way I can make maximum usage of the ADC resolution in the practical measuring range required.

    all things being equal I plan to make the LED flash in accordance with the battery voltage reading - i.e. display battery voltage in morse code or similar.

    appreciate all ideas!

    Thanks,

    Ian
     
  2. JDT

    Well-Known Member

    Feb 12, 2009
    658
    85
    I assume that your ADC input goes between 0 and +5V.

    I would start by putting a simple voltage divider across your 12V supply. Lets assume that both resistors in this divider are equal. Also assume, to keep things simple, that you want to monitor the battery voltage between +10 and +15V. The output of the divider over this range will be +5 to +7.5V.

    Lets construct an inverting amplifier with a gain of 2 (strictly an amplifier with a gain of -2). Reference it to +5V. It's output swing with an input of +5V to +7.5V will be +5V to 0V. (Input swing +2.5V, output swing -5V)

    The equivalent output resistance of your potential divider when both resistors = R will be R/2. So, you can combine your potential divider and the inverting amplifier input resistor.

    Producing the final complete circuit. All the resistors are equal! Wow!

    Of course the ADC input voltage is "upside down" but that's easy to sort out in software. The fact is you will probably have some thresholds for battery "high", "normal", "poor", "runout", etc. These are just binary numbers after all!

    See the attached diagram.

    Edit: to get your amplifier output to go up to +5V, the amplifier power needs to come direct from the battery.
     
    Last edited: Oct 5, 2009
  3. MikeML

    AAC Fanatic!

    Oct 2, 2009
    5,450
    1,066
    Also, remember that the ADC reading is ratiometric with respect to the 5V Vdd. The accuracy of the ADC reading is no better than the accuracy of the 5V reference. Depending on your accuracy requirements, you might need a more precise 5V supply than just a typical LMxxx05.
     
  4. kcarring

    Member

    Jan 22, 2011
    38
    0
    I am also trying to put together such a circuit. Quite surprised there are so few links, you'd think a few more out there would be using PICAXE to monitor battery voltages and do actions, with results... anyway...

    Mike: Do you mean that the LMxxx05 reference, itself, will drop, while the battery drops? Are you suggesting that the power supply for the PICAXE be constant voltage with buck boost?

    In my situation I hope to (eventually) have a circuit that will "aim" my solar charge controller at multiple battery banks, deciding which "bank" needs a charge, the most. Eventually I would have a microprocessor do load shifting to the best available bank, too.

    If you are wondering why... I get a lot of free batteries (A LOT). Thousands of dollars worth. DEcommissioned deep cycle cells from radio communication towers; they get swapped out on a routine schedule - not based on their condition. So they are very useful to me, and it saves me THOUSANDS of dollars.

    Problem is, it doesn't make sense to just "gang 'em up, as they arrive"...
    They vary in capacity, and condition. After desulphation most are very serviceable, but that doesn't mean I want to just start "paralleling them" till the cows come home - that has proven to not work out well.

    Thanks for any help.

    To keep things simple I think I must tackle the monitor aspect first and forget the rest; that will come later.

    So, I need to?
    1. Learn the voltage divider circuit, and test it to make sure I am -never- sending higher than 5v to the ADC input?
    2. Make sure that the PICAXE always has a steady voltage, via a constant voltage supply?

    Is this the logical start?

    Thanks
     
Loading...