Electric Vehicle Charging Station Monitor with ESP32 + OLED
Overview
A smart EV charging monitor not only sends data to the cloud but also provides local feedback to users.
By adding a 0.96" OLED display (SSD1306, 128x64), the system shows charging status, voltage, current, and power directly at the charging point.
Features
- Real-time voltage, current, and power measurement
- OLED display for live readings at the station
- WiFi + Cloud integration for remote monitoring
- Safety alerts for overcurrent or faults
- Scalable across multiple charging points
Components
- ESP32 Dev Board
- INA219 Current/Voltage Sensor
- 0.96" I2C OLED Display (SSD1306)
- Relay/Contactor (optional for enabling/disabling charging)
- Power Supply & Enclosure
Example Code (ESP32 + INA219 + OLED)
c
#include <Wire.h>
#include <Adafruit_INA219.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <WiFi.h>
#include <HTTPClient.h>
Adafruit_INA219 ina219;
Adafruit_SSD1306 display(128, 64, &Wire);
// WiFi credentials
const char* ssid = "your-SSID";
const char* password = "your-PASSWORD";
// Server endpoint
const char* serverURL = "http://your-server/api/ev/monitor";
void setup() {
Serial.begin(115200);
// OLED init
if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
Serial.println("SSD1306 allocation failed");
for (;;);
}
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(SSD1306_WHITE);
display.setCursor(0, 0);
display.println("EV Charger Booting...");
display.display();
// WiFi init
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
display.clearDisplay();
display.setCursor(0, 0);
display.println("Connecting WiFi...");
display.display();
}
display.clearDisplay();
display.setCursor(0, 0);
display.println("WiFi Connected!");
display.display();
// INA219 init
if (!ina219.begin()) {
Serial.println("INA219 not found!");
display.clearDisplay();
display.setCursor(0, 0);
display.println("INA219 Error!");
display.display();
while (1) { delay(10); }
}
}
void loop() {
float busVoltage = ina219.getBusVoltage_V();
float current_mA = ina219.getCurrent_mA();
float power_mW = busVoltage * (current_mA / 1000.0);
// Print to Serial
Serial.printf("Voltage: %.2f V, Current: %.2f mA, Power: %.2f mW\n",
busVoltage, current_mA, power_mW);
// Update OLED
display.clearDisplay();
display.setCursor(0, 0);
display.println("EV Charger Status");
display.println("----------------");
display.printf("Volt: %.2f V\n", busVoltage);
display.printf("Curr: %.2f mA\n", current_mA);
display.printf("Power: %.2f mW\n", power_mW);
display.display();
// Send data to server
if (WiFi.status() == WL_CONNECTED) {
HTTPClient http;
http.begin(serverURL);
http.addHeader("Content-Type", "application/json");
String payload = "{\"voltage\":" + String(busVoltage, 2) +
",\"current\":" + String(current_mA, 2) +
",\"power\":" + String(power_mW, 2) + "}";
int httpResponse = http.POST(payload);
Serial.println("Server response: " + String(httpResponse));
http.end();
}
delay(5000); // Update every 5 seconds
}