Rules | Recent posts | topic RSS | Search | Register  | Log in

Intelligent battery charger circuit
Goto page Previous  1, 2, 3, 4  Next
 
Post new topic  Reply to topic    EDAboard.com Forum Index -> Microcontrollers
Author Message
wizpic



Joined: 23 May 2004
Posts: 324
Helped: 22


Post12 Dec 2007 20:37   Intelligent battery charger circuit

you can use a better routine for A/D conversion, I have one that read 1MV resalution, Sure this would be a better way of doing it.

I've yet to build this charger,

Dexter I persume that you use PWM for the outputs is that HPWM or the 10bit PWM ?

wizpic
Back to top
Dexter Dude



Joined: 26 Oct 2007
Posts: 45
Helped: 1


Post13 Dec 2007 7:12   Re: Intelligent battery charger circuit

There is no need for more resolution .Tried with 8bits resolution and it is working for more then 2 elements .I increase the resolution so only one element could be used.

I do no use HPWM , just some carefully timing for ON and OFF periods .The result is a signal like this :
http://pierre.rondel.free.fr/reflex.htm .

Do you have a link(s) for that better routine for AD conversion ? .Right now I am experimenting with such AD routines but this one (AN700) seems to work the best .
Back to top
wizpic



Joined: 23 May 2004
Posts: 324
Helped: 22


Post13 Dec 2007 21:57   Intelligent battery charger circuit

I have no link it's my own routine I made

It is done in Proton I tajke you said yours was done in PBP ?

wizpic
Back to top
Dexter Dude



Joined: 26 Oct 2007
Posts: 45
Helped: 1


Post14 Dec 2007 6:31   Re: Intelligent battery charger circuit

My AD routine was done in .asm but used in a PicBasic program.I tried a PWM based AD in PicBasic but I was getting only 8Bits of resolution and a conversion time of approx 100ms . The .asm routine takes only 20ms for 10bit resolution. My current project is an PIC16F628A thermometer (using 3X1n4148 diodes as sensors) .I am trying to figure out how to implement two ADC using internal comparators of PIC16f628. Also the speed of conversion is important .
Back to top
wizpic



Joined: 23 May 2004
Posts: 324
Helped: 22


Post14 Dec 2007 19:19   Intelligent battery charger circuit

I did not think that the 16f628 has A/D converter ?

I know it can be done by other means but sure it would be better to use a pic with A/D converter on it.

That's what I like about Proton you can do 10bit PWM easily and the A/D conversion is very quick
I'll PM it you if you like to have a look at it

wizpic
Back to top
RenatoBR



Joined: 25 Feb 2007
Posts: 24


Post15 Dec 2007 15:50   Re: Intelligent battery charger circuit

Hi All,

Dude, my charger did not work yet.
Now I'm using the correct parts like your project except for the 2k5 pot that is not comercial use here in Brazil.
I got one with 3k that measured 2.56k on my DV Fluke 189, I'm using this pot now.
For BC173 I'm using BC549 that is equivalent.
I put a display in the circuit.
Making a correct calibration with Realterm and display inserted in the charger:

If pot totaly closed, Realterm show that big number for mv like 6000 to 7000 or so and display pulse the letters E and A.
IF I open totaly continue the same.
Wath I need to do, open the pot +- 3/4, power up the charger and then is possible to make a calibration, but display only show E.

If I try to calibrate only using the display it show E, not change to I.

I have cheked all the components, circuit and changed LM 317, 1N5401, IRF530 and inserted more capacitors on LM 7805.
I did a test without pic inserted like your procedure and it's ok.

Do you have voltages on pins pic during the calibration?
May you share your pcb lay out?
As told you, I'm using a protoboard.


Rgds


Renato
Back to top
Dexter Dude



Joined: 26 Oct 2007
Posts: 45
Helped: 1


Post15 Dec 2007 18:58   Re: Intelligent battery charger circuit

Hello .
If you power up the charger with no batt in it will display E A .

Let' try a different calibration method :
1. First burn the PIC with "charger calibrate.hex" .Use the configuration bits mentioned before .
This is a stripped version of the charger program .It only enables to measure(Delta Sigma ADC using comparators) the voltage across charger's outputs (using RealTerm ).LM317 is "put to sleep" and the discharge is OFF .

2. Connect 1 2 3 or 4 batt. to the charger . Also connect an Digital Voltmeter on charger Output (Cathode of 1N5401 diode)
Adjust the 2k5 POT till readings from DV and RealTerm match .An error of adjustment of less then 90mV is quite OK (pot allows a brute adjustment )

3. Remove the batteries .The Realterm should display a value approx between 700mV-945mV or 70-90 units.(If you have 0.773V on DV then you must read 773mV in Realterm .)

4. If you succeeded so far then the calibration is done

5. Finally. Burn burn the PIC with "charger SAR 10 fin.hex" .Use the configuration bits mentioned before .

The hex files and the PCB is here :
http://depositfiles.com/files/2721725
Back to top
RenatoBR



Joined: 25 Feb 2007
Posts: 24


Post15 Dec 2007 22:51   Re: Intelligent battery charger circuit

Tank you Dude,

Before this new procedure I have made one more test with the display:

Calibration on RealTerm, inserted one battery and power up the charger.
The display showed I and then 0 (discharging).
After finished the discharge the display showed I for some seconds and S for one second +- and then the letters E and A.
It's not start charging again.

I have measured some voltages on pins 2 and 17:

Pin 2 - 4.34 to 4.40v. and 4.39 to 4.45v.
Pin 17 - 2.51 to 2.52 and 2.51 to 2.52v.




Renato
Back to top
Dexter Dude



Joined: 26 Oct 2007
Posts: 45
Helped: 1


Post16 Dec 2007 7:48   Re: Intelligent battery charger circuit

"The display showed I and then 0 (discharging). " <- detect one element (measure a voltage between 1V-1.95V).


"After finished the discharge the display showed I for some seconds and S for one second +- and then the letters E and A. " <- Battery IN and start Slow Charging

I think you may have a loose connection (between charger and batt. ).The charger display E A only when senses a voltage lower than 0.925V witch is lower than discharge voltage /element .
Back to top
RenatoBR



Joined: 25 Feb 2007
Posts: 24


Post16 Dec 2007 14:21   Re: Intelligent battery charger circuit

Not working,

Unfotunately the new procedure didn't work, I have made several tests.
Discharged till 0.9v, show: I then S for a second and then E/A.
Sure I have problem with the ADC, but I don't konw how to resolve it.
I'm using 2.56k pot. and and 2.17k resistor measured on my DV, can I choose another value for resistor to make a test?

I think you may have a loose connection (between charger and batt. ).The charger display E A only when senses a voltage lower than 0.925V witch is lower than discharge voltage /element .

I believe no bad conection, where can I test if the voltage is correct to start charging?


Renato
Back to top
Dexter Dude



Joined: 26 Oct 2007
Posts: 45
Helped: 1


Post16 Dec 2007 17:20   Re: Intelligent battery charger circuit

Something is very wrong with your charger . I Removed the PIC from charger and took some voltage measurements :

yours
Pin 2 - 4.34 to 4.40v. and 4.39 to 4.45v.
Pin 17 - 2.51 to 2.52 and 2.51 to 2.52v.

Mine:
Vcc=12.00V
Pin 2(RA3) - 395mV
Pin 17 (RA0) - 405mV
Charger output : - 856mV



If you don't obtain similar voltages (and all the components are good) I think you mounted one ore more components the wrong way . My guess from this measurements and your measurements : check the orientation of 1n4148 diode (diode 1n4148 from Vdd to 100nF capacitor ) .
Vdd=5V Vdiode=0.65V -> 5-0.65~ 4.4V on Pin2

"I'm using 2.56k pot. and and 2.17k resistor measured on my DV, can I choose another value for resistor to make a test? "

Re: Values from 1K to 10K for POT and resistor will be fine. Try to use lower values in order not to disturb the ADC accuracy .

If you want to learn more about this type of charger check this page :
http://www.angelfire.com/electronic/hayles/charge1.html
Back to top
RenatoBR



Joined: 25 Feb 2007
Posts: 24


Post16 Dec 2007 21:15   Re: Intelligent battery charger circuit

Voltages measurement without pic on the circuit:

Pin 2 <- 338 mv
Pin 17 <- 339 mv
Output <- 803 mv

Is it within the acceptable range?

Added after 17 minutes:

Notice:

Using PIC16F628A and IC-Prog 1.06A to burn the PIC.

Configuration:
IntRC I/O On
Boden On
Back to top
Dexter Dude



Joined: 26 Oct 2007
Posts: 45
Helped: 1


Post17 Dec 2007 7:28   Re: Intelligent battery charger circuit

"Not working,
Unfotunately the new procedure didn't work, I have made several tests. "

Please give more details .ADC readings are OK , or ADC not working (when using
charger_calibrate.hex) .


I made some tests .The ratio between (Charger output) / Voltage on Pin 17) should be 2.1:1 . So if you have 0.803V -> adjust Pin 17 to 0.382V .
Back to top
RenatoBR



Joined: 25 Feb 2007
Posts: 24


Post17 Dec 2007 13:21   Re: Intelligent battery charger circuit

"Please give more details .ADC readings are OK , or ADC not working (when using
charger_calibrate.hex) ."

The charger calibrate worked very wel, but the charger only discharge, not charge.
After finished the discharge the display showed I for some seconds and S for one second +- and then the letters E and A.

"I made some tests .The ratio between (Charger output) / Voltage on Pin 17) should be 2.1:1 . So if you have 0.803V -> adjust Pin 17 to 0.382V ."

OK, I'm doing this right now, I'll post the results here.

Yesterday night I have made a crazy test:
Put one cell in, power up the charger and turn the pot slowly to left and right until display showed 1 and after S and then H.
I know this is not a correct way.
Afetr chargin some minutes I power off and power up the charger, but this time it starts dischargin.


Renato




Renato
Back to top
RenatoBR



Joined: 25 Feb 2007
Posts: 24


Post20 Dec 2007 0:10   Re: Intelligent battery charger circuit

Hi Dude,

I got the same problem with this new procedure, discharge and then E A on display.
I have built the PCB, made a calibration test using this method:

"I made some tests .The ratio between (Charger output) / Voltage on Pin 17) should be 2.1:1 . So if you have 0.803V -> adjust Pin 17 to 0.382V ."

Again the same problem, discharge and not charge.

I have used D1 D2 that are on the right on layout conected to two resistors 27k as the schematic.
On lay out the D2 is conected to ground and on schematic D2 is conected on +5v,
wich one is correct?
I conected on +5v. like the schematic.


Renato

Added after 5 hours 22 minutes:

One more test:

Changed diodes D1 D2 from right side to left side of the board, got the same results, only discharge.
Took some voltages on the center of the pot at the end of the discharge (one cell
on the charger): 0.63/0.64volts, is it normal?
Voltage on the cell at the end of discharge: min. 0.932v.
During the time the diplay showed I (after discharge) the voltage cell goes to 1.072v and then S and then A E.



Renato
Back to top
Dexter Dude



Joined: 26 Oct 2007
Posts: 45
Helped: 1


Post20 Dec 2007 16:52   Re: Intelligent battery charger circuit

"I have used D1 D2 that are on the right on layout conected to two resistors 27k as the schematic.
On lay out the D2 is conected to ground and on schematic D2 is conected on +5v,
wich one is correct?
I conected on +5v. like the schematic. "

You were right .D2 was connected the wrong way. I updated the PCB layout .Check new link. I also take a "snapshot" of my PIC using IC Prog 1.06 and "read all" command .The hex file obtained is called " read from my PIC.hex" and it is an exact copy of my PIC16F628A software .I pulled out my PIC from charger in order to make this "snapshot " .Then I re-programed the PIC using " read from my PIC.hex" .The charger worked fine.

http://depositfiles.com/files/2777470




"During the time the diplay showed I (after discharge) the voltage cell goes to 1.072v and then S and then A E."

I seems that ADC is working but something is wrong with LM317 BC173 (or BCxxx) and/or devices close to them. I think LM317 is pumping way to much current.Remove the PIC from socket and check if LM317 is putting ~265mA(you used an 4.7ohm resistor . 1.25V / 4.7 ohm = 0.265mA. To start the LM317 you could connect Pin15(RA6) to GND (PIC removed from socket) .This way BC173 turns off => LM317 turns ON.

The charger displays E A only when batteries where removed while charging (the voltage output rises to Vcc-2.5V where 2.5V=Voltage across LM317 => it senses a high voltage => turns off LM317 and checks again for batteries ) or batteries where connected , charging started but voltage on batteries rises above safe level (LM317 trouble).
Back to top
RenatoBR



Joined: 25 Feb 2007
Posts: 24


Post21 Dec 2007 1:19   Re: Intelligent battery charger circuit

OK Dude,

I'll check everything.

Before reading your message I was doing some tests:

Diodes D1 D2 on the left side of the board.
Resistor 1.25R - using 2.2R
Resistor 0.8 - using +- 0.5R
For pot 2k5 and resistor 2k2 - have changed several times with values 2k2 and 1k
for pot, and 1k, 1k2, 0.8k for resistor.
For each change I make calibration on pin 17 without pic on circuit, this calibration is easy to make and is precise.
Battery, I'm using one NIMH.
In all tests, the charger only discharge, not start charging

Then I tried with four cells NIMH:
Now the good news, worked perfectly, discharge and start chargin.

To confirm I have made a new test with four old NICD from celular, and again very good, discharge and charge completely until display showed F (final).

Now let's go to work on charging one cell each time.
Thanks Dude, you are helping a lot.



Renato

Added after 3 hours:

More good news,

With two NIMH cells the charger works without problem, discharge and start charging.
Dude, if the charger is working well with two or four cells, do you think it has problem in components and because this itīs not possible to charge one cell?

I measured the current on charger output without pic on circuit and found 580 mA (using resistor 2.2R), for me is OK.

"The charger displays E A only when batteries where removed while charging (the voltage output rises to Vcc-2.5V where 2.5V=Voltage across LM317 => it senses a high voltage => turns off LM317 and checks again for batteries ) or batteries where connected , charging started but voltage on batteries rises above safe level (LM317 trouble)."

Is it possible to measure this voltage on output charger?
Back to top
Dexter Dude



Joined: 26 Oct 2007
Posts: 45
Helped: 1


Post21 Dec 2007 7:38   Re: Intelligent battery charger circuit

In my chargers LM317 puts out 0.887V when it is OFF .In you case , your LM317 puts 100mV less (0.77V ) .I 'v adjusted in software this limits :
- less then 0.92V => charger has no batteries attached
- higher than 0.92V => charger has batteries attached
- ~1V voltage to discharge 1 element.

In my case this limits are closer together (0.92 and 0.877 ) , so I need to do a precise adjustment of POT .I think you could decrease a little (10-50mV) the voltage on Pin 17 .I guess your charger discharges a little to much and can't sense the battery attached to it anymore.If you use 2 to 4 batteries this error of adjustment in 2 to 4 times lower and so the charger works properly.

PS: After the charge completed ( display F or P ) you should let the batteries in charger for 1-2 hours to trickle charge them.This way the batteries reaches 100% charge every time and also equalize the packs and blast the crystals dendrite formed on batteries.


Last edited by Dexter Dude on 21 Dec 2007 19:31; edited 1 time in total
Back to top
zubyk



Joined: 19 Dec 2006
Posts: 5


Post21 Dec 2007 14:52   Re: Intelligent battery charger circuit

Akkuloader with an ATmega16

Added after 59 seconds:

www.avr-asm-tutorial.net/akkuload/en/index.html
Back to top
RenatoBR



Joined: 25 Feb 2007
Posts: 24


Post21 Dec 2007 18:56   Re: Intelligent battery charger circuit

My charger output is now 0.800 to 0.804 and pin 17 is set to 0.382V.
Increasing pin 17 voltage is not safe, battery has discharged until 0.82v. and I stopped test.
I have tried several times changing this voltage.
When and how the pic senses the battery voltage?
Is it after discharging when display is showing I?

If no possible to increase the charger output or changes in your source code, my circuit never will charge 1 single cell.


Renato
Back to top
Dexter Dude



Joined: 26 Oct 2007
Posts: 45
Helped: 1


Post21 Dec 2007 19:54   Re: Intelligent battery charger circuit

"Increasing pin 17 voltage is not safe, battery has discharged until 0.82v. and I stopped test. "
* My bad .Sorry .I meant decrease not increase , in order to discharge to a higher voltage(1.05V for example ) and charger still detect only one batt. .

Prepared a new hex .This one sets discharge limit for 1 element to approx. 1.1V .For 2 to 4 elements previous limits where used .This will provide enough space between battery_in_limit and discharge_1_element_limit.The discharge will be more gently but still effective .

LinK:

http://depositfiles.com/files/2791708
Back to top
RenatoBR



Joined: 25 Feb 2007
Posts: 24


Post22 Dec 2007 1:00   Re: Intelligent battery charger circuit

Excellent job Dude,

Have charged two times 1 cell using the 1.1v. hex and minimum gap was 1.055 volts.
For 2 cells the minimum gap was 1.89 volt, here is a risk to have 1 cell with gap around 0.8v., depend the charge of each one still has before discharge.
Back to top
Dexter Dude



Joined: 26 Oct 2007
Posts: 45
Helped: 1


Post22 Dec 2007 7:21   Re: Intelligent battery charger circuit

Safe voltage to discharge one element is 0.9-1.1V .If you use battery packs ( same type of batteries in the pack ) there will be no problem at all .Glad to help .
Also if you like , you could connect a LED with a resistor (470ohm) between Pin16(RA7) and GND to monitor the discharge pulses .
Back to top
RenatoBR



Joined: 25 Feb 2007
Posts: 24


Post22 Dec 2007 11:45   Re: Intelligent battery charger circuit

Do you have a version of this charger that only charge without dischargin?
I use only NIMH cells for my flash SB 800 and radio Sony short wave and dischargin NIMH before charging each time is not necessary.

I have built the charger from the link below:

http://www.oshonsoft.com/picchargerlcd.html

It has a LCD wiht many options: charge, discarge, cycle, setup default, other type of setup with many options like: min. discharge, max. time, gap on/off, gap mv and more.
This is a good one charger, but for normal use I prefer one simple like your project.



Thank you Dude,


Renato
Back to top
pico



Joined: 30 Sep 2001
Posts: 261
Helped: 6


Post22 Dec 2007 12:05   Re: Intelligent battery charger circuit

wizpic wrote:
so dexter you going to share code or not

we understand if you say no

wizpic

You can study from microchip's application note and source code.

http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1999&ty=&dty=§ion=&NextRow=&ssUserText=picref-2
Back to top
Dexter Dude



Joined: 26 Oct 2007
Posts: 45
Helped: 1


Post22 Dec 2007 19:15   Re: Intelligent battery charger circuit

"Do you have a version of this charger that only charge without dischargin? "

No , I did not but now I do .Here it is .You need to connect to RA5(Pin4) a 10k resistor and an ON-OFF switch ( not a push button) .

- If the switch is closed ( RA5 is low ) then the charger will skip the discharging faze.
- If the switch is open (RA5 is high ) the charger will perform as usual ( discharge and then charge )
And this is the hex file:
http://depositfiles.com/files/2803292
Back to top
wizpic



Joined: 23 May 2004
Posts: 324
Helped: 22


Post22 Dec 2007 22:27   Re: Intelligent battery charger circuit

pico wrote:
wizpic wrote:
so dexter you going to share code or not

we understand if you say no

wizpic

You can study from microchip's application note and source code.

http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1999&ty=&dty=§ion=&NextRow=&ssUserText=picref-2


I asked that som time bacj and many posts after you say that, I've already seen that article, I use Proton and was wondering what Dexter wrtoe his in, Has I want to build a bigger vesrion of it of it, And I asked dexter if he would not mind sharing code but he never answered the question, like I said I would understadn if he did not want to, a yes or no woudl be fined instead of been ignored Very Happy

I just wnated to know how to control the HPWM in realation to the charging voltage by using the A/D routine and then sending it out to control the LM317 and the mosfet. I ready know how to send out the RS232 signals and use excel to dispaly the data so you can see the charge/discharge curves and get a better picture on how it performs.

I will be starting this design in the new year and I suppose I will find out then

cheers

wizpic
Back to top
RenatoBR



Joined: 25 Feb 2007
Posts: 24


Post22 Dec 2007 23:24   Re: Intelligent battery charger circuit

Hi Dude,

Tank you for the new HEX, I'll test it next week.
I'm facing two problems with the charger.

1- If battery is near 1 volt the charger not start, display show E A (no bat inserted), in this case I need to charge a little bit in another charger and then put back to start the charger.

2- The charger only charge for about one and half hour and then the display show P (peack failed).

I have tried 3 times with diferent NIMH with 1 single cell each time.
Charger generation 580 mA/H


Renato
Back to top
wizpic



Joined: 23 May 2004
Posts: 324
Helped: 22


Post22 Dec 2007 23:50   Intelligent battery charger circuit

You could now make this charger really advanced by adding a menu with 3 buttons say up/down/enter
menu listings
1. charge only
2. discharge then charge.
3. battery test. (this is where you can discharge the battery first then charge it up then set timer going to let the battery settle then set of another timer and record the time it take to dishcharge it then once completed do a conversion and work out the actual battery capacity and see if it's good at holding it's charge or it's coming to the end of it's usefull life.
4. calibate voltages
5 (it could be never ending.

I know it might be going over the top by chaging to a PIC16F873 and adding an LCD but at least you can display more info and like I siad even upload data into excel and plot it onto a graph.

I would go this way when I have ago at doing it this way you have a all in one unit battery charger/tester

wizpic
Back to top
RenatoBR



Joined: 25 Feb 2007
Posts: 24


Post23 Dec 2007 1:54   Re: Intelligent battery charger circuit

Wizpic,

You have all this options and more in this charger

http://www.oshonsoft.com/picchargerlcd.html


Renato
Back to top
Post new topic  Reply to topic    EDAboard.com Forum Index -> Microcontrollers
Page 2 of 4 All times are GMT + 1 Hour
Goto page Previous  1, 2, 3, 4  Next


Abuse
Administrator
Moderators
topic RSS 
sitemap