CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Measuring current draw from the battery

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
CMatic



Joined: 11 Jan 2012
Posts: 69

View user's profile Send private message

Measuring current draw from the battery
PostPosted: Fri Jun 13, 2014 4:23 pm     Reply with quote

I have a pic16F877A board running with 9V battery. How do I measure the current draw from the battery. When I use a multimeter to measure the current drawn from the battery, the board stops running the program. I am trying to figure out how I can measure the battery health when the circuit is operating.
Thanks in advance.
temtronic



Joined: 01 Jul 2010
Posts: 9204
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Jun 13, 2014 4:35 pm     Reply with quote

One method is to insert a very low ohm resistor and measure the voltage before and after it. Obviously you need some kind of resistive dividers and feed the signals into two analog channels.
Then there's a bunch of math, as YOU have to decide based on type of battery what is an acceptable 'low battery' flag since we have no idea what battery you're using, current draw, etc.
There are commerically available 'current meter' modules, fairly cheap that work as above.
Another method is to take a 'reasonable' load resistor and place it in parallel with the battery every so often and read the battery voltage. Again, you need to decide on voltage dividers and what is a 'low battery' condition.
I've used this method for the past 20+ years.

hth
jay
gpsmikey



Joined: 16 Nov 2010
Posts: 588
Location: Kirkland, WA

View user's profile Send private message

PostPosted: Fri Jun 13, 2014 5:07 pm     Reply with quote

As Temtronic says, you typically measure the voltage across a load resistor (which is what most multimeters do also - it is just internal to the meter). Depending on what your software is doing you may get odd readings - it may be jumping around depending on what the chip is driving (or if it is in low power mode part of the time). If it is doing the same thing, you may find the reading steady, but if it is doing different things, then you may have to add some filtering to your measurement to get the average (or look at the voltage across the load resistor with an oscilloscope). Ohms law will give you the current if you know the voltage and resistance. It also depends if you are trying to measure the current after your regulator or before it how it will act.

mikey
_________________
mikey
-- you can't have too many gadgets or too much disk space !
old engineering saying: 1+1 = 3 for sufficiently large values of 1 or small values of 3
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jun 13, 2014 5:11 pm     Reply with quote

Quote:
When I use a multimeter to measure the current drawn from the battery,
the board stops running the program.

This could happen if:

1. The fuse inside the multi-meter is blown. The fuse is used to
protect the current measuring circuit in the meter. It is very common
for these fuses to already be blown. All you have to do to blow it
is to connect the current measuring leads across a battery or power
supply. Result: instant blowing of a small (replaceable) fuse inside the meter.

2. You may not be connecting the meter to the board in the correct way.
You have to plug the red lead into the "ma" (milliamps) jack and the black
lead into the "COM" jack on the meter. Then you have to put the meter in
series with the power supply and the board:
http://www.cdn.sciencebuddies.org/Files/4808/6/fig7_multimeter-series-measure-current.jpg
and
http://www.talkingelectronics.com/projects/Testing%20Electronic%20Components/images/12v_batt_meter_lamp.gif
In each of these images, replace the lamp with your PIC board.
The images show the red lead connected to the "A" jack, but because
your PIC board will only be using a few milliamperes, you should connect
the red lead to the "ma" jack if your meter has one.
CMatic



Joined: 11 Jan 2012
Posts: 69

View user's profile Send private message

PostPosted: Fri Jun 13, 2014 9:18 pm     Reply with quote

Great discussion, thank you for your replies. Temtronic your two methods to measure the battery voltage were awesome. I will try these over the next few days. PCMProgrammer, as always your answers are so insightful and filled with details....I am so thankful. Gpsmikey thanks for your answers I will be using them also in the next day or so. Very Happy
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group