This article show how to make a simple Arduino Battery Charger Circuit.
Charger stop and start charging using MOSFET.
Arduino read battery temperature with TMP36 sensor and decide safe charging.
Circuit is simple and work with basic components.
Arduino Coding:
int tempPin = A1;
int mosfetPin = 9;
float voltage = 0;
float temperatureC = 0;
void setup() {
pinMode(mosfetPin, OUTPUT);
digitalWrite(mosfetPin, LOW);
}
void loop() {
int sensorValue = analogRead(tempPin);
voltage = sensorValue * (5.0 / 1023.0);
temperatureC = (voltage - 0.5) * 100.0;
if (temperatureC < 40) {
digitalWrite(mosfetPin, HIGH);
} else {
digitalWrite(mosfetPin, LOW);
}
delay(500);
}Code Explanation:
- tempPin store A1 pin number.
- mosfetPin store D9 pin number.
- Arduino read analog value from TMP36.
- Convert reading to voltage using 5 divided by 1023.
- TMP36 give 0.5 volt at 0 degree so subtract 0.5.
- Multiply by 100 to get degree Celsius.
- If temperature is less than 40C then MOSFET is ON and battery charges.
- If temperature is more than 40C then MOSFET is OFF and battery stops charging.
Circuit Working:

Parts List:
| Part Name | Specification | Qty |
|---|---|---|
| Resistors | 10k ,10Ω 10 watt | 1 each |
| Capacitor | Electrolytic 1µF 25V | 1 |
| Semiconductors | MOSFET IRF510 | 1 |
| Temperature Sensor TMP36 | 1 | |
| Battery Holder AA Size | 1 | |
| Rechargeable Battery NiMH AA | 1 | |
| Arduino Uno | 1 |
Arduino get 5 volt from USB power.
Temperature sensor TMP36 give analog voltage to Arduino pin A1.
Arduino read this value.
If temperature is below safe value then Arduino output goes HIGH to gate of IRF510.
IRF510 switches ON and allow current to battery through R2 resistor.
Capacitor C1 make sensor reading clean and stable.
If temperature go high then Arduino output goes LOW and MOSFET switches OFF and charging stops.
Battery connect to circuit using two wires as shown in circuit diagram.
Ground of Arduino, battery, sensor MOSFET all are common.
How to Build:
To build a Arduino Battery Charger Circuit follow the below steps for connections:
- Assemble all the parts as shown in circuit diagram.
- Connect Arduino ground to battery ground.
- Connect resistor R1 to gate pin of MOSFET
- Connect R2 between battery positive and MOSFET drain.
- Connect positive pin of capacitor C1 between R1 resistor and gate pin of MOSFET
- And negative pin of capacitor C1 connect to GND.
- Connect MOSFET source to ground.
- Connect sensor TMP36 pins Vcc to 5V, Ground pin to GND, and Vout pin A1 pin of Arduino.
- Connect MOSFET gate to D9 pin.
- AA Battery Holder connect one end to Battery positive (+)
- AA Battery Holder connect one end to Battery negative (–).
Conclusion:
This project is about Arduino Battery Charger Circuit.
Temperature protection make safe charging.
Circuit is easy to build and understand.
Can be improved later with voltage sensing, current sensing, LCD display or solar charging.
This basic design is good for small learning and DIY purpose.
References:
Arduino battery charging circuit
Leave a Reply