
An e-rickshaw battery monitoring system is a small IoT device that sits on an easy bike’s 48 V or 60 V battery string and continuously measures every 12 V battery’s voltage, the pack current and each battery’s temperature, then sends state of charge (SOC), state of health (SOH) and GPS alerts to the owner over 4G. In this reference design an ESP32 reads an INA228 shunt monitor, two ADS1115 ADCs on a resistor-tap network and five DS18B20 sensors, and an A7670E LTE modem with GNSS pushes the data to a dashboard.
🌐 এই লেখাটি বাংলায় পড়ুন: বাংলা সংস্করণ →
Below: the physics, full circuit, pin-by-pin wiring, BOM in taka, calibration and about half of the firmware, written for final-year EEE/ETE/CSE students in Bangladesh.
Table of Contents
Why an e-rickshaw battery monitoring system matters in Bangladesh (2026)
A Daily Star explainer describes the typical setup as four or five 12-volt batteries connected in series to deliver 48 or 60 volts, driving a motor that typically ranges from 600 W to 1200 W, with charging taking six to ten hours, usually overnight.
Nobody knows the exact fleet size, and the estimates differ a lot. A 2024 study by CLEAN, reported by The Daily Star, counted about 1.4 million easy bikes and put the battery market at around Tk 8,000 crore. In August 2026, Bonik Barta reported a BPDB estimate of 4.5 to 5 million battery rickshaws and easy bikes, and a CPD estimate of about 6 million e-three-wheelers using roughly 750 MW. The same report cites CPD’s count of about 48,136 unauthorised charging points in Dhaka against about 3,300 authorised stations.
Three problems keep coming back, and a monitoring device helps with all of them:
- Battery cost. One weak battery drags the whole series string down, and owners usually replace the full set because nobody can tell which one failed. Per-battery data allows a single-battery replacement.
- Lead pollution. UNICEF Bangladesh estimates that 35 million children in Bangladesh have blood lead levels that are too high, and it points to informal used lead-acid battery recycling as a major source. Batteries that last longer mean fewer batteries going to informal smelters.
- Charging and theft. Every charging session (time, Ah, Wh) is logged for fleet owners or legal charging stations, and GPS plus a key-switch input catches vehicle and battery theft.
The same hardware works for LiFePO4 conversions; only the SOC table and alarm thresholds change.
How the IoT battery monitoring system works
The device measures four things and combines them in firmware.
Measuring pack current with a shunt and INA228
1. Pack current (the most important signal). A 75 mV / 100 A shunt resistor (0.75 mΩ) sits in the negative lead of the pack. Every amp of motor or charger current produces 0.75 mV across it. The TI INA228 is a 20-bit current/voltage/power monitor with a ±163.84 mV shunt range. Its hardware charge accumulator integrates current for you, so no samples get lost while the ESP32 is busy with the modem. Its VBUS pin is tied to GND here: the datasheet derives current and charge from the shunt measurement alone, and 0 V is inside the 0–85 V bus input range. Pack voltage comes from a divider instead, and the firmware computes power (V × I) and energy.
With a low-side shunt the INA228’s inputs sit within millivolts of ground, so no IC pin ever sees the pack voltage (about 73–74 V on a charging 60 V lead-acid pack). The cheaper INA226 lacks a charge accumulator and is limited to 36 V if you ever move to high-side sensing.
Measuring each battery voltage (common-mode explained)
2. Each battery’s voltage (common-mode explained). Battery 1 sits between 0 V and 12 V, but battery 4 sits between 36 V and 48 V. If you connect an ADC “across” battery 4, its negative input is at 36 V above the ESP32 ground. That 36 V is the common-mode voltage. The ADC would be damaged, because its inputs must stay between its own GND and VDD.
There are three correct solutions:
| Method | How it works | Pros | Cons |
|---|---|---|---|
| Ground-referenced taps (used here) | Divide each node voltage (12, 24, 36, 48 V) down to below 3.3 V, including the pack top (60 V), then subtract neighbours in firmware | Cheap, simple, one ground | Error grows for the top battery; needs 0.1% resistors and calibration |
| High common-mode difference amplifier | A difference amp per battery that tolerates the high common-mode voltage | Direct per-battery reading | Expensive, one IC per battery |
| Isolated measurement | An isolated ADC or isolated DC-DC per battery | Most accurate, safest | Most parts and most cost |
For 12 V lead-acid blocks the tap method is enough: with 0.1% resistors and two-point calibration, expect roughly ±0.1–0.2 V on the top battery, while a weak battery typically sags several hundred millivolts more than its neighbours under load.
Temperature, GPS location and key state
3. Temperature. One DS18B20 per battery on a single 1-Wire bus. A battery running hotter than its neighbours while charging usually means a failing cell or a loose terminal.
4. Location and key state. The A7670E has built-in GNSS, and a PC817 optocoupler reads the key switch.
SOC: coulomb counting plus OCV correction
SOC is estimated by coulomb counting: every second it drops by (Ah taken out ÷ usable capacity), with the INA228’s charge register doing the integration in hardware. Because coulomb counting drifts, the firmware corrects it with open-circuit voltage (OCV): after a long enough rest (hours for lead-acid, much less for LiFePO4) the resting voltage maps to SOC through a table. A detected full charge resets SOC to 100%.
SOH: capacity fade and internal resistance
State of health uses two independent signals:
- Capacity fade: the Ah delivered between two well-known points (full charge and a rested OCV reading) is compared with the label capacity. A battery that delivers 70 Ah from a 100 Ah label is at about 70% SOH.
- Internal resistance (IR): each time the driver pulls away from a stop, the current jumps from near 0 A to tens of amps within a fraction of a second. The firmware captures every battery’s voltage just before and just after the step. Then R = ΔV ÷ ΔI per battery. Because it is a difference over a short time, offset errors cancel. Rising IR in one battery, compared with its neighbours, is the earliest warning of failure.
Imbalance detection
All batteries in a string carry the same current, so their voltages should track. The firmware flags any battery that deviates from the string average beyond a threshold, at rest, under load (most sensitive) or at end of charge.

E-rickshaw battery monitor circuit diagram

The circuit has five sections:
- Protection and power: 2 A fuse → SMBJ75A TVS → TI LM5164 synchronous buck (6–100 V input, 1 A output) set to 5 V. The TVS protects the 100 V-rated LM5164; no sensing IC is connected to the pack directly. The 5 V rail feeds the ESP32-DevKitC’s 5V pin and the modem board. The DevKitC’s own regulator makes the 3V3 rail for the sensors.
- Current sensing: low-side 0.75 mΩ shunt. INA228 IN+ goes to the load side (controller and charger negative), and IN− goes to the battery negative (system GND). Each line has a 10 Ω series resistor and a 100 nF differential capacitor. VBUS (pin 8) is tied to GND, so the INA228 never touches the pack voltage.
- Battery taps: five identical 1 MΩ / 47 kΩ (0.1%) dividers with 100 nF filter capacitors. T1–T4 go to ADS1115 #1 (0x48) A0–A3, and the pack top T5 goes to ADS1115 #2 (0x49) A0. At 74 V a tap gives 74 × 47/1047 ≈ 3.32 V, inside the ±4.096 V range. ADS1115 inputs must never exceed VDD + 0.3 V. Put a 0.5 A inline fuse on each tap wire, right at the battery terminal. ADS1115 #2’s A1–A3 are spare, for example for charger-input or 12 V aux sensing.
- Temperature: five DS18B20 sensors on GPIO27 with a 4.7 kΩ pull-up to 3V3.
- Modem and inputs: A7670E LTE/GNSS board on UART2, PWRKEY via an NPN, INA228 ALERT on GPIO34, key-switch optocoupler on GPIO35.
Wiring table (pin by pin)
| From | Pin | To | Notes / source |
|---|---|---|---|
| ESP32-DevKitC | IO21 (SDA) | INA228 SDA, ADS1115 #1 and #2 SDA | 4.7 kΩ pull-up to 3V3 (breakouts often have 10 kΩ already) |
| ESP32-DevKitC | IO22 (SCL) | INA228 SCL, ADS1115 #1 and #2 SCL | Same bus |
| ESP32-DevKitC | IO27 | DS18B20 DQ (×5) | 4.7 kΩ pull-up to 3V3 |
| ESP32-DevKitC | IO16 (RX2) | Modem TXD | Use a board with 3.3 V-compatible UART |
| ESP32-DevKitC | IO17 (TX2) | Modem RXD | |
| ESP32-DevKitC | IO4 | NPN base (10 kΩ) → collector to modem PWRKEY | Skip the NPN if your board already has a PWR driver |
| ESP32-DevKitC | IO34 | INA228 ALERT | Input-only pin; 10 kΩ pull-up to 3V3 |
| ESP32-DevKitC | IO35 | PC817 collector | Input-only pin; 10 kΩ pull-up; emitter to GND |
| ESP32-DevKitC | IO25 | Status LED + 330 Ω | |
| ESP32-DevKitC | 5V / GND | LM5164 output (5 V) / GND | Don’t power from USB and the 5V pin at the same time |
| INA228 | VS / GND | 3V3 / GND | 100 nF at the pin |
| INA228 | A0, A1 | GND | Address 0x40 |
| INA228 | IN+ / IN− | Shunt load side / shunt battery side | 10 Ω each + 100 nF across, Kelvin wires |
| INA228 | VBUS (pin 8) | GND | Current/charge only; power computed in firmware |
| ADS1115 #1 | ADDR → GND; A0–A3 | Taps T1–T4 (12/24/36/48 V nodes) via 1 MΩ/47 kΩ + 100 nF | Address 0x48, VDD = 3V3 |
| ADS1115 #2 | ADDR → VDD; A0 | Tap T5 (pack top) via 1 MΩ/47 kΩ + 100 nF | Address 0x49; A1–A3 spare |
| DS18B20 (×5) | GND / DQ / VDD | GND / IO27 / 3V3 | One probe per battery case |
| PC817 | LED anode via 47 kΩ 0.5 W | Key-switch output (pack voltage) | LED cathode to GND |
Pin facts and datasheet sources
Pin facts: the Espressif ESP32-DevKitC user guide (IO34/IO35 are input-only, and only one power source may be used at a time), the INA228 datasheet pin table, and the LM5164 datasheet. On a 48 V pack (four batteries), T4 is the pack top and ADS1115 #2 is optional.
Choosing the modem: A7670E vs SIM7600 vs SIM800L
Bangladeshi operators run LTE on 900, 1800 and 2100 MHz (bands 8, 3 and 1; see frequencycheck.com). The Waveshare A7670E Cat-1/GNSS board supports LTE-FDD B1/B3/B5/B7/B8/B20 plus GSM 900/1800 and GPS/BeiDou/GLONASS, so it covers all three bands. The SIM7600E is a heavier, costlier alternative.
Avoid the 2G-only SIM800L for anything new. BTRC’s roadmap, reported by The Financial Express in October 2026, targets a full 2G exit by December 2029, and it says imported 2G IoT/M2M equipment should move to 4G/VoLTE by June 2028.
Bill of materials (approx., Nov 2026, local market)
| Item | Qty | Approx. BDT |
|---|---|---|
| ESP32-DevKitC (WROOM-32E) | 1 | 650–850 |
| A7670E LTE Cat-1 board with GNSS + antennas | 1 | 2,800–3,800 |
| INA228 IC (on your PCB) or INA228 breakout | 1 | 700–2,500 |
| 75 mV / 100 A shunt | 1 | 400–700 |
| ADS1115 module | 2 | 700–900 |
| DS18B20 waterproof probe | 5 | 650–900 |
| LM5164 + inductor + 100 V capacitors (or a 100 V-rated buck module) | 1 set | 600–1,200 |
| SMBJ75A TVS, fuses + holders, 0.1% resistors (5 divider sets), PC817 | 1 set | 550–850 |
| PCB (JLCPCB, 5 pcs) + IP65 box + cable glands | 1 | 1,500–2,500 |
| Total | ≈ 8,400–14,000 |
Buy the INA228 and ADS1115 from a trusted seller. Fake and remarked chips are common; see our guide on how to spot fake electronic components.
Step-by-step build guide
Step 1: Prototype the measurement front-end on the bench
Use a bench supply (or 4–5 small 12 V batteries) and a 10–20 A dummy load. Confirm INA228 current and all five ADS1115 taps before going near a real easy bike.
Step 2: Install the shunt and wiring on the vehicle
Mount the shunt directly at the battery negative, so that both the motor controller and the charger current pass through it. If the charger returns to the battery negative on the other side of the shunt, you will never see charge current and SOC will be wrong. Use short Kelvin sense wires from the shunt’s small screw terminals to the INA228. Fit an inline fuse on each tap lead at the battery end. Then fit one DS18B20 to the side of each battery case with thermal tape.
Step 3: Power stage
Follow the LM5164 datasheet: 2.2 nF BST–SW, 158 kΩ / 49.9 kΩ feedback for 5 V (VREF 1.2 V), RON and inductor from TI’s calculator, and ≥ 470 µF bulk at the modem’s 5 V input.
Step 4: Calibrate
With a good multimeter, calibrate each tap at two points (half-discharged at rest, and end of charge) and store the gains (tapCal[]) in NVS. For current, zero the offset at 0 A and correct the shunt value against a known current.
Step 5: Firmware bring-up
Bring up modules in order: sensors → state machine → SOC → modem/MQTT → alarms, logging to serial. Test AT commands manually (AT+CNMP=38 locks LTE-only; AT+CGNSSPWR=1 turns GNSS on, per the Waveshare wiki) before you automate them.
Step 6: Road test
Run a full drive-and-charge cycle: SOC should fall smoothly, rise while charging and reset to 100% at end of charge, and the five IR estimates should be similar.
Firmware architecture (fully explained)
The firmware is Arduino-ESP32 on FreeRTOS. It runs as independent tasks that share data through a mutex-protected structure.
| Module / task | Period | What it does |
|---|---|---|
| Measurement | 100 ms (current), 1 s (charge/energy) | Reads INA228 current and CHARGE; computes power and energy from V × I. Watches for load steps (dI/dt) |
| Tap reader | 1 s normally, burst on load step | Reads taps T1–T5 from both ADS1115s; battery n = Tn − T(n−1), so B5 = T5 − T4 |
| Temperature | 5 s | Starts a DS18B20 conversion and reads all five sensors on the next pass |
| State machine | 1 s | RESTING / DRIVING / CHARGING from current and key switch; tracks rest timer |
| Estimator | 1 s | Coulomb-count SOC, OCV correction after long rest, full-charge reset, capacity learning, IR per battery |
| Fault manager | 1 s | Thresholds with hysteresis and debounce: weak battery, imbalance, over-temperature, deep discharge, overvoltage, movement with key off, geofence |
| Comms | Event + 30 s (driving) / 10 min (parked) | Modem state machine: power → register → PDP → MQTT → publish. Polls GNSS. Store-and-forward queue in flash when there’s no network |
| Config/OTA | On demand | Thresholds and capacity set from the dashboard; firmware update over LTE |
Data flow: sensors → estimator → fault manager → JSON → MQTT broker → dashboard, with SMS fallback for critical alarms.
IR timing: the ADS1115 reads channels one after another, a few milliseconds apart. For IR the firmware waits for the current to settle after the step, then burst-reads the taps at a high data rate.
Code: about 50% of the firmware
Below are five real snippets: the pin map, sensor initialisation, per-battery calculation, the SOC core and the main loop skeleton. They use the Adafruit_INA228, Adafruit_ADS1X15, OneWire and DallasTemperature libraries. This is roughly half the firmware. The OCV table and temperature compensation, the IR capture and SOH learning, the calibration routine, the fault logic, the modem/MQTT/GNSS driver, the dashboard, OTA and flash logging are not shown.
// config.h - pin map and pack settings (ESP32-DevKitC, ESP32-WROOM-32E)
#pragma once
#define PIN_I2C_SDA 21 // INA228 + 2x ADS1115
#define PIN_I2C_SCL 22
#define PIN_ONEWIRE 27 // 5x DS18B20, 4.7k pull-up to 3V3
#define PIN_MODEM_RX 16 // ESP32 RX2 <- modem TXD
#define PIN_MODEM_TX 17 // ESP32 TX2 -> modem RXD
#define PIN_MODEM_PWRKEY 4 // drives NPN that pulls PWRKEY low
#define PIN_INA_ALERT 34 // input-only pin, external 10k pull-up
#define PIN_KEY_SENSE 35 // PC817 output, LOW = key switch ON
#define PIN_STATUS_LED 25
#define N_BATT 5 // 4 = 48 V pack, 5 = 60 V pack
#define SHUNT_OHM 0.00075f // 75 mV / 100 A shunt
#define SHUNT_MAX_A 100.0f
#define NOMINAL_AH 100.0f // from the battery label
#define TAP_RATIO (1047.0f / 47.0f) // 1 M + 47 k divider
#include <Wire.h>
#include <Adafruit_INA228.h>
#include <Adafruit_ADS1X15.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include "config.h"
Adafruit_INA228 ina; // 0x40: shunt current only (VBUS tied to GND)
Adafruit_ADS1115 ads, ads2; // 0x48: taps T1..T4, 0x49: T5 (pack top) + spares
OneWire ow(PIN_ONEWIRE);
DallasTemperature dsBus(&ow);
bool sensorsBegin() {
Wire.begin(PIN_I2C_SDA, PIN_I2C_SCL);
if (!ina.begin(0x40)) return false;
ina.setShunt(SHUNT_OHM, SHUNT_MAX_A); // sets current LSB + SHUNT_CAL
ina.setAveragingCount(INA228_COUNT_64);
ina.resetAccumulators(); // zero CHARGE and ENERGY registers
if (!ads.begin(0x48) || !ads2.begin(0x49)) return false;
ads.setGain(GAIN_ONE); // +/-4.096 V full scale
ads2.setGain(GAIN_ONE);
dsBus.begin();
dsBus.setWaitForConversion(false); // non-blocking DS18B20 reads
return dsBus.getDeviceCount() == N_BATT;
}
float tapV[N_BATT]; // node voltages vs pack negative
float battV[N_BATT]; // individual 12 V battery voltages
float tapCal[N_BATT] = {1, 1, 1, 1, 1}; // per-tap gain from calibration
void readBatteries() {
for (uint8_t i = 0; i < N_BATT; i++) { // T1..T4 on ads A0..A3, T5 on ads2 A0
Adafruit_ADS1115 &adc = (i < 4) ? ads : ads2;
int16_t raw = adc.readADC_SingleEnded(i < 4 ? i : 0);
tapV[i] = adc.computeVolts(raw) * TAP_RATIO * tapCal[i];
}
battV[0] = tapV[0];
for (uint8_t i = 1; i < N_BATT; i++) {
battV[i] = tapV[i] - tapV[i - 1]; // difference of two ground-referenced taps
}
}
float socPct = 50.0f; // restored from NVS at boot
float lastCharge_C = 0.0f;
float capAh = NOMINAL_AH; // shrinks as the SOH module learns
// Called once per second. Low-side shunt with IN+ on the load side:
// positive current = discharge, so a rising CHARGE register = Ah taken out.
void updateSoc() {
float q = ina.readCharge(); // coulombs since reset
float dAh = (q - lastCharge_C) / 3600.0f;
lastCharge_C = q;
float eff = (dAh < 0) ? 0.85f : 1.0f; // typical lead-acid charge efficiency
socPct -= 100.0f * (dAh * eff) / capAh;
socPct = constrain(socPct, 0.0f, 100.0f);
}
enum PackState { RESTING, DRIVING, CHARGING };
PackState state = RESTING;
void loop() {
static uint32_t t1s = 0;
if (millis() - t1s >= 1000) {
t1s += 1000;
float iA = ina.readCurrent() / 1000.0f; // library returns mA
bool keyOn = (digitalRead(PIN_KEY_SENSE) == LOW);
readBatteries();
float vPack = tapV[N_BATT - 1]; // pack top from the divider
float pW = vPack * iA; // power computed in firmware
updateSoc();
if (iA < -1.0f) state = CHARGING;
else if (keyOn || iA > 1.0f) state = DRIVING;
else state = RESTING;
// OCV correction, SOH, alarms, GNSS and MQTT queue: in the full firmware
}
}
Want the complete production firmware? The full version includes the OCV-SOC tables for lead-acid and LiFePO4 with temperature compensation, the load-step internal-resistance capture and SOH learning, the two-point calibration routine saved to NVS, all alarm logic with hysteresis, the A7670E LTE + GNSS + MQTT driver with offline store-and-forward, the owner/fleet dashboard, SMS alerts, OTA updates and data logging, plus the KiCad schematic and PCB. Message us on WhatsApp to get the full source code, circuit files and help building it.
Testing and results to expect
On a well-calibrated build, expect pack current within about 1% (the shunt tolerance dominates), pack voltage within about 0.1–0.2% (calibrated divider), and per-battery voltage within ±0.1–0.2 V on the top battery (better on the lower ones). SOC from coulomb counting typically stays within 5–10% between OCV corrections on lead-acid. Peukert effect and temperature are the main error sources. These are typical figures for this architecture, not measured results.
| Problem | Likely cause | Fix |
|---|---|---|
| Current is 0 while charging | Charger bypasses the shunt | Put the shunt at battery negative |
| Top battery reading jumps | Taps sampled at different moments | Compare at rest; use burst read |
| ESP32 resets on modem TX | 5 V droop | More bulk C, LTE-only, or a 2–3 A buck |
| DS18B20 reads −127 °C | Bad joint or no pull-up | Check the 4.7 kΩ pull-up and wiring |
| SOC drifts over days | Current offset | Zero the offset; check rest detection |
| INA228/ADS1115 not found | Address or fake chip | I2C scan (0x40, 0x48, 0x49) |
Safety
A 60 V pack can deliver hundreds of amps into a short and set wiring on fire. Fuse every wire that leaves a battery terminal, disconnect the pack before touching the shunt, insulate tools and remove rings and watches. Lead-acid batteries vent hydrogen while charging, so keep sparks away. This device monitors and alerts; it is not a protection system and does not disconnect the pack.
Future upgrades and real-world uses
- Product potential: fleet owners and battery dealers offering warranties need exactly this data; a per-vehicle monthly fee is a realistic model.
- LiFePO4 version: add a CAN/UART link to the pack’s BMS for per-cell data.
- Research angle: collect real drive cycles from Dhaka streets and compare SOC algorithms (coulomb + OCV vs. an extended Kalman filter). That is a solid conference paper. For an M.Sc., you could add machine-learning remaining-useful-life prediction across a fleet. See our M.Sc. thesis topics.
Frequently asked questions
Compare each battery under load and at rest. A weak battery sags more when the vehicle pulls away, runs hotter while charging and shows higher internal resistance. A per-battery monitor tracks this continuously; a handheld tester gives only a snapshot.
Most use four or five 12 V lead-acid batteries in series, giving a 48 V or 60 V pack. LiFePO4 conversions replace them with a single pack of the same nominal voltage.
Not on the high side: its bus range is only 36 V. In a low-side position it works, but the INA228 adds a charge accumulator, and a Hall-effect sensor is the isolated alternative.
By coulomb counting (integrating current over time) and correcting periodically with the open-circuit voltage after rest and with full-charge detection.
Measure the voltage change and current change during a sudden load step, then divide: R = ΔV ÷ ΔI. In an easy bike, the pull-away from a stop gives you that step for free.
For now, yes. But BTRC plans to end 2G by December 2029, so new designs should use a 4G Cat-1 modem such as the A7670E.
Conclusion
An e-rickshaw battery monitoring system solves a problem that millions of Bangladeshi drivers pay for every year, and it combines high-voltage measurement, estimation algorithms, 4G and a cloud dashboard in one build. Respect common-mode voltage, keep every sensing IC off the pack voltage, calibrate properly, and you will have data good enough for a thesis and maybe a product. If you want to compare it with a mains-side project, read our ESP32 smart energy meter with NILM.
Want this e-rickshaw battery monitor built for your thesis or your fleet? We design custom PCBs, firmware and complete working prototypes for students and companies. Message us on WhatsApp or use the contact form. You can write in Bangla or English.