PIC based mAh meter/current draw sensor


Closed Thread
Results 1 to 7 of 7
  1. #1
    skimask's Avatar
    skimask Guest

    Default PIC based mAh meter/current draw sensor

    Got a new one that'll keep track of how much current a small circuit draws and logs totals. I'd guess you'd call it a 'battery gauge' or 'mileage meter' for a batter pack.
    Looking for a better idea...if one exist's...
    The idea I've got just to measure circuit draw, not battery pack before the regulator draw, now goes like this:
    I get a 5v switch-mode regulator (LM2825 type thing) with an external V sense line, run the regulator output thru a low ohm resistor (.001, .01, .1 ohms, how low is low enough? depends on max current draw I suppose), the regulator's external V sense line goes on the circuit side of the resistor.
    Measure the voltage on both sides of the resistor with the ADC with respect to Batt- (with a divider if need be and add that current draw to final result), apply a little Kirchoff's and Ohm's law, do the math, and done...I got current draw. I then integrate time into the equation and get mAh (limited by the resolution of time and the ADC and accuracy of the regulator and resistor).
    Am I done?
    In fact, it would be kinda nice to throw this in-line with most other projects on the bench just to see what they pull...

  2. #2
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,796


    Did you find this post helpful? Yes | No

    Default

    May be I did not got it right, but why make it so complicated?

    You need current flow, so from the 0 point input to your regulator put the shunt resistor with an op-amp and then the ADC. Even better, Analog has such current sensors already made with op-amps and the rest in one chip (AD8210).

    You don't have to mess with the regulation loop of the regulator and sense lines. Work on the input directly after your rectifier/capacitor.

    Ioannis

  3. #3
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Ioannis View Post
    You need current flow, so from the 0 point input to your regulator put the shunt resistor with an op-amp and then the ADC. Even better, Analog has such current sensors already made with op-amps and the rest in one chip (AD8210).

    You don't have to mess with the regulation loop of the regulator and sense lines. Work on the input directly after your rectifier/capacitor.

    Ioannis
    I don't think it's complicated, but that's just me...and I want to get to experience with this type thing anyways. I know Analog and National and a bunch of other have chips, just plug and go and you're done...again, I want to play a bit.
    And I pulling power out of a battery pack, no rectifier
    Basically, I guess I'm looking for confirmation that I'm on the right track.

  4. #4
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,796


    Did you find this post helpful? Yes | No

    Default

    Ok. No matter what your source is, bat or line power. You need to measure the current flow so, it is easier to do it before your regulator. In this case you do not mess with the output voltage regulation and everything is much simpler.

    Of course this has the drawback that measurment would include also the regulators own consumption. But if you know it, then it can be subtracted or do not bother at all if it is << that output current.

    I have to state that I tried that way and because of the components needed, a one chip solution is much more accurate, elegant and is working either at + or ground rail. But then, it is just me!

    Ioannis

  5. #5
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Ioannis View Post
    Ok. No matter what your source is, bat or line power. You need to measure the current flow so, it is easier to do it before your regulator. In this case you do not mess with the output voltage regulation and everything is much simpler.
    Of course this has the drawback that measurment would include also the regulators own consumption. But if you know it, then it can be subtracted or do not bother at all if it is << that output current.
    I have to state that I tried that way and because of the components needed, a one chip solution is much more accurate, elegant and is working either at + or ground rail. But then, it is just me!
    Ioannis
    I smell what you're cooking (understand what you're getting at, picking up what you're laying down, and so on, I could keep going but I won't )...

    I'm just looking at getting some comparison readings between running at various clock speeds down to the built-in 37khz (32, 40, whatever) oscillator for a few keyfob type devices. If I take the current readings while running off of 5v and then switch the circuit over to a coin cell, the current draw should drop on a fairly decent curve following the voltage. That way I can keep track of mAh's (uAh maybe?) used in the keyfob and flash and LED in a slightly different pattern during activation to indicate that the battery is probably near EOL and will need changing, and if this works, I can keep the whole thing buried inside the same PIC in the keyfob without adding another chip.

  6. #6
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,796


    Did you find this post helpful? Yes | No

    Default

    Hmm, what you are trying to achieve has already been included in the Keeloq devices of Microchip.

    That is what I use now instead of the old coding chips or soft-coded scheme.

    But, the current flow is not the key factor in this case. It is the voltage level and the keeloq devices that is exactly what they measure.

    More, current is a little more difficult to measure when you don't have linear consumption. Keyfobs are pulsing current out of the battery, so you have somehow to integrate the measurements and find the actual average current flow.

    But I insist on that you need to measure the voltage level only and you will be more that good.

    How will the result be indicated is another matter. Either locally on the LED as you stated or remotely by another indicator with battery state transmitted by the keyfob.

    Ioannis

  7. #7
    Join Date
    Jul 2005
    Posts
    93


    Did you find this post helpful? Yes | No

    Default

    I find the max4172 is a simple way to meter current.

Similar Threads

  1. Need a cheap touch sensor idea.. here it is
    By mister_e in forum Code Examples
    Replies: 20
    Last Post: - 16th April 2016, 23:42
  2. Talking Clock (Pic Based)
    By Art in forum General
    Replies: 2
    Last Post: - 20th January 2012, 15:45
  3. PIC water sensor
    By The Master in forum Off Topic
    Replies: 28
    Last Post: - 24th October 2008, 19:29
  4. how to connect ac sensor to PIC ?
    By iugmoh in forum Schematics
    Replies: 3
    Last Post: - 1st June 2008, 19:35
  5. Serial Pic to Pic using HSER
    By Chadhammer in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 12th March 2005, 00:14

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