Automatic PWM Battery Charger 12V-24V

Introduction

If you’re looking to make an automatic PWM battery charger for your 12V or 24V battery, it’s not as difficult as it sounds. First, you’ll need a few components – all of which you can easily purchase online. Once you’ve got everything ready to go, start by setting up the circuit board and then connecting the transformer to the rectifier bridge. After this, wire up the filtering capacitor and input trimmer potentiometer before moving onto the operational amplifier stage. Finally, connect the output stage – consisting of MOSFETs – to the voltage divider before testing your device with a multimeter. And that’s it! You now have a fully functioning automatic PWM battery charger capable of handling both 12V and 24V batteries.

In this video I have made an Automatic PWM Battery Charger using Arduino. This battery charger can charge 12V or 24V battery. It can automatically detect battery voltage and set charging parameters according to battery and start charging the battery, the system also has leds to display battery level. I hope you will enjoy this video. Gerber files and circuit diagram is given below.

Auto PWM Battery Charger 12V 24V Thumbnail

Circuit Diagram

of Automatic PWM Battery Charger

Auto PWM Battery Charger 12V 24V Circuit Layout
Auto PWM Battery Charger 12V 24V Circuit Layout




More Circuit Layouts






Auto PWM Battery Charger 12V 24V Circuit Diagram

Working Explanation

of Automatic PWM Battery Charger

Today we are going to make an automatic battery charger, an automatic battery charger is a charger which stops charging the battery when battery is fully charged. The automatic battery charger we are going to make uses PWM (Pulse Width Modulation) technique to charge the battery. This charger can be used with both 12V or 24V batteries, the charger has an auto battery detect feature. The supply voltage for this charger can be 30V to 40V. If we only want to charge 12V batteries we can use minimum 15V supply. First we connect the input supply to the charger the we connect the battery the charger automatically detects battery voltage and start charging the battery. We have used an Arduino to give the intelligence to the charger. The Arduino generates the PWM signal to its pin D9. The duty cycle of PWM signal varies according to battery voltage. The PWM duty cycle is inversely proportional to battery voltage, meaning if battery voltage goes above to the reference the PWM duty cycle decreases, and if battery voltage goes below to the reference the PWM duty cycle increases. The steps to build this charger.

An Arduino is used to control the duty cycle of PWM signal and to read the battery voltage, five IRFZ44 MOSFETS are used and connected parallel to each other means connect their pin number 1 of all the MOSFETS to each other, their pin number 2 to each other, and their pin number 3 to each other , a PC817optocoupler is used to isolate the Arduino and MOSFETS the optocoupler is connected to the pin d9 of Arduino which generates thePWM signal, a schottky diode is used to isolate the battery positive from the input positive, a buck regulator is used to convert the battery voltage to 5V to supply the Arduino MC34063 IC and a few more component are used to make the buck converter all the connections and components are given is the circuit diagram, a 2 pin terminal block is used as input terminal, we can give 15V to 40V at the input, another 2 pin terminal block is used for the output terminal, 6 LEDs are used to indicate the battery level, 74HC595 is is used to control the LEDs. A voltage divider is made with a 47K resistor and a 5K trimpot resistor to reduce the battery voltage to give the ADC of Arduino. I have made PCBs for the project you can find circuit diagram, Gerber files, component list and Arduino code below.



Programming Code

of Automatic PWM Battery Charger

int i,data,pwm,bat,b,tmp;
float vo,cutoff,on;
void setup() {
pinMode(2,OUTPUT);
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
TCCR1B = TCCR1B & B11111000 | B00000001; // Set PWM frequency for D9 & D10:
Serial.begin(9600);
}
void loop(){
for(int j=0;j<3;j++){
vo=analogRead(A0);
vo=vo*.1;
bat=bat+vo;
for(int i=0;i<7;i++){
if(i>7)i=0;
led(i,1);
if(i>0)led(i-1,0);
delay(100);
}
}
bat=bat/3;
if(bat<16){
cutoff=14.4;
on=13.8;
b=12;
}else {
cutoff=28.8;
on=27.6;
b=24;
}
Serial.println(bat);
delay(2000);
while(1){
led(0,0);
led(1,0);
led(2,0);
led(3,0);
led(4,0);
led(5,0);
i++;
if(i>7)i=0;
led(i,1);
if(i>0)led(i-1,0);
vo=analogRead(A0);
vo=vo*.1;
if(vo>cutoff)pwm--;
if(vo<on)pwm++;
if(pwm<0)pwm=0;
if(pwm>100)pwm=100;
if(b==12)tmp=1;
if(b==24)tmp=2;
if(vo>b)led(0,1);
if(vo>b+(.4*tmp))led(1,1);
if(vo>b+(.8*tmp))led(2,1);
if(vo>b+(1.2*tmp))led(3,1);
if(vo>b+(1.6*tmp))led(4,1);
if(vo>b+(2.2*tmp))led(5,1);
Serial.print(b);
Serial.print("V Battery ");
Serial.print("output volt ");
Serial.print(vo);
Serial.println("V");
analogWrite(9,pwm);
delay(500);
}
}
void led(uint8_t pin,bool val){
bitWrite(data,pin,val);
digitalWrite(2,LOW); //latch pin low
shiftOut(3,4,MSBFIRST,data); //shiftOut(datapin,clockpin,LSBFIRST/MSBFIRST,data);
digitalWrite(2,HIGH);
}

Components List

of Automatic PWM Battery Charger

  • 1 X Arduino Nano
  • 1X MC34063 IC
  • 5X IRFZ44 MOSFETs
  • 1X PC817 Opto Coupler
  • 1X MBR4040 Diode
  • 1X 1N5819 Diode
  • 6X LEDs
  • 1X 5K Trimpot
  • 1X 1 OHM Resistor
  • 7X 100 OHM Resistors
  • 1X 3.3K Resistor
  • 3X 10K Resistors
  • 1X 47K Resistor
  • 1X 1nF Capacitor
  • 1X 470uF Capacitor
  • 1X 1000uF Capacitor
  • 2X 2PIN Terminal Block
  • Female And Male Headers
  • Jumper Wires
  • GERBER FILE



More projects, You may like:

(Visited 666 times, 1 visits today)

1 comment on Automatic PWM Battery Charger 12V-24V

Leave a Reply

Your email address will not be published.