ESP32 + SCT-13-030 giving graph reversed

Hi all,
I’ve been reading a lot from this forum and trying to build a Energy monitoring system for my home. I am using a ESP32 connected with SCT-13-030 using the wiring diagram shown on this website. Sketch file code am using is copied below.

#include <WiFi.h>
#include <WebServer.h>
#include "EmonLib.h"

#define ADC_INPUT 34
#define INDICATE_PIN 2

const char* ssid = "wifissid";
const char* password = "password";
EnergyMonitor emon1;

WebServer httpServer(80);

void handle_request() {
  double amps = emon1.calcIrms(1480);

  String HTMLData = "current{label=\"phase1\"} " + String(amps);
  httpServer.send(200, "text/html", HTMLData);

  digitalWrite(INDICATE_PIN, HIGH);
  digitalWrite(INDICATE_PIN, LOW);

void setup() {
  pinMode(ADC_INPUT, INPUT);

  Serial.println("Tring to connect to Wifi SSID: ");

  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
  Serial.println("WiFi connected successfully");
  Serial.print("Assigned IP: ");

  httpServer.on("/", handle_request);
  Serial.println("HTTP server started");

  emon1.current(ADC_INPUT, 30);

void loop() {

My graph looks reverse. When I switch ON my TV the graph goes close to zero and when I don’t have any load it looks 12amps.

Am I doing anything wrong here.

Some updates. I tested my soldering and wiring many times and does not seem to have a problem. I’ve a few doubts.

  1. Does the CT sensor SCT-13-030 have polarity? I assume “No” as my understanding is, it has a transformer and burden resistors built in.
  2. I did calibrate ADC in my ESP32 and it seems to work fine with a lookup table. So it is the wiring which should have issues.

My wiring is done based on this article: DIY Home Energy Monitor: ESP32 + CT Sensors + Emonlib |

I fixed the issue. The issue was actually a soldering connection failure which led to disconnect in the circuit. The ground was not correctly linked to ESP32 ground pin. Sorry for bothering. Meanwhile, I’ve also improved the accuracy by using Lookup table which I calibrated for my ESP32.

Code can be found here: GitHub - codetiger/PowerConsumptionMonitor-ESP32: Power consumption monitor using ESP32 and SCT-013

1 Like