GPS speedometer and clock
A bike or car speedometer that needs no wheel sensor: satellites do the measuring.
Shop by category
Shop all componentsAn SCT-013 is a split-core current transformer: it clamps around a single wire without opening the circuit and gives out a small AC signal that follows the current. The 30 A version gives 1 V at full scale. An ESP32 reads it through two resistors that lift the signal to the middle of the ADC range, and the sketch works out the RMS current. Multiply by 230 V for a rough power figure.
Mains is dangerous. Never cut, strip or open a cord yourself; use a splitter lead made for this.
Keep the ESP32 and wiring outside any mains enclosure.
Tick anything you already have and the total updates.
Samples the clamp signal and drives the display
SCT-013-030: 30 A clamp with a 1 V output, no burden resistor needed
SCT-013 100 A clamp for bigger loads (current output: needs a burden resistor)
SCT-013-015 15 A clamp for small loads
Follow the colours: red is power, dark grey is ground, blue is a signal.
Power the ESP32 from a USB charger. The clamp never touches mains conductors, so the low-voltage side stays isolated.
sct013_logger.inoVerify & upload in Electrolark#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
Adafruit_SSD1306 oled(128, 64, &Wire, -1);
const int PIN = 34;
const float AMPS_PER_VOLT = 30.0; // SCT-013-030: 30 A gives 1 V RMS
const float CAL = 1.00; // trim this against a known load
const float MAINS_V = 230.0; // assumed supply voltage
const int N = 1000;
void setup() {
Serial.begin(115200);
oled.begin(SSD1306_SWITCHCAPVCC, 0x3C);
analogSetPinAttenuation(PIN, ADC_11db);
}
float readAmps() {
double sum = 0, sumSq = 0;
for (int i = 0; i < N; i++) {
float mv = analogReadMilliVolts(PIN); // calibrated millivolts
sum += mv;
sumSq += mv * mv;
delayMicroseconds(200); // 1000 samples cover about 5 mains cycles
}
double mean = sum / N;
double rmsMv = sqrt(sumSq / N - mean * mean); // AC part only, bias removed
return (rmsMv / 1000.0) * AMPS_PER_VOLT * CAL;
}
void loop() {
float a = readAmps();
if (a < 0.15) a = 0; // ignore noise floor
oled.clearDisplay(); oled.setTextColor(WHITE);
oled.setTextSize(2); oled.setCursor(0, 0); oled.printf("%.2f A", a);
oled.setTextSize(1); oled.setCursor(0, 34); oled.printf("about %.0f W at %.0f V", a * MAINS_V, MAINS_V);
oled.display();
Serial.println(a, 3);
delay(500);
}
Noise on the ADC. Add 100 nF across the bias resistor to GND, or raise the noise-floor cut-off in the sketch.
Clamp only one wire, and make sure the clamp is fully closed. Then trim CAL.
Average several readings, and keep the sensor lead away from the ESP32's antenna.
No. The live and neutral currents cancel inside the clamp, so you read zero. Use a cord with the wires split out.
No. It assumes 230 V and unity power factor, so motors and chargers read high. It is good for comparing loads.
The clamp is isolated from the wire, but never open an appliance cord or touch bare conductors. Ask a qualified person to split a cord.
9 parts: ESP32 DevKit V1 Development Board (30-Pin, WROOM-32), YHDC SCT-013-030 30A Split-Core Current Transformer, Resistor Assortment Kit (30 Values), Capacitor Assortment Kit, 0.96" OLED Display 128x64, YHDC SCT-013 100A Non-Invasive AC Current Sensor (Split Core), SCT-013-015 15A Non-Invasive AC Current Clamp Sensor, Solderless Breadboard and Dupont Jumper Wires (40 pcs). Tools: Digital Multimeter. On this page you can tick the parts you already have and add only the rest to your cart.
It is a intermediate project and takes about 2 to 3 hours. The build on this page has 6 steps.
No. This page has the complete, tested code (sct013_logger.ino).
About ₹2,097 for the parts at the prices on this page, plus tools if you do not have them. Quantity price breaks lower the cost when you build several.
How a current transformer measures AC without touching the wire; Biasing an AC signal for a single-supply ADC; RMS maths on a sampled sine wave.
Ideas that reuse this build: DC current meter. They are listed under Take it further on this page.
A bike or car speedometer that needs no wheel sensor: satellites do the measuring.
Records where you went every five seconds, ready to open on a map.
Two boards, two radios: press the button at the gate and it rings indoors.
Check temperature, humidity and pressure from any phone on your Wi-Fi.
Learning project. Check every circuit and the datasheet of each part before you power it up.