Trying to determine dc current - 12v lead acid battery charger


Closed Thread
Results 1 to 32 of 32

Hybrid View

  1. #1
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default Re: Trying to determine dc current - 12v lead acid battery charger

    Quote Originally Posted by tasmod View Post
    Hank,
    I'm getting old I just don't get this. I've modded the board to have the .47 (not.047 as i put above) in series to the ground line and put a 100k to the adc input as per the schematic from the link above. This uses a 16f876 and I've duplicated the adc input circuit. They are claiming up to 10amp and with 10mA resolution.
    It's pretty simple...let me try & explain.

    If your PIC is running at 5V, then you're ADC resolution becomes 5V/1024 (the 1024 being 10 bits)...this results in a resolution of 0.0048828125V (4.9mV) per ADC bit, which sounds great, but not if your sense resitor is very small & therefore the maximum voltage drop will be very small. So at 1000mA & a .47 ohm resistor, your maximum voltage drop will be .47V across it (V=IR). ) .....so if you PIC has the aformentioned resolution of 0.0048828125V, then the maximum ADC reading you'll get is .47V/0.0048828125V ...or a max reading of 96 ...that's with 1A flowing (that's an awful lot of wasted bits, bearing in mind you've got 1024 bits available in your PIC).

    To get more resolution, if the PIC is modern & has a P-ref register for the ADC module (16f1828 etc)....you tell the PIC that rather than use 5V as the upper limit for the ADC, to use an internally generated fixed 1.024V instead (again the PIC needs to be up to date & have one onboard) - there are no more components involved, you just need to set a register in the PIC & you're off to the races.

    Now your ADC resolution becomes 1.204V/1024 bits ....or 1mV per ADC bit, therefore with 1A flowing through the sense resistor, your maximum ADC reading will be 470 which is a lot healthier amount of 'reading' to play with.

    Of course if you want up to 10A, then this is not the way to go (but I thought you were talking of 1A max?)

  2. #2
    Join Date
    Dec 2011
    Location
    IO93ok
    Posts
    190


    Did you find this post helpful? Yes | No

    Default Re: Trying to determine dc current - 12v lead acid battery charger

    Thanks Hank,

    That all makes perfect sense and is what I believed and kinda saw all along.

    I'm therefore puzzled by the circuit and claims for the above of 10A and 10ma resolution. This using a 16f876 which is the smaller brother of the 16f877 I have in the circuit.

    I've read the datasheets. Looked at the circuit, there's nothing different to what I'm doing. I see no offset input, it has no internal 1.024v ref, I'm also now in the ground line with the .47.

    This isn't the first circuit I've seen setup this way which claims 10A measurement with 10ma resolution but also using a 16f877. With 1023 bits to play with "it does not compute Captain"

  3. #3
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default Re: Trying to determine dc current - 12v lead acid battery charger

    Quote Originally Posted by tasmod View Post
    Thanks Hank,
    This isn't the first circuit I've seen setup this way which claims 10A measurement with 10ma resolution but also using a 16f877. With 1023 bits to play with "it does not compute Captain"
    It is kind of correct..... 10mA through a 0.47R resistor = 0.0047V drop across it (which, if you look back above the above posts, with a 5V ADC reference & 1024 bits, you can resolve 0.0048828125V per ADC bit)

    the spec seems to have changed a little though ...I'd thought earlier on you were speaking of 1000mA being your maximum anticipated current ...if that were the case, then 10mA resolution didn't strike me as being that granular....however if 10A is to be your max current, then 10mA of resolution is just dandy! So I guess you need to bottom out your requirements & take it from there.....

  4. #4
    Join Date
    Jan 2011
    Location
    Sydney, Australia
    Posts
    173


    Did you find this post helpful? Yes | No

    Default Re: Trying to determine dc current - 12v lead acid battery charger

    Hi Rob,

    If you plan to increase the maximum current from 1 Amp to 10 Amps then I would suggest that you change the value of the shunt resistor due to power handling ratings. 10 amps flowing through a 0R47 shunt resistor will need a hi power resistor (P=I^2 x R = 47 Watts).

    Your circuit shows the original 0R1 shunt resistor power rating as only 3 watts which has a theoretical limitation of just under 5.5 amps.

    Cheers
    Barry
    VK2XBP

  5. #5
    Join Date
    Dec 2011
    Location
    IO93ok
    Posts
    190


    Did you find this post helpful? Yes | No

    Default Re: Trying to determine dc current - 12v lead acid battery charger

    Thanks Guys,

    I probably confused you a bit.

    The 1000mA unit is the one already built which i wanted to upgrade to 5amp later. It used a .1 ohm resistor in the positive output which I removed and linked out. I then added a .47 in the ground leg.

    I then intended to design and build a multi function charger/desulphator unit which would probably be capable of 10amp.

    I would be quite happy with 10mA resolution on any of them. It's just that the counts I'm getting from the ADC just don't seem right anyway.

    I have another new 16f877 which i will test out.

    I mentioned the advertised unit because of it's specs and it's circuit. 3W .47ohm resistor in ground leg with 10amp measurement ? Capable of recalibration to greater amps?
    Probably a catchpa in the instructions when you get it.

    Rob

  6. #6


    Did you find this post helpful? Yes | No

    Default Re: Trying to determine dc current - 12v lead acid battery charger

    As Barry pointed out, if you use a 0.47 ohm shunt and are planning to draw 10 amps through it, the resistor will need to be rated for at least 47 watts!!! Thats a lot of wasted power!! And one big honking resistor! What you may need to do is supply a Vref for the ADC that is lower than Vcc and use a smaller shunt resistor. Or put an op-amp across a smaller shunt resistor to amplify the difference. You may need to drop the shunt down to 0.01 ohm in order to get a reasonable sized resistor. That would be a 1 watt resistor. If you drop Vref down to about 1V, then should be able to get 1 mV resolution. With a 0.01 ohm shut, that would give you about 100 mA per step. So you may still need to use an op-amp if you want better resolution.
    Tim Barr

  7. #7
    Join Date
    Dec 2011
    Location
    IO93ok
    Posts
    190


    Did you find this post helpful? Yes | No

    Default Re: Trying to determine dc current - 12v lead acid battery charger

    I've looked at a shunt that I have for a 100A meter which I can use.

    Out of interest today I programmed the code that fratello posted and tried it on my board after changing the lcd defines etc.

    RESULT !

    Well, the voltage code is incorrect BUT the current code works just fine. Now if only I could get my head around the language used

Members who have read this thread : 0

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