Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Automatic Battery Charger Help Needed

Status
Not open for further replies.

Okada

Banned
Joined
Jun 16, 2016
Messages
1,159
Helped
129
Reputation
252
Reaction score
128
Trophy points
63
Activity points
0
I am designing an Automatic Battery Charger using PIC16F73. I am using a 9-0-9V 5A transformer for it. I will be designing a Buck Converter. The input voltages to the Buck Converters are as below.

The input voltage range to the transformer (230V to 9-0-9V 5A) is 170V to 245V

230V to 24V (9-0-9V)

N = Vsec/Vpri = 0.0783

Vsec = N * Vpri

Vsec(L) = 0.783 * 170 = 13.311

Vsec(M) = 0.104 * 245 = 19.1835

Vpk(L) = 13.311 * 1.1412 = 18.82

Vpk(M) = 19.1835 * 1.4142 = 27.13


So, my voltages are above 14.4V needed for boost charging and 13.8V used for trickle charging.

How should I proceed further ? PWM duty will be adjusted to get boost voltage and trickle charge voltages but how to detect the voltage needed to be applied to the battery that is 14.4V or 13.8V ?

I am designing like this.

When battery is not connected or battery is removed then charging stops and there will be no output voltage.
When battery is connected, it will measure the battery voltage and if battery voltage is less than 10.4V then charger will start in boost mode and while charging if battery voltage reaches 13.8V then charger will shift to trickle charge mode.

Is this method correct ?

I am using ACS712 5A type to monitor the battery current. If high current is drawn then charger will be switched off.

There will be saftey fuses.


Here is the rough schematic. I have not yet calculated the buck converter inductor and capacitor values.

- - - Updated - - -

This is the mosfet I will be using. This is the best mosfet I found.

FDP8860

or

STI260N6F6

or

STP260N6F6

Very low Rds(on) < 0.003 Ohms

My charging current will not exceed 2.5A.

So, power dissipated in mosfet

Pd(mosfets) will be 2 x 2.5 * 2.5 * 0.003 = 37.5 mW
 

Attachments

  • Battery Charger.PDF
    39.3 KB · Views: 122
Last edited:

Consider to increase C1 to at least 4700 µF.
 
  • Like
Reactions: Okada

    Okada

    Points: 2
    Helpful Answer Positive Rating
@FvM

Ok. Done.

I am trying to get information about charging current for 12V and 6V (max 12Ah) batteries but not getting.

What is the safe charging current for 6V and 12V max 12Ah batteries for boost charging and trickle charging ?

ADC interface circuit resistor values have not yet calculated. Here is new schematic. There was a mistake in 5V power Led connection. Have fixed it. Also I have to calculate Buck Inductor and Capacitor values.

This charger should be able to charge both 6V and 12V SLA batteries.

- - - Updated - - -

Edit: Sorry, the post got updated.

Please check the latest simulation. Also attached schematic in PDF format and simulation video without battery connected.

PWM and LO signal levels are correct but HO and VS signals are not correct. Why ? I still have to find the values of Buck Inductor and Capacitor. I am just checking the signals.
 

Attachments

  • Battery Charger.PDF
    40.4 KB · Views: 130
  • Automatic Battery Charger.rar
    248.7 KB · Views: 151
Last edited:

Hi,

What is the safe charging current for 6V and 12V max 12Ah batteries for boost charging and trickle charging ?
Manufacturers of high qualitiy batteries provide thos informations in the battery datasheets. Or they provide global battery information on their web site.

Another good place for informations:

Klaus
 
  • Like
Reactions: Okada

    Okada

    Points: 2
    Helpful Answer Positive Rating
Last edited:

This is the final circuit. Buck Inductor and capacitor values have been calculated. PWM frequency is 84 KHz. I couldn't reduce this frequency.

Peak to Peak output ripple voltage is 50 mV.

Required current is 3A.

27.13V has to be dropped to 14.4V.

PWM duty is 53%.

Now I am writing code for the Automatic Battery Charger.
 

Attachments

  • Battery Charger.PDF
    40 KB · Views: 88

The question I am going to ask now is related to this project only and hence I am asking it in this thread only.

I changed the Modfet to IRFP054N because its Rds(on) is 12 mOhms and easily available.

No I couldn't find out the pinout of this Mosfet. Please provide the pinout of this Mosfet.
 

Hi,

No I couldn't find out the pinout of this Mosfet.
--> usually the first hit on any internet search "IRFP054N datasheet"

Klaus
 

The problem was not in finding the datasheet. I have the datasheet but it doesn't show the pinout. I need to know which pin is G, D and S.
 

Hi,

--> IR-datasheet --> Package outline drawing --> bottom right corner
--> Infineon-datasheet --> Package outline drawing --> right box --> Lead assignment --> HEXFET

Klaus
 
  • Like
Reactions: Okada

    Okada

    Points: 2
    Helpful Answer Positive Rating
Thank you Klaus. I found it after you mentioned it.
 

I had to change the PIC16F73 to PIC18F26K22 I/SP because I needed 84 KHz PWM and I/SP version of the PIC can run at 64 MHz (E/SP version runs at max 48 MHz). I checked the datasheet of the PIC18F26K22 but couldn't find the equation for calculating min and max PWM frequency for a given FOSC. Please direct me to the equation.

I read at microchip forum that if higher PWM frequency and also higher pwm resolution is needed then higher clock frequency has to be used. I am using ECCP module.

I require these PWM duties.

Buck PWM duties

6V battery

Boost Charge = 48% to 24%

Trickle Charge = 46% to 26%

12V battery

Boost Charge = 96% to 48%

Trickle Charge = 92% to 46%

- - - Updated - - -

Here I found this.

https://www.microchip.com/forums/m913239.aspx

min PWM frequency and max PWM frequency are

Fosc/16384 and Fosc/1024

So,

I can have PWM in the range of

64000000/16384 = 3906.25 Hz

and

64000000/1024 = 62.5 Khz

What should I do ? I need 84 KHz for my buck Converter for 100 uH and 68 uF buck inductor and capacitor values. I am not getting 4A or higer Ampere rated inductor for other inductance values.
 

Problem solved. Got 1mH 2.3A Inductor from coilcraft.

Here are the calculations.

Buck Inductor and Capacitor and PWM frequency Calculations

Inductor choosen 1mH 3A

Max Charging current of 12V 12Ah battery is 10% of rated current = 0.1 * 12 = 1.2A

Peak to Peak ripple current = 30% of max Charging Current, Imax * 0.3 = 1.2 * 0.3 = 0.36A

Vin(max) = 30V

Vout = 14.4

PWM frequency = (14.4V * (30V - 14.4V)) / (0.36A * 30V * 1mH) = 224.64/0.0108 = 20800 = 20.8KHz

Capacitor Value = 0.36A / (8 * 20mV * 20800Hz) = 0.36A/3328 = 108.1731 uF

Capacitor selected is 100 uF 35V and 10uF 35V in parallel

Tpwm = 48.0769us

PWM Resolution = log10[4 * (PRx + 1)] / log10(2) = log10(4 * 96) / log10(2) = 8.5849625 bits

8.58 bits = 2^8.58 = 384

98% of 384 = 0.98 * 384 = 376.32

To get 14.4V Output from 30V input PWM duty will be

D = 384 * Vout/Vin = 384 * 14.4/30 = 184.32 = ~184
 

I am posting in this thread because the question is related to this same project. I had mentioned that I had changed PIC18F to dsPIC33 but now I cahnged the MCU to dsPIC33FJ128MC802. I tested LCD and ADC part and they are working fine but the PWM part is not working. Attached it the Project. Also included Proteus file and Schematic in PDF format.

I am testing in real hardware. I was waiting for my dsPIC33 development board. Today I received Easy 24-33 v6 development board from mikroElektronika. I tested the project on it and I am getting incorrect PWM frequency. I am using PWMx_Mc_Y() library of mikroC PRO dsPIC. If I use PWM_X() library then I don't get any PWM but if I use PWM motor control library then I am getting incorrect PWM frequency.
I need just one 100 KHz PWM because Inductor value has been calculated as 100 uH 10.1A which is easily available. I can't change PWM frequency now. PCB Layout is being designed for the project.

Can't I get 100 KHz and 500 KHz (I need 500 KHz PWM for another project) from dsPIC33FJ128MC802 ?

I am using XT, HS, EC / w PLL

Crystal is 10 MHz and HS is selected as AOSC type.

80 MHz is the FOSC.

You can see from the picture that PWM frequency is 26.9 KHz.
 

Attachments

  • LCD Test dsPIC33FJ128MC802 RevB.rar
    211.7 KB · Views: 60
  • DS1Z_QuickPrint23.png
    37.6 KB · Views: 98

I am referring dsPIC33FJ128MC802 revision G datasheet but it doesn't show which pins are OCx pins. Please tell me in dsPIC33FJ128MC802 which pins are OC1, OC2, OC3 and OC4 pins. I am using SPDIP package dsPIC33.

- - - Updated - - -

I made these changes but still getting 26.9 KHz PWM instead of 100 KHz.

Code:
pwm_duty = PWM1_Mc_Init(100000,1, 1, 0);

- - - Updated - - -

I think Oscillator PLL configuration is incorrect. I have not configured any registers related to Oscillator in the code but only selected HS PLL in project settings. Now in the device datasheet page no. 145 mentioned that input to PLL VCO should not be more than 8 MHz but my HS Crystal is 10 MHz. So, how to configure oscillator to get 80 MHz Fosc ?


Also in the datasheet oscillator section I read that a 1 M Ohms resistor has to be connected across crystal but there is no 1M Ohm resistor in parallel to crystal on my Easy 24-33 v6 development board.
 

I have referred device datasheet page no. 143 to 152 and have done these configurations but still not getting the correct PWM frequency of 100 KHz for 80 MHz Fosc.

I am getting now 34.0 KHz PWM.

Code:
OSCCON = 0b0011001110100000;
CLKDIV = 0b0000000000000000;
PLLFBD = 0b0000000000100110;
ACLKCON = 0b0010111110000000;
OSCTUN = 0x00;

I am now using 8 MHz Crystal

It is divided by 2 to get 4 MHz for the input of VCO. It is then multiplied by 40 to get 160 MHz which is in the valid range of 100 Mhz to 200 MHz and this is further divided by 2 to get 80 MHz Fosc.

Where is the problem in configuration ?

I can't measure the Fosc because it is internal and also my Rigol OScope can only measure 50 MHz. Crystal is Ok.
 

I don't understand how you are setting the oscillator configuration. The regular way would be to select crystal oscillator with PLL in the configuration bits, but your configuration words select FRC in FOSCSEL. Changing the configuration at runtime in OSCCON requires an unlock sequence, I wonder if you are actually performing it.

You can read the OSCCON state at runtime with a debugger.
 

I can't write to CONFIG words because mikroC doesn't give access to Config words. I can only configure Oscillator registers. Sorry, I forgot to post the picture in my last post. Here is the picture. It shows Oscillator settings.

These are the new configurations.

Code:
OSCCON = 0b0011001110100000;
     CLKDIV = 0b0000000000000000;
     PLLFBD = 0b0000000000100110;
     ACLKCON = 0b0010111110000000;
     OSCTUN = 0x00;
 

Attachments

  • Osc Config.png
    Osc Config.png
    36.3 KB · Views: 91
Last edited:

O.K., I read the configuration words wrongly, the correct mode is already selected. Means only CLKDIV and PLLFBD must be written (if different from default value).
 

I don't know what is default value at POR. I just read the datasheet and configured those registers. I think 80 MHz Fosc is not generating and I can't test it because my Rigol Oscope is limited to 50 MHz. I need to get 100 KHz PWM to complete the project. Other things are working.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top