View previous topic :: View next topic |
Author |
Message |
sharat68
Joined: 28 Oct 2010 Posts: 4
|
Problem with ADC |
Posted: Mon Nov 29, 2010 4:17 pm |
|
|
Hi,
I'm building an intelligent battery charger to charge Ni-MH, Ni-Cd and iPod (Li-Ion) batteries for my final project. I'm using the PWM of the PIC16F877A in order to vary the duty cycle of the MOSFET in my buck converter to get different charging currents. The PIC controls the charging stages using the analog voltages of the battery measured with the PIC. The converted ADC battery voltage is displayed on an LCD.
I used a voltage divider with the battery in order to limit the current into ADC of the PIC. Initially, I tried to read the battery voltage directly at the point between the two resistors of the voltage divider, but my readings shown on the LCD were all over the place and it was not stable. I was using the standard Vref+ as 5V and Vref- as ground. I realized when testing separately that when I connect the negative terminal of the battery to ground, it gives me the correct stable voltage. However, the problem is that in my design I cannot ground the negative of the battery terminal, as it will affect the rest of my circuit. Anybody have an idea of what I should do?
The link to my schematic is:
http://img638.imageshack.us/img638/8562/ece445batterychargersch.jpg
The battery and the voltage divider is in the top right. I'm using resistors 3.9 K and 14.93 K ohms.
Thanks a lot.[/img] |
|
|
gpsmikey
Joined: 16 Nov 2010 Posts: 588 Location: Kirkland, WA
|
|
Posted: Mon Nov 29, 2010 4:51 pm |
|
|
I would consider changing the design of the buck converter/drive to it so that the negative of the battery was grounded. Having both ends of the battery floating at some intermediate voltage just makes life difficult (as you have discovered). You also need to make sure your voltage sampling is synchronized with the switching so that you are measuring the voltage at the same time each time. It has been a while since I looked at charging circuits, but it seems to me that some of those chemistries are fairly critical on charge level detection (not a big change signals "full").
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 |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9241 Location: Greensville,Ontario
|
|
Posted: Mon Nov 29, 2010 5:44 pm |
|
|
I can't really see the schematic well....however... with a floating battery you could measure the +ve side with one analog input, then measure the -v of the battery with another input. Subtract the two and the difference should be the battery voltage.
Also be aware that any noise, EMI, etc. will wreck havoc with your measuring. That buck convertor will need filtering, power supply lines as well. Careful attention to grounds and returns are important.
I prefer good old linear supplies for battery charging, they are very, very quiet and easy to monitor for charging current and voltage levels.
Yes, 'old school', but it's well proven and quick to implement. |
|
|
sharat68
Joined: 28 Oct 2010 Posts: 4
|
|
Posted: Mon Nov 29, 2010 10:47 pm |
|
|
So I changed my buck converter design so that the ground is at the negative battery terminal and I'm able to read the correct stable voltage now. However, I ran into another problem. Now that I changed my design, I need to use a high-side driver for my MOSFET. The one I'm trying to use is the IR2117. I connected it the way it says in the data sheet. But, I'm not getting anything in the output of the driver. I'm not sure if it is even turning on. Any idea of what's wrong?
Here's the datasheet:
http://electronix.org.ru/datasheet/InternationalRectifier/IR2117.PDF |
|
|
gpsmikey
Joined: 16 Nov 2010 Posts: 588 Location: Kirkland, WA
|
|
Posted: Mon Nov 29, 2010 11:52 pm |
|
|
I can't get the datasheet to load, however, you just have to verify the gate drive looks good, then move on to checking the output. I assume you have a scope available to look at the output (or a voltmeter if you are at a low enough switching rate).If you are switching fairly fast, but want to slow it down to measure the signals with a voltmeter for example, change the clock frequency so it is slow enough to measure voltages. Put a dummy load across it if necessary so you can see switching.
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 |
|
|
gpsmikey
Joined: 16 Nov 2010 Posts: 588 Location: Kirkland, WA
|
|
|
|