GenxiTechSolutions
electronics

Auto Cutoff Battery Charger

Status Completed
Year 2026
Team GenxiTechSolutions

Project Overview

Auto Cutoff Battery Charger — LM358 Comparator | Proteus
Proteus Simulation · Electronics Project

Auto Cutoff
Battery Charger

A relay-controlled smart charger that automatically stops charging the moment your battery hits its target voltage — built around the LM358 op-amp comparator and verified in Proteus.

LM358 Comparator LM7812 Regulator BC547 Transistor 12V SPDT Relay Proteus Verified 2026
State A — Active
🟢 Charging ON
Relay RL1 energised — Q1 saturated — Green LED (D3) lit — current flowing to battery
State B — Cutoff
🔴 Charging OFF
Relay RL1 open — Q1 cut off — Red LED (D2) lit — battery at target voltage
Circuit Analysis

How it works —
stage by stage

Seven cascaded stages convert raw AC mains into a smart self-terminating charging system.

01
AC Input & Rectification
V1 (VSINE) → BR1 (Bridge Rectifier) → C1 (1000µF Filter Cap)
  • V1 provides the AC mains simulation — 35V peak sinusoidal at 50Hz
  • BR1 is a full-wave bridge rectifier converting AC to pulsating DC
  • C1 (1000µF) smooths ripple into clean DC ready for the regulator
02
Voltage Regulation — LM7812
Rectified DC → U1 (LM7812) → +12V Stable Rail
  • U1 (LM7812) is a 3-terminal linear regulator — rock-solid +12V output
  • Powers the comparator stage, relay coil, and LED indicators
  • The voltmeter probe confirms the regulated 12V rail in simulation
03
Voltage Sensing & Comparison — LM358 (The Brain)
Battery → R5/R6 divider → LM358 pin 2 (−) | RV1 → LM358 pin 3 (+)
  • RV1 sets the cutoff threshold on the non-inverting input (pin 3 +)
  • R5 + R6 (10kΩ each) form a voltage divider sampling battery voltage into pin 2 −
  • Battery < setpoint → output HIGH → transistor ON → relay ON → charging
  • Battery ≥ setpoint → output LOW → transistor OFF → relay OFF → cutoff
04
Transistor Switch — BC547
LM358 output → R1 (1kΩ) → Q1 (BC547 NPN) Base
  • R1 (1kΩ) limits base drive current into Q1 safely
  • Q1 saturated (comparator HIGH) → drives relay coil current
  • Q1 cut off (comparator LOW) → relay coil de-energised → open circuit
05
Relay & Flyback Protection — RL1 + D1
Q1 Collector → RL1 Coil (12V) ‖ D1 (1N4007 flyback)
  • RL1 is a 12V SPDT relay — physically connects/disconnects the charging path
  • D1 (1N4007) clamps inductive voltage spikes when the coil switches off — mandatory protection for Q1
06
LED Status Indicators — D2 & D3
Relay NO/NC → D2 (Red) + D3 (Green) via R2/R3 (330Ω)
  • D3 Green — "Charging On" — lights when relay is closed and current flows
  • D2 Red — "Charging Off / Full" — lights when relay opens at cutoff
  • R2 & R3 (330Ω) limit LED current to a safe level
07
Battery / Load Simulation — VPULSE
V2 (VPULSE) → D4 (1N5408) → Load / Battery
  • V2 ramps from 8V (discharged) to 12.1V (fully charged) over 8 seconds
  • When it crosses the RV1 threshold, the LM358 flips and triggers cutoff
  • D4 (1N5408) blocks reverse current from the battery back into the charger
  • R4 provides a small series resistance for the simulation current path
Proteus Setup

Simulation source
configurations

Exact Proteus component settings used for both voltage sources.

V1 — VSINE
AC Mains Simulation
DC OffsetDefault (0V)
Amplitude35V peak
Frequency50 Hz
Time DelayDefault
DampingDefault
V2 — VPULSE
Battery Voltage Simulation
Initial Value8V (dead battery)
Pulse Value12.1V (fully charged)
Delay Time0s
Rise Time8s (slow ramp)
Fall Time0.1s
Pulse Width5s
Period20s
Why 35V peak? After full-wave rectification and filtering, the peak is approximately 35V − 1.4V (bridge diode drops) = 33.6V. The LM7812 clamps this cleanly to a stable +12V output rail. The VPULSE ramps from 8V → 12.1V over 8 seconds, crossing the comparator threshold mid-simulation so you can observe the complete charge → cutoff transition in a single transient run.

Comparator logic

LM358 U2:A decision table — pin 3 is RV1 reference, pin 2 is battery sense.

Battery voltage vs RV1 LM358 output Q1 state Relay RL1 LED status
Battery < threshold HIGH Saturated Energised (closed) 🟢 Green ON
Battery ≥ threshold LOW Cut off De-energised (open) 🔴 Red ON
Bill of Materials

Every component,
listed and explained

Ref Component Value / Part Function
V1AC SourceVSINE, 35V pk, 50HzMains simulation
V2Pulse SourceVPULSE, 8→12.1VBattery voltage simulation
BR1Bridge RectifierBRIDGEFull-wave rectification
C1Electrolytic Cap1000µFRipple filtering
U1Voltage RegulatorLM7812+12V regulated rail
U2:AOp-AmpLM358Voltage comparator (the brain)
RV1Potentiometer10kΩCutoff voltage setpoint — adjustable
R1Resistor1kΩQ1 base current limiter
R2Resistor330ΩRed LED current limiter
R3Resistor330ΩGreen LED current limiter
R4Resistor(sim)Series simulation load resistance
R5Resistor10kΩVoltage divider — upper arm
R6Resistor10kΩVoltage divider — lower arm
Q1NPN TransistorBC547Relay driver switch (100mA Ic)
RL1Relay12V SPDT coilCharging path physical switch
D1Rectifier Diode1N4007Relay flyback / freewheel protection
D2LED — RedLED-RED"Charging Off / Full" indicator
D3LED — GreenLED-GREEN"Charging On" indicator
D4Rectifier Diode1N5408Reverse current block (high current rated)
Design Notes

Protections, tips
& calibration

🛡️
Flyback diode D1 is mandatory
When the relay coil de-energises, it produces a large inductive voltage spike in reverse polarity. Without D1 (1N4007) clamping it, Q1 (BC547) will be destroyed on the very first cutoff event.
D4 handles real current
The 1N5408 is rated significantly higher than normal signal diodes (3A continuous forward current), offering crucial low forward drop and preventing the battery from back-powering the regulator array when the mains power shuts off.

Tech Stack

Proteus Design Suite KiCad LM358 LM7812 BC547 1N4007 1N5408 SPICE Simulation Bridge Rectifier LM358 Op-Amp

Tags

#auto cutoff charger #battery charger circuit #LM358 comparator #automatic battery cutoff #Proteus simulation #KiCad schematic #LM7812 voltage regulator #BC547 transistor switch #relay charger circuit #overcharge protection #12V battery charger #op-amp comparator circuit #electronics project #bridge rectifier circuit #voltage comparator #SPICE simulation #1N4007 flyback diode #LED charging indicator #embedded electronics #PCB design
Technical Specs
AC Input Voltage35V peak (VSINE, 50Hz)
Regulated DC Output+12V (LM7812)
Filter Capacitor1000µF electrolytic
Cutoff VoltageAdjustable via RV1 (10kΩ potentiometer)
Comparator ICLM358 op-amp (U2:A), single-supply
Transistor SwitchBC547 NPN (Q1), 100mA Ic max
Base ResistorR1 = 1kΩ
RelayRL1 12V SPDT
Flyback Protection DiodeD1 — 1N4007
Output Reverse-Block DiodeD4 — 1N5408
Voltage DividerR5 = R6 = 10kΩ
LED Current-Limit ResistorsR2 = R3 = 330Ω
Green LED (D3)Charging active indicator
Red LED (D2)Charging complete / cutoff indicator
Battery Sim Source (V2)VPULSE 8V → 12.1V, rise 8s, period 20s
Simulation PlatformProteus Design Suite
🤖

GenxiTech Assistant

Online · AI Powered · Always Ready