SCT-013 Arduino: Measure AC Current Without Cutting the Wire
SCT-013 Arduino guide: measure AC current without cutting wires. Model table, burden resistor maths, mid-point bias circuit, EmonLib RMS code, ESP32 monitor.
An SCT-013 with Arduino is the most practical way to measure the AC current drawn by one appliance or a whole house without cutting a single wire. The SCT-013 is a clamp-on current sensor, a split-core current transformer (CT): you close its jaw around a conductor, the alternating current in that conductor produces a small current or voltage in the sensor's winding, and the Arduino reads it on an analog input. Because you never connect electrically to the mains, the measuring side stays isolated from 230 V.
In this guide you will see how the SCT-013 works, the difference between the current-output SCT-013-000 and the voltage-output models, and which model covers which range. Then you will work out the burden resistor step by step, build the mid-point circuit, read RMS current and power on an Arduino Uno with EmonLib, and do the same maths without a library. The last sections cover an ESP32 home energy monitor that shows live power and kWh on your phone, plus a Raspberry Pi Pico version.
What is the SCT-013 and how does it work?
The SCT-013 is a current transformer. The conductor passing through it acts as a single-turn primary winding, and the coil inside the clamp is the secondary. The SCT-013-000 has 2000 turns on its secondary, so the secondary current is one two-thousandth of the primary current: with 10 A in the conductor, 5 mA flows in the winding. A transformer only works with a changing magnetic field, so the SCT-013 measures AC only; it cannot see the direct current in a battery, solar panel or DC motor line. For DC you need a Hall-effect sensor such as the ACS712 current sensor. The 013 in the name refers to the clamp's 13 mm opening, which easily fits typical household and panel cables up to 16 mm².
| Feature | Value |
|---|---|
| Opening | 13 mm |
| Turns ratio (SCT-013-000) | 100 A : 50 mA (1 : 2000) |
| Current type measured | AC only (including 50/60 Hz mains) |
| Output | Current on the 000, 0–1 V AC voltage on the other models |
| Connection | About 1 m of cable, 3.5 mm stereo jack |
| Jack contacts used | Tip and sleeve; the middle ring is unused |
| Isolation | Measuring circuit galvanically isolated from the mains |
Current output and voltage output SCT-013 models
There are two kinds of SCT-013 on the market. The SCT-013-000 has a current output: it gives 50 mA at 100 A and you fit the burden resistor that turns this current into a voltage. The advantage is that by choosing the resistor you can tune range and resolution to your project. The other models (005, 010, 015, 020, 030, 050, 060) have the burden resistor built in and deliver 1 V RMS at the current on their label; the SCT-013-030, for example, gives 1 V at 30 A. You do not add a resistor to these, doing so ruins the reading. You can tell which one you have from the label on the clamp: 100A:50mA means current output, something like 30A/1V means voltage output.
| Model | Measuring range | Output | Built-in burden resistor | EmonLib calibration (ICAL) |
|---|---|---|---|---|
| SCT-013-000 | 0–100 A | 0–50 mA current | None, fitted externally | 2000 / R (60.6 for 33 Ω) |
| SCT-013-005 | 0–5 A | 0–1 V | Yes | 5 |
| SCT-013-010 | 0–10 A | 0–1 V | Yes | 10 |
| SCT-013-015 | 0–15 A | 0–1 V | Yes | 15 |
| SCT-013-020 | 0–20 A | 0–1 V | Yes | 20 |
| SCT-013-030 | 0–30 A | 0–1 V | Yes | 30 |
| SCT-013-050 | 0–50 A | 0–1 V | Yes | 50 |
| SCT-013-060 | 0–60 A | 0–1 V | Yes | 60 |
How do you calculate the burden resistor?
To turn the SCT-013-000's current into a voltage the Arduino can read, you fit a burden resistor across the winding's leads. It is chosen so that at the largest current the signal's peak does not exceed half of the ADC range. For 100 A the maths goes like this: first convert the RMS current to its peak, 100 × 1.414 = 141.4 A. The secondary peak current is 141.4 / 2000 = 70.7 mA. On the Uno the mid-point is 2.5 V, so the resistor can be at most 2.5 / 0.0707 = 35.4 Ω; you pick the next standard value down, 33 Ω. On the ESP32 and Pico the mid-point is 1.65 V: 1.65 / 0.0707 = 23.3 Ω, so 22 Ω. If your supply never gets near 100 A, a larger resistor gives better resolution. EmonLib's calibration constant comes from the same numbers: ICAL = 2000 / R. You can check standard values with the standard resistor tool and the voltages with the Ohm's law calculator.
| Maximum current | Secondary peak current | Uno (5 V) burden and ICAL | ESP32 / Pico (3.3 V) burden and ICAL |
|---|---|---|---|
| 100 A | 70.7 mA | 33 Ω, ICAL 60.6 | 22 Ω, ICAL 90.9 |
| 50 A | 35.4 mA | 68 Ω, ICAL 29.4 | 39 Ω, ICAL 51.3 |
| 30 A | 21.2 mA | 100 Ω, ICAL 20 | 68 Ω, ICAL 29.4 |
| 20 A | 14.1 mA | 150 Ω, ICAL 13.3 | 100 Ω, ICAL 20 |
Mid-point bias circuit and wiring table
The signal from the clamp is alternating: it swings positive for half a cycle and negative for the other half. The Arduino's ADC cannot read negative voltages, and a negative voltage can even damage the pin. So you build a mid-point (bias) circuit that sits the signal at half the supply voltage: two 10 kΩ resistors form a voltage divider between supply and GND, and a 10 µF capacitor on the middle node holds that voltage steady. One lead of the clamp goes to this mid-point, the other to the analog pin. The signal then swings around 2.5 V on the Uno and around 1.65 V on the ESP32 and Pico. The divider draws only about 0.25 mA; you can confirm the values with the voltage divider calculator.
| Connection | Arduino Uno | ESP32 | Raspberry Pi Pico |
|---|---|---|---|
| CT lead 1 (jack tip) | A0 | GPIO34 | GP26 (ADC0) |
| CT lead 2 (jack sleeve) | Mid-point | Mid-point | Mid-point |
| Upper divider resistor 10 kΩ | 5V | 3V3 | 3V3(OUT) |
| Lower divider resistor 10 kΩ | GND | GND | GND |
| 10 µF capacitor (between mid-point and GND) | Required | Required | Required |
| Burden resistor (SCT-013-000 only, across the CT leads) | 33 Ω | 22 Ω | 22 Ω |
| Mid-point voltage | 2.5 V | 1.65 V | 1.65 V |
| ADC resolution | 10 bit | 12 bit | 12 bit |
Step-by-step setup
- Check the model on the label: 100A:50mA needs a burden resistor, something like 30A/1V does not.
- Plug the jack into a 3.5 mm socket or breakout board; use the tip and sleeve pins.
- On the breadboard connect two 10 kΩ resistors in series between 5V (3V3 on ESP32 and Pico) and GND, and fit the 10 µF capacitor on the middle node (negative leg to GND).
- If you use an SCT-013-000, connect the 33 Ω resistor (22 Ω on the ESP32) between the two CT leads.
- Connect one CT lead to the mid-point and the other to A0 (GPIO34 on the ESP32).
- Install EmonLib from the Library Manager in the Arduino IDE and upload the code below.
- Clamp the sensor on an unloaded conductor and check for a zero reading, then run a known appliance (for example a 2000 W kettle) and compare.
Arduino Uno with EmonLib: RMS current and apparent power
The EmonLib library from the OpenEnergyMonitor project is a ready-made tool that samples the clamp's waveform and calculates RMS current. emon.current(pin, ICAL) sets the pin and the calibration constant, and emon.calcIrms(1480) takes 1480 samples and returns the RMS current in amps. On the Uno one analogRead takes about 112 µs, so 1480 samples make a window of roughly 165 ms, a little over eight cycles at 50 Hz. The library finds the mid-point with a software filter, so the first few readings are wrong; that is why the code throws away five readings at start-up. For apparent power we multiply the RMS current by the mains voltage (230 V).
1// SCT-013-000 + Arduino Uno: EmonLib ile RMS akım ve görünür güç
2// SCT-013-000 + Arduino Uno: RMS current and apparent power with EmonLib
3#include <EmonLib.h> // "EmonLib" (OpenEnergyMonitor)
4
5const int CT_PIN = A0; // CT sinyali A0'da / CT signal on A0
6const double ICAL = 60.6; // 2000 tur / 33 ohm burden = 60,6 / 2000 turns / 33 ohm burden
7const double MAINS_VOLTAGE = 230.0; // Şebeke gerilimi (V) / mains voltage (V)
8const double NOISE_FLOOR = 0.15; // Bunun altını 0 say (A) / treat anything below as 0 (A)
9
10EnergyMonitor emon;
11
12void setup() {
13 Serial.begin(115200);
14 emon.current(CT_PIN, ICAL);
15 // İlk ölçümler filtre otururken yanlıştır, at / first readings are wrong while the filter settles, discard
16 for (int i = 0; i < 5; i++) emon.calcIrms(1480);
17 Serial.println(F("Irms (A)\tGuc / Power (VA)"));
18}
19
20void loop() {
21 double irms = emon.calcIrms(1480); // Uno: 1480 örnek ~165 ms, ~8 periyot / Uno: 1480 samples ~165 ms, ~8 cycles
22 if (irms < NOISE_FLOOR) irms = 0;
23 double apparentPower = irms * MAINS_VOLTAGE;
24
25 Serial.print(irms, 2);
26 Serial.print(F("\t\t"));
27 Serial.println(apparentPower, 0);
28 delay(1000);
29}| Code part | What does it do? |
|---|---|
| ICAL = 60.6 | 2000 / 33 for an SCT-013-000 with 33 Ω; for voltage-output models, the current on the label (e.g. 30) |
| emon.calcIrms(1480) | Calculates RMS current from 1480 samples |
| NOISE_FLOOR = 0.15 | Pulls the 0.1–0.2 A of noise seen with no load down to zero |
| irms * MAINS_VOLTAGE | Gives apparent power (VA); real power also needs a voltage measurement |
| for (i < 5) calcIrms | Waits for the filter to settle at start-up |
RMS without a library: inside the formula
RMS (root mean square) is the DC equivalent that produces the same heat as an AC current, and you calculate it like this: square every sample, take the average, then the square root. For a pure sine wave the result is the peak divided by 1.414; a sine with a 14.1 A peak has an RMS value of 10 A. Most household devices, especially chargers and LED drivers, draw non-sinusoidal current, so calculating from the peak is misleading and you need true RMS. The code below is written for the SCT-013-030. It samples for 200 ms, which is exactly 10 cycles at 50 Hz and exactly 12 at 60 Hz. In a single pass it keeps the sum of the samples and the sum of their squares, removes the mid-point (the DC part) by subtracting the square of the mean, and finds the RMS value of the remaining AC part.
1// SCT-013-030 (30 A / 1 V) + Arduino Uno: kütüphanesiz RMS akım hesabı
2// SCT-013-030 (30 A / 1 V) + Arduino Uno: RMS current without a library
3const int CT_PIN = A0;
4const float VREF = 5.0; // Uno ADC referansı, ölçüp düzelt / Uno ADC reference, measure and adjust
5const float AMPS_PER_VOLT = 30.0; // SCT-013-030: 1 V RMS = 30 A
6const unsigned long WINDOW_MS = 200; // 50 Hz'de 10, 60 Hz'de 12 tam periyot / 10 cycles at 50 Hz, 12 at 60 Hz
7
8float readIrms() {
9 unsigned long start = millis();
10 unsigned long count = 0;
11 long sum = 0; // Örneklerin toplamı / sum of samples
12 unsigned long sumSq = 0; // Karelerin toplamı / sum of squares
13 while (millis() - start < WINDOW_MS) {
14 int s = analogRead(CT_PIN);
15 sum += s;
16 sumSq += (unsigned long)s * s;
17 count++;
18 }
19 float mean = (float)sum / count; // Orta nokta (DC) / mid-point (DC)
20 float variance = (float)sumSq / count - mean * mean; // Yalnız AC kısmın karesi / AC part squared
21 if (variance < 0) variance = 0;
22 float vrms = sqrt(variance) * VREF / 1024.0; // ADC adımından volta / ADC counts to volts
23 return vrms * AMPS_PER_VOLT;
24}
25
26void setup() {
27 Serial.begin(115200);
28}
29
30void loop() {
31 float irms = readIrms();
32 Serial.print(F("Irms: "));
33 Serial.print(irms, 2);
34 Serial.print(F(" A ~"));
35 Serial.print(irms * 230.0, 0); // 230 V varsayımıyla görünür güç / apparent power at 230 V
36 Serial.println(F(" VA"));
37 delay(500);
38}Real power, power factor and calibration
Multiplying the current by 230 gives apparent power (VA). For resistive loads such as kettles, heaters and incandescent bulbs this equals real power. In a fridge, a washing machine motor or a cheap adapter, current and voltage do not peak at the same moment; the power factor drops to 0.5–0.9 and your bill is based on real power (W). To measure real power you must sample the voltage at the same time: add a ZMPT101B voltage sensor or a 9 V AC adapter and use EmonLib's emon.voltage() and emon.calcVI(20, 2000); the library then gives realPower and powerFactor. To calibrate, run a resistive load whose power you know and compare with a clamp meter: a 2000 W kettle draws about 8.7 A at 230 V. If your reading differs, correct it with new ICAL = old ICAL × true current / measured current. If you want a ready, calibrated solution, the PZEM-004T energy meter gives voltage, current, power and kWh in one module.
Home energy monitoring with the ESP32

With an ESP32 you can bring the readings to your phone over Wi-Fi. There are three things to watch. First, the pin: ADC2 pins do not work while Wi-Fi is on, so use an ADC1 pin such as GPIO34. Second, the voltage: the mid-point must be 1.65 V and the SCT-013-000 needs a 22 Ω burden resistor; a divider fed from 5 V will damage the ESP32 pin. Third, EmonLib: on the ESP32 the library assumes a 10-bit ADC and shows readings four times too large; if you use it, add analogReadResolution(10) in setup(). The code below does not use the library: it calculates RMS current in a 200 ms window with the calibrated analogReadMilliVolts(), works out the power, accumulates kWh by multiplying by elapsed time and shows everything on a web page at the ESP32's IP address. To send the data to Home Assistant, see the ESP32 MQTT Home Assistant guide.
1// ESP32 + SCT-013-000: ev enerji izleme, anlık güç ve kWh web sayfasında
2// ESP32 + SCT-013-000: home energy monitor, live power and kWh on a web page
3#include <WiFi.h>
4#include <WebServer.h>
5
6const char* WIFI_SSID = "WIFI_ADIN"; // Wi-Fi adın / your Wi-Fi name
7const char* WIFI_PASS = "WIFI_SIFRESI"; // Wi-Fi şifren / your Wi-Fi password
8
9const int CT_PIN = 34; // ADC1 pini, Wi-Fi ile çalışır / ADC1 pin, works with Wi-Fi
10const float AMPS_PER_VOLT = 90.9; // 2000 tur / 22 ohm burden / 2000 turns / 22 ohm burden
11const float MAINS_VOLTAGE = 230.0; // Şebeke gerilimi (V) / mains voltage (V)
12const float NOISE_FLOOR = 0.2; // Bunun altını 0 say (A) / treat anything below as 0 (A)
13const unsigned long WINDOW_MS = 200; // 10 tam periyot (50 Hz) / 10 full cycles (50 Hz)
14
15WebServer server(80);
16float irms = 0, power = 0;
17double energyWh = 0;
18unsigned long lastMeasure = 0;
19
20float readIrms() {
21 uint32_t n = 0, sum = 0;
22 uint64_t sumSq = 0;
23 unsigned long start = millis();
24 while (millis() - start < WINDOW_MS) {
25 uint32_t mv = analogReadMilliVolts(CT_PIN); // Kalibre edilmiş mV / calibrated millivolts
26 sum += mv;
27 sumSq += (uint64_t)mv * mv;
28 n++;
29 }
30 double mean = (double)sum / n; // Orta nokta, ~1650 mV / mid-point, ~1650 mV
31 double variance = (double)sumSq / n - mean * mean;
32 if (variance < 0) variance = 0;
33 return sqrt(variance) / 1000.0 * AMPS_PER_VOLT; // mV RMS -> A
34}
35
36void handleRoot() {
37 String html = "<html><head><meta charset='utf-8'><meta http-equiv='refresh' content='5'>"
38 "<meta name='viewport' content='width=device-width'></head><body style='font-family:sans-serif'>"
39 "<h2>BlueGrays Enerji / Energy</h2>";
40 html += "<p>Akim / Current: " + String(irms, 2) + " A</p>";
41 html += "<p>Guc / Power: " + String(power, 0) + " W</p>";
42 html += "<p>Enerji / Energy: " + String(energyWh / 1000.0, 3) + " kWh</p></body></html>";
43 server.send(200, "text/html", html);
44}
45
46void setup() {
47 Serial.begin(115200);
48 analogSetPinAttenuation(CT_PIN, ADC_11db); // 0-3,1 V aralığı / 0-3.1 V range
49 WiFi.begin(WIFI_SSID, WIFI_PASS);
50 while (WiFi.status() != WL_CONNECTED) {
51 delay(500);
52 Serial.print(".");
53 }
54 Serial.print("\nIP: ");
55 Serial.println(WiFi.localIP());
56 server.on("/", handleRoot);
57 server.begin();
58 lastMeasure = millis();
59}
60
61void loop() {
62 server.handleClient();
63 if (millis() - lastMeasure >= 2000) {
64 irms = readIrms();
65 if (irms < NOISE_FLOOR) irms = 0;
66 power = irms * MAINS_VOLTAGE; // Görünür güç, güç faktörü 1 varsayımı / apparent power, assumes PF = 1
67 unsigned long now = millis();
68 energyWh += power * (now - lastMeasure) / 3600000.0; // Wh biriktir / accumulate Wh
69 lastMeasure = now;
70 Serial.printf("%.2f A %.0f W %.3f kWh\n", irms, power, energyWh / 1000.0);
71 }
72}SCT-013 with the Raspberry Pi Pico (MicroPython)
The same circuit works on the Raspberry Pi Pico: take the mid-point from a divider between 3V3(OUT) and GND and connect the signal to GP26 (ADC0). In MicroPython read_u16() returns a value from 0 to 65535; the Pico's ADC is really 12-bit, so the code shifts the value 4 bits to the right. The example is written for the SCT-013-030; with an SCT-013-000 and a 22 Ω burden resistor, set AMPS_PER_VOLT to 90.9.
1# Raspberry Pi Pico + SCT-013-030: MicroPython ile RMS akım
2# Raspberry Pi Pico + SCT-013-030: RMS current with MicroPython
3from machine import ADC
4import time, math
5
6adc = ADC(26) # GP26 = ADC0
7VREF = 3.3 # Pico ADC referansı / Pico ADC reference
8AMPS_PER_VOLT = 30.0 # SCT-013-030: 1 V RMS = 30 A
9
10def read_irms(window_ms=200):
11 n = 0
12 total = 0
13 total_sq = 0
14 start = time.ticks_ms()
15 while time.ticks_diff(time.ticks_ms(), start) < window_ms:
16 s = adc.read_u16() >> 4 # 16 bitten 12 bite / 16-bit to 12-bit
17 total += s
18 total_sq += s * s
19 n += 1
20 mean = total / n
21 variance = max(total_sq / n - mean * mean, 0) # Yalnız AC kısım / AC part only
22 vrms = math.sqrt(variance) * VREF / 4096
23 return vrms * AMPS_PER_VOLT
24
25while True:
26 irms = read_irms()
27 print("Irms: {:.2f} A ~{:.0f} VA".format(irms, irms * 230))
28 time.sleep(1)SCT-013 project ideas
- Home energy dashboard: clamp the main supply and follow live power and daily kWh on your phone, with charts in Home Assistant.
- Washing machine finished alert: when the current stays below 0.2 A for a few minutes, send a message with a Telegram bot.
- Pump and compressor protection: raise an alarm if a motor draws more current than expected or none at all.
- Comparison with the meter: check your calibration by comparing your kWh with the value from the electricity meter reading project.
- Consumption per appliance: use a line splitter to work out the hourly cost of a single appliance such as a heater or air conditioner.
Common errors and how to fix them
| Symptom | Likely cause | Fix |
|---|---|---|
| Reading is zero while the appliance runs | Clamp is around a cable carrying both live and neutral | Clamp a single conductor only |
| 0.1–0.3 A shown with no load | ADC noise, filter not settled | Discard the first readings, use a NOISE_FLOOR threshold |
| Values four times too high on the ESP32 | EmonLib assumes a 10-bit ADC | Add analogReadResolution(10) or use the window method |
| Reading stops rising at high load | Burden resistor too large, the signal clips | Lower the resistor to the value in the table |
| No signal at all | The jack's middle ring was used | Connect the tip and sleeve contacts |
| Readings jump around | No mid-point capacitor, long wires | Fit the 10 µF capacitor, shorten the wires |
| ESP32 reading always 0 or stuck | ADC2 pin clashes with Wi-Fi | Use an ADC1 pin between GPIO32 and GPIO39 |
Because it measures current without touching the wire, the SCT-013 is the safest starting point for home energy monitoring projects; with the right burden resistor, a solid mid-point circuit and the single-conductor rule you can reach an accuracy of a few percent. If you want to show your readings on an LCD or OLED, send them over Wi-Fi or log them to microSD, the BlueGrays app has step-by-step circuit diagrams and code for digital voltmeter, I2C LCD, ESP32 web server and data logger projects.
Frequently asked questions
What is the difference between the SCT-013-000 and the SCT-013-030?
The SCT-013-000 has a current output, gives 50 mA at 100 A and needs a burden resistor that you fit. The SCT-013-030 has the burden resistor inside, gives 1 V at 30 A and connects directly to the mid-point circuit.
Which burden resistor should I use with the SCT-013?
To measure 100 A with an SCT-013-000, use 33 Ω on an Arduino Uno and 22 Ω on 3.3 V boards such as the ESP32 and Pico. For a lower maximum current you can use a larger resistor; the formula is R = (Vcc / 2) / (Imax × 1.414 / 2000).
Can the SCT-013 measure DC current?
No. The SCT-013 is a current transformer and only reacts to a changing magnetic field, so it measures AC current only. For DC current use sensors such as the ACS712 or INA219.
Why does my SCT-013 read zero?
The most common reason is that the clamp is around a cable carrying both live and neutral; the fields of the two currents cancel. Clamp a single conductor and check that the jack's tip and sleeve are connected and the mid-point circuit is in place.
How do I calculate watts with the SCT-013?
Multiply the RMS current by the mains voltage to get apparent power (VA); for resistive loads this equals watts. For motors and electronic devices you need to measure the voltage too, with a sensor such as the ZMPT101B, and use EmonLib's calcVI function to get real power.
Can I use the SCT-013 with an ESP32?
Yes. Set the mid-point to 1.65 V from 3.3 V, use a 22 Ω burden resistor for the SCT-013-000 and connect the signal to an ADC1 pin such as GPIO34. If you use EmonLib, remember to add analogReadResolution(10).
Projects to build after reading this
See all projects
Digital Voltmeter with LCD Display
Find out how much voltage a battery or power adapter gives with a meter you built yourself.

Lighting 220V Bulb with Push Button
As long as you hold the button, a real 220-volt bulb stays lit, and it goes out the moment you let go.

Lighting 220V Bulb with Remote Control
Switch a real light bulb in your home on and off with a TV remote, without getting up from the sofa.

Using LCD Screen with I2C
Give your Arduino its own screen and make it write its first message. The two-line LCD screen hooks up with just a few wires; a greeting appears on the top line, then a second message on the bottom…

ESP32 I2C LCD Display (16x2)
In this project we connect a 16x2 character LCD to the ESP32 over I2C and display text. With I2C, just 2 data pins (SDA and SCL) control the screen, instead of the 6+ pins a classic parallel connection wastes. The code prints a fixed message on the first line and a counter that goes up every second on the second. At startup an I2C scanner also prints the display's address to the Serial Monitor (usually 0x27 or 0x3F).

ESP32 Wi-Fi STA Connection (with LCD Screen)
In this project, we connect the ESP32 to the home Wi-Fi network in Station (STA) mode in a secure, fault-tolerant manner. We store the SSID and password in a separate secrets.h file to prevent leaking to Git, set up an auto-reconnect mechanism, and display the RSSI signal level and IP address on an I2C LCD screen. The internal LED works as a status indicator. It is a production-grade connection manager.

ESP32 Asynchronous Web Server (with IP Display on LCD)
In this project, we’re turning the ESP32 into an asynchronous web server that you can control from your phone or computer on the same Wi-Fi network. Thanks to the ESPAsyncWebServer library, the server can process multiple requests simultaneously (unlike the classic WebServer.h, which blocks on a single request). You’ll be able to open the ESP32’s IP address in a browser and click the ON/OFF buttons (the /on and /off routes) to turn the LED connected to GPIO 5 on and off.

ESP32 Temperature Data Logger (DHT22 + DS1307 RTC + microSD + OLED)
Build a timed temperature and humidity logger with the ESP32! A DHT22 sensor reads temperature and humidity once a minute, and each reading is saved to a microSD card in CSV format with a real-time stamp from the DS1307 RTC module. The OLED display shows the latest temperature, humidity, timestamp and total number of records live, in large text.
More articles
BlueGrays app
Build this circuit step by step on your phone
Wiring diagram, code and parts list on one screen. 500+ Arduino, ESP32, ESP8266, Pico, mBot and micro:bit projects ready to build.
Scan with your phone
Point your camera at the code and your phone's app store opens.
or open the store

