Battery Charge Current Sensing Using Hall Sensor

Status
Not open for further replies.

PICMICRO

New Member
I am trying to make a Battery Charger Using PIC16f877A. I will be PWM controlling the Charge Current.
I want to use Hall Sensor to sense the charge current. And I am using a Toroid Core with a break. Like this.

**broken link removed**

Some Problem I am facing are:
There are two things changing continuously,
I have an active PWM going on, so, It seems that I need to synchronize the ADC reading with the ON time of PWM.
But even with that, I have full-wave rectified current Flowing into the battery. It seems I need to know, at which point of the Sine-Wave Current am I taking the ADC reading?

I feel like I am off the track, and there may exist a simple trick to make things easier. What may it be?
 
Why are you using a hall sensor? Current shunts are far more practical, and simpler. Generally speaking if you simply chose one high quality resistor somewhere in the charge path direct reading of current is trivial.
 
Ok. Even with the current sense resister, I have problem because the current isn't a clean DC. Its full wave rectified AC? When in the AC cycle do I take the reading? To make matters more complicated, I am Doing PWM control of the Charge current.
So, I think, what exactly is used for sensing (sense resister/Hall Sensor) isn't the issue here.
BTW, I choose Hall sensor due to difficulty in finding high watt and accurate resisters. I need to measure some 20A.
 
You wouldn't use a high watt resistor, you use a precision shunt and amplify it, they're not difficult to find, you just have to run the output through a fixed gain opamp, I picked one up that will measure 25amps for just a couple dollars. Anyyyyyways, why are you PWM'ing a battery? They don't typically like that so I hope you're filtering the output, that would be the easiest way to measure it anyways just use a capacitor bank to filter the signal and sample it as fast as you can. What's the PWM frequency?
 
The fact that you are using PWM to control the charging current suggests that you are interested in the average current. If that's so, just make lots (256?) of measurements at random times over several mains cycles and average the measurements.
 
alec, depends on the PWM frequency, if it's very low, say a 500-1khz or so the PIC's ADC could probably manage but if it's higher than a few khz the ADC won't be able to sample fast enough to give a useful number.

Keep in mind that the average current will not be right either, pulse charging a battery with high currents increases heating loss and can damage the cell chemistry, not really enough information to determine if what PICMICRO is doing is safe or not.
 
depends on the PWM frequency, if it's very low, say a 500-1khz or so the PIC's ADC could probably manage but if it's higher than a few khz the ADC won't be able to sample fast enough to give a useful number.
Good point. So at high sample rates it's irrelevant whether the current is sensed using a Hall sensor or a resistor; the PIC simply can't measure it .
 
Thank you for your help. If PWMing is a bad idea, how else do I control the charge current? Linear Regulator would waste energy, which I don't want.
And another thing. If I use a RC filter to filter the voltage of the sense register, The voltage across the capacitor of the RC filter (which the ADC would read), would be the peak voltage, isn't it? (or the average?).
 
how else do I control the charge current? Linear Regulator would waste energy, which I don't want.
You could consider using an SMPS with an output voltage adjustable by the PIC to be a fraction of a volt above the battery voltage, feeding the battery via a current-limiting resistor which also acts as a sense resistor.
The voltage across the capacitor of the RC filter (which the ADC would read), would be the peak voltage, isn't it? (or the average?).
Depending on the filter it would probably be the average, unless the filter includes a series diode, in which case it could be the peak.
 
Thanks alec_t. You really cleared up my confusion.
Is it really that Bad to PWM charge my Lead Acid Battery, or may I try?
BTW, the battery is already old, so I don't much care about its life. But certainly, I don't want explosion.
 
It's inefficient, the higher charge current (even if it's in pulses) will cause more heating than the true average current being sent to the battery, the term is called I^2R losses because in a given resistance power dissipated goes up with the square of the current, The battery chemistry only ever sees the peak currents not the average current, also if the peak voltage it's receiving are too high it will kill the battery over time from sulfation. This can be partially solved by a good filter including a choke (inductor) and a large capacitor, but the voltages and currents you're talking about the filter components are going to be very large unless the PWM frequency is high. The higher you can get the PWM frequency the better and easier it will be to filter, pick a good FET and drive circuitry and you could PWM at 100khz or more, that becomes a lot more practical to filter at those currents.

I'm a little wary of the scope of the project you're taking on though as you said the curents are going to be as high as 20 amps, is that what you asume the average will be or the peak? If 20amps is the average then the peak is going to be large very hard to design for without a lot more details. you really need to flesh out your design a LOT more there are many things that need to be taken into account that we're just speculating on here without a LOT more details from PICMICRO.
 
Last edited:
Thanks sceadwian for your incredible information. 20 A is the average current. But thats the top limit, i.e. I never want average current to be greater than 20A. So, I am using external Circuits (Transformer and Bridge Rectifier), that gives only 20A (avg) even when the Duty Cycle is 100%. When I want currents less than 20A (avg), I will PWM at say 50% duty cycle. So, I see that the Pulse current can never go beyond 20A, so, why would it be a Killer ?
I am sorry, if I couldn't understand some of your points.
 
What is the AmpHour Capacity of the battery to be charged? What is the peak voltage from the charging circuit?
 
Last edited:
I don't know. Any expert views on this?

Most of the solar battery chargers from the last 10 years are PWM, even the MPPT models use PWM during some parts of the charging cycle to control current.

https://www.electro-tech-online.com/custompdfs/2011/12/820Why20PWM1.pdf

This is the current waveform (lower) from a hall sensor connected to the output of a C40 charge controller. 25A peaks at about a 200hz pwm frequency.
[video]http://www.flickr.com/photos/nsaspook/5986187132/in/photostream/[/video]
https://www.altestore.com/store/Cha...40-Solar-Charge-Controller-40A-122448V/p2070/
 
Last edited:
Why don't use an integrated Hall Sensor, like the ACS 750 from Allegro?

That offer galvanic isolation between Battery and the measure Output.
The average measurement can be done by an R-C filter on the measurement output.

The Price is comparable with good shunt resistors.

Only the noise at the output and the drift make some problems.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…