Design and Construction of an IoT-Based Battery Management System Prototype
Real-Time Battery Monitoring with ESP32, ACS712 Current Sensor, MCP9808 Temperature Sensor, Relay Load
Control, and Blynk IoT Dashboard
Category: IoT, Embedded Systems, Battery Management, Energy
Tools & Technologies: ESP32, ACS712 Current Sensor, Voltage Divider Circuit, MCP9808 I2C Temperature
Sensor, 20x4 I2C LCD, Relay Module, Push Buttons (Start/Stop Load), Blynk IoT Platform, Arduino IDE
Status: Completed
Introduction
This project implements an IoT-based battery management system (BMS) prototype for monitoring and
protecting battery cells in real time. The ESP32 microcontroller reads battery voltage through a
precision voltage divider, current draw via the ACS712 sensor, and cell temperature using the
MCP9808 I2C temperature sensor. The system detects charging states — identifying when the battery is
charging, fully charged, or disconnected — and controls a relay-based load switch through physical
push buttons. All readings including voltage, current, temperature (in both Celsius and Fahrenheit),
and charging state are displayed on a 20x4 LCD and streamed to a Blynk IoT dashboard for remote
monitoring. The system provides a complete battery health overview accessible from anywhere.
System Overview
Aim and Objectives
Aim:
Design and construct an IoT-enabled battery management system prototype
for real-time voltage, current, and temperature monitoring with cloud-based remote access.
Objectives:
- Measure battery voltage using a precision voltage divider with calibrated ADC readings.
- Monitor charge/discharge current using ACS712 hall-effect current sensor.
- Track battery temperature with MCP9808 I2C sensor for thermal management.
- Detect and display charging state (Charging / Completed / Removed).
- Control load connection via relay with physical start/stop push buttons.
- Stream all battery parameters to Blynk IoT dashboard for remote monitoring.
Features & Deliverables
- Voltage Monitoring: Precision voltage divider provides accurate battery voltage
measurement through ESP32 ADC.
- Current Sensing: ACS712 hall-effect sensor measures charge and discharge
currents with bidirectional capability.
- Temperature Tracking: MCP9808 high-accuracy I2C sensor reports both Celsius and
Fahrenheit readings.
- Charging State Detection: Intelligent algorithm classifies battery as Charging,
Completed, or Removed based on current flow.
- Load Control: Relay module with push button interface for manual load
connect/disconnect.
- Blynk Dashboard: Virtual pins V0-V4 stream voltage, current, temperature, and
state to cloud dashboard.
- LCD Display: 20x4 local display shows all parameters for direct monitoring
without network dependency.
Process / Methodology
Hardware Assembly
Components: ESP32, ACS712, Voltage Divider Resistors, MCP9808, 20x4 I2C LCD, Relay Module, Push
Buttons, LEDs.
- Designed precision voltage divider for battery voltage scaling to ESP32 ADC range.
- Connected ACS712 current sensor in series with battery for current measurement.
- Wired MCP9808 via I2C bus alongside LCD for temperature monitoring.
- Integrated relay module with start/stop buttons for load switching control.
Software Development
- Developed ESP32 firmware with multi-sensor polling on 2-second interval.
- Implemented charging state detection algorithm based on current magnitude and direction.
- Configured Blynk virtual pins for voltage (V0), current (V1), temperature (V2/V3), and state
(V4).
- Added WiFi connection management with status LED indication.
Testing & Calibration
- Calibrated voltage divider ratio against precision multimeter readings.
- Validated ACS712 zero-current offset and sensitivity calibration.
- Tested charging state transitions across charge/discharge/disconnect scenarios.
Challenges & Solutions
- Challenge: ESP32 ADC nonlinearity affecting voltage measurement accuracy.
Solution: Applied calibration factor and used multisampling with averaging for
stable readings.
- Challenge: ACS712 zero-current offset drift with temperature changes.
Solution: Implemented startup baseline calibration routine to capture
zero-current reference.
- Challenge: I2C bus contention between LCD and MCP9808 sensor.
Solution: Added proper pull-up resistors and sequential I2C transaction
scheduling.
Results & Impact
- Battery Visibility: Complete real-time view of battery health parameters for
informed management.
- Remote Access: Blynk dashboard enabled battery monitoring from any location via
smartphone.
- State Awareness: Charging state detection prevented overcharging and informed
maintenance.
- Load Protection: Relay control with manual switches provided safe load
management.
Future Enhancements
- Add cell balancing for multi-cell battery pack management.
- Implement SoC (State of Charge) estimation using coulomb counting.
- Add over-voltage, under-voltage, and over-temperature protection with auto-disconnect.
- Support multiple battery chemistry profiles (Li-ion, LiFePO4, Lead-Acid).
Demonstration / Access
- GitHub Repository: Coming
soon
- Live Demonstration Video: Coming
soon