Components · 9 min read

HC-12 Arduino: 433 MHz Wireless Serial Module, AT Commands, Range

HC-12 Arduino guide: a 433 MHz wireless UART link, channel, baud rate and power via AT commands, FU modes and range table, antennas, ESP32 and Pico code.

The HC-12 is a wireless serial module for Arduino projects that works in the 433 MHz band and replaces the TX and RX wires between two boards. Every byte you send with Serial.print() on one side comes out of the other module's TX pin unchanged; no library, address or packet setup is needed. The manufacturer quotes about 1 km of range in open space at the slowest settings and around 1.8 km in long-range mode. That makes it very handy for linking a garden sensor to a display indoors, monitoring a distant water tank or building a simple robot remote.

In this article you'll learn how the HC-12 works, how to connect it to an Arduino Uno, an ESP32 and a Raspberry Pi Pico, and how to set the channel, baud rate and power with AT commands. You'll also find a speed and range table for the FU modes, antenna choices, power supply tips, an example sketch that filters out corrupted packets, and when to choose the HC-12 over the nRF24L01 or LoRa. To refresh the basics of serial communication first, see What Is UART?.

What is the HC-12 and how does it work?

The HC-12 has two main chips: Silicon Labs' SI4463 radio chip and a small microcontroller that drives it. The microcontroller collects bytes from the UART, turns them into a radio packet and sends it; the other side receives the packet and outputs the bytes on its UART again. All you see is a serial port. The module is half duplex: it can't send and receive at the same moment, but it switches back to listening as soon as it has finished sending. That means both modules can act as transmitter and receiver.

FeatureValue
Radio chipSI4463
Frequency range433.4–473.0 MHz, channels 400 kHz apart
Channels001–100 (factory default 001 = 433.4 MHz)
Output power−1 dBm to +20 dBm (100 mW), 8 steps
Supply3.2–5.5 V
Current while sendingAround 100 mA at full power
Serial portUART, 1200–115200 baud, factory default 9600 baud 8N1
Range (manufacturer, open space)About 1 km in FU3 at 1200 baud, about 1.8 km in FU4
SizeAbout 27.8 × 14.4 mm, spring antenna or IPEX connector

HC-12 pins and wiring table

The module has five pins: VCC, GND, RXD, TXD and SET. Serial wiring is always crossed: the module's TXD goes to the board's RX and its RXD to the board's TX. When SET is pulled LOW the module enters AT command mode; when it's HIGH or left floating, the module is in normal (transparent) mode, as an internal resistor holds the pin HIGH.

HC-12 pinArduino UnoESP32Raspberry Pi Pico
VCC5V3V33V3 (OUT)
GNDGNDGNDGND
TXDD10 (SoftwareSerial RX)GPIO 16 (RX2)GP1 (UART0 RX)
RXDD11 (SoftwareSerial TX)GPIO 17 (TX2)GP0 (UART0 TX)
SETD9GPIO 4GP2
The most common mistake is wiring TXD and RXD straight through: if you connect TX to TX, no data gets across. The second is the power supply: at full power the module draws short 100 mA bursts while sending, and a weak USB port or breadboard power rail lets the voltage sag and packets get lost. A 100–470 µF capacitor between VCC and GND, close to the module, usually solves this.

On the Uno the hardware serial port (D0 and D1) is shared with USB, so our examples use SoftwareSerial on D10 and D11; SoftwareSerial is reliable at 9600 baud but starts making errors at 57600 and above. Many people connect the HC-12 straight to the Uno; still, for long-term use a 1 kΩ series resistor in the line from the Uno's TX to the HC-12's RXD is a cheap precaution. The manufacturer recommends adding a 1N4007 diode in series with the supply above 4.5 V if the module will transmit continuously for a long time, so the internal regulator doesn't overheat.

First connection and AT commands, step by step

  1. Connect an HC-12 to each of two Arduinos as in the table above; make sure the antennas are fitted.
  2. Upload the bridge sketch below to both boards.
  3. Open the Serial Monitor at 9600 baud with the "New Line" line ending.
  4. Type AT in one board's Serial Monitor; if the module answers OK, your wiring is correct.
  5. Type AT+RX to see all of the module's settings: baud rate, channel, mode and power.
  6. Type something that doesn't start with AT; the text should appear in the other board's Serial Monitor.
C++ (Arduino IDE)
1// HC-12: Seri Monitör köprüsü + AT komutları / Serial Monitor bridge + AT commands
2// "AT" ile başlayan satırlar modüle komut olarak, diğerleri telsizle gider / lines starting with "AT" configure the module, others go over the air
3#include <SoftwareSerial.h>
4
5#define HC12_SET 9                 // SET pini: LOW = komut modu / LOW = command mode
6SoftwareSerial hc12(10, 11);       // D10 = RX (HC-12 TXD), D11 = TX (HC-12 RXD)
7
8void sendAT(const String& cmd) {
9  digitalWrite(HC12_SET, LOW);     // komut moduna geç / enter command mode
10  delay(50);                       // modül en az 40 ms ister / the module needs at least 40 ms
11  hc12.print(cmd);
12  unsigned long t0 = millis();
13  while (millis() - t0 < 300) {    // cevabı Seri Monitör'e aktar / pass the reply to the Serial Monitor
14    if (hc12.available()) Serial.write(hc12.read());
15  }
16  digitalWrite(HC12_SET, HIGH);    // normal (şeffaf) moda dön / back to transparent mode
17  delay(100);                      // geçiş yaklaşık 80 ms sürer / switching takes about 80 ms
18}
19
20void setup() {
21  Serial.begin(9600);
22  hc12.begin(9600);                // fabrika ayarı 9600 baud / factory default 9600 baud
23  pinMode(HC12_SET, OUTPUT);
24  digitalWrite(HC12_SET, HIGH);
25  Serial.println(F("HC-12 hazir. Ornek / Ready. Try: AT+RX"));
26}
27
28void loop() {
29  if (Serial.available()) {
30    String line = Serial.readStringUntil('\n');
31    line.trim();                   // satır sonunu at / drop the line ending
32    if (line.startsWith("AT")) sendAT(line);
33    else if (line.length()) hc12.println(line);   // karşı tarafa gönder / send to the other side
34  }
35  while (hc12.available()) Serial.write(hc12.read());   // gelen telsiz verisi / incoming radio data
36}

When the sketch sees a line starting with AT, it pulls SET LOW, waits 50 ms and sends the command. The manufacturer states that the module needs at least 40 ms to enter command mode and about 80 ms to return to normal mode, which is why the delays are there. Replies come back on the same serial port and are passed on to the Serial Monitor.

AT commandWhat it doesExample reply
ATConnection testOK
AT+RXShows all settingsOK+B9600, OK+RC001, OK+RP:+20dBm, OK+FU3
AT+B9600Sets the serial baud rate (1200–115200)OK+B9600
AT+C021Sets the channel (001–100)OK+C021
AT+FU3Selects the operating mode (FU1–FU4)OK+FU3
AT+P8Selects the output power (P1–P8)OK+P8
AT+VShows the firmware versionSomething like HC-12_V2.4
AT+DEFAULTRestores factory settings: 9600, C001, FU3, P8OK+DEFAULT
AT+SLEEPSleep mode; wakes the next time SET goes LOWOK+SLEEP
If you've forgotten the baud rate and can't reach the module, don't worry: power the module up while SET is tied to GND and it will listen for commands at 9600 baud 8N1 whatever its settings are. From there you can send AT+DEFAULT to restore everything. You can also connect the module straight to a computer with a USB-TTL adapter and configure it from a serial terminal.
CH340 USB-TTL adapter
CH340 USB-TTL adapter: the easiest way to connect an HC-12 to a computer without an Arduino and configure it with AT commands.

FU modes: speed, range and current

The HC-12 has four operating modes, and the mode you choose sets both the over-the-air data rate and the range. The factory default, FU3, is the most widely used; in this mode the air rate adjusts automatically to the serial baud rate. The rule is simple: the lower the serial baud rate, the longer the range. Two modules only hear each other if their baud rate, channel and mode match.

ModeIdle currentSerial baudTypical use
FU1About 3.6 mAAllModerate power saving, short delay
FU2About 80 µAOnly 1200, 2400, 4800Battery devices that send data rarely
FU3 (default)About 16 mA1200–115200General use, air rate follows the baud rate
FU4About 16 mAOnly 1200Longest range, small and infrequent packets
Serial baud in FU3Air data rateManufacturer's range (open space)
1200 and 24005000 bpsAbout 1000 m
4800 and 960015000 bpsAbout 600 m
19200 and 3840058000 bpsAbout 400 m
57600 and 115200236000 bpsAbout 100 m

In FU4 the air rate drops to 500 bps and the range rises to about 1.8 km, but in this mode you shouldn't send more than 60 bytes per packet and should wait at least 2 seconds between packets. These figures are upper limits measured in open country with good antennas; in town, between walls and trees, the real range is often less than half of that.

AT commandOutput powerApprox. mW
AT+P1−1 dBm0.8 mW
AT+P2+2 dBm1.6 mW
AT+P3+5 dBm3.2 mW
AT+P4+8 dBm6.3 mW
AT+P5+11 dBm12 mW
AT+P6+14 dBm25 mW
AT+P7+17 dBm50 mW
AT+P8 (default)+20 dBm100 mW

Every 3 dB step roughly doubles the power, but it doesn't double the range; to double the range you need about four times the power. The channel frequency is 433.4 MHz + (channel − 1) × 0.4 MHz: channel 1 is 433.4 MHz, channel 4 is 434.6 MHz and channel 100 is 473.0 MHz. As the channel number rises, the frequency moves away from the band the 433 MHz antenna is tuned for, and range may drop.

In Europe and Turkey the licence-free 433 MHz band runs roughly from 433.05 to 434.79 MHz, which only covers HC-12 channels 1–4. The transmit power allowed in this band is usually around 10 mW, so the factory setting of 100 mW is above that limit. In other countries, such as the US, different rules apply. If you're building a permanent installation, check the rules where you live; for most home projects AT+P4 or AT+P5 gives enough range.

Choosing an antenna

HC-12 modules usually come with a small spring antenna soldered to the board, which is enough for a few tens of metres indoors. For longer range you can attach an external 433 MHz antenna to versions with an IPEX (u.FL) connector. The cheapest solution is a quarter-wave wire antenna: at 433 MHz the wavelength is 300 / 433 ≈ 0.69 m, so a quarter is about 17.3 cm. Simply soldering a straight wire of that length to the antenna pad and keeping it vertical noticeably improves range over the spring antenna. Keep both antennas pointing the same way (both vertical), don't put the module inside a metal box and mount it as high as you can.

Example: wireless potentiometer and button

In real projects, sending a packet with a clear start and end is far more reliable than sending plain text. In the sketch below the transmitter sends the potentiometer and button values as <512,1,513>, where the last number is the sum of the first two. The receiver collects the packet between < and >, checks the sum, drops the packet if it's wrong and sets the LED brightness if it's valid. If no valid packet arrives for 1 second, it switches the LED off; this fail-safe behaviour is a lifesaver in projects that drive motors or relays.

C++ (Arduino IDE)
1// HC-12 ile potansiyometre ve buton gönder / send a potentiometer and a button over HC-12
2// Paket biçimi / packet format: <pot,buton,toplam>  ör. / e.g. <512,1,513>
3// Aynı kodu iki karta yükle; vericide ROLE_SENDER 1, alıcıda 0 / upload to both boards: 1 on the sender, 0 on the receiver
4#include <SoftwareSerial.h>
5
6#define ROLE_SENDER 1
7#define POT_PIN    A0
8#define BUTTON_PIN 2               // buton D2 ile GND arasında / button between D2 and GND
9#define LED_PIN    5               // alıcıda PWM LED (220 ohm ile) / PWM LED on the receiver (with 220 ohm)
10
11SoftwareSerial hc12(10, 11);       // RX, TX
12
13void setup() {
14  Serial.begin(9600);
15  hc12.begin(9600);
16  pinMode(BUTTON_PIN, INPUT_PULLUP);
17  pinMode(LED_PIN, OUTPUT);
18  pinMode(LED_BUILTIN, OUTPUT);
19}
20
21#if ROLE_SENDER
22void loop() {
23  int pot = analogRead(POT_PIN);                    // 0-1023
24  int btn = (digitalRead(BUTTON_PIN) == LOW) ? 1 : 0;
25  hc12.print('<'); hc12.print(pot); hc12.print(',');
26  hc12.print(btn); hc12.print(','); hc12.print(pot + btn);
27  hc12.println('>');
28  delay(200);                                       // saniyede 5 paket yeterli / 5 packets per second is plenty
29}
30#else
31char buf[24];
32uint8_t len = 0;
33bool inPacket = false;
34unsigned long lastGood = 0;
35
36void handlePacket() {
37  int pot, btn, sum;
38  char* p = strtok(buf, ",");  if (!p) return; pot = atoi(p);
39  p = strtok(NULL, ",");       if (!p) return; btn = atoi(p);
40  p = strtok(NULL, ",");       if (!p) return; sum = atoi(p);
41  if (sum != pot + btn || pot < 0 || pot > 1023) return;   // bozuk paketi at / drop a corrupted packet
42  analogWrite(LED_PIN, pot / 4);                   // 0-1023 -> 0-255
43  digitalWrite(LED_BUILTIN, btn);
44  lastGood = millis();
45  Serial.print(F("pot=")); Serial.print(pot); Serial.print(F(" btn=")); Serial.println(btn);
46}
47
48void loop() {
49  while (hc12.available()) {
50    char c = hc12.read();
51    if (c == '<') { inPacket = true; len = 0; }    // yeni paket başladı / a new packet starts
52    else if (c == '>' && inPacket) { buf[len] = '\0'; inPacket = false; handlePacket(); }
53    else if (inPacket && len < sizeof(buf) - 1) buf[len++] = c;
54    else inPacket = false;                         // çok uzun: paketi bırak / too long: give up
55  }
56  if (millis() - lastGood > 1000) analogWrite(LED_PIN, 0);   // 1 sn veri yoksa güvenli duruma geç / fail safe after 1 s
57}
58#endif
PartWhat it does
ROLE_SENDERLets you compile the same sketch as transmitter (1) or receiver (0)
< and >Mark the start and end of a packet and keep things in sync after lost bytes
Sum checkFilters out packets corrupted by radio noise
strtok and atoiTurn the comma-separated text into numbers
lastGoodTime of the last valid packet; turns the output off if the link drops

HC-12 with the ESP32: using Serial2

On the ESP32 you don't need SoftwareSerial because it has three hardware UARTs. Start Serial2 on GPIO 16 (RX) and GPIO 17 (TX) and connect the HC-12 there. Since the ESP32 uses 3.3 V logic and the HC-12 can run from 3.2 V, you can power the module straight from the 3V3 pin. The sketch below receives the packets from the Arduino transmitter, lights the built-in LED according to the button and answers every valid packet with an ACK.

C++ (Arduino IDE)
1// ESP32 + HC-12: Serial2 (GPIO 16/17) ile paket alma / receive packets on Serial2 (GPIO 16/17)
2// Arduino'daki verici kodunun paketlerini okur / reads the packets from the Arduino sender sketch
3#define HC12_RX  16                 // ESP32 RX2 <- HC-12 TXD
4#define HC12_TX  17                 // ESP32 TX2 -> HC-12 RXD
5#define HC12_SET 4                  // SET pini / SET pin
6#define LED_PIN  2                  // dahili LED / built-in LED
7
8char buf[24];
9uint8_t len = 0;
10bool inPacket = false;
11
12void setup() {
13  Serial.begin(115200);
14  Serial2.begin(9600, SERIAL_8N1, HC12_RX, HC12_TX);   // HC-12 ile aynı baud / same baud as the HC-12
15  pinMode(HC12_SET, OUTPUT);
16  digitalWrite(HC12_SET, HIGH);                         // normal mod / normal mode
17  pinMode(LED_PIN, OUTPUT);
18}
19
20void loop() {
21  while (Serial2.available()) {
22    char c = Serial2.read();
23    if (c == '<') { inPacket = true; len = 0; }
24    else if (c == '>' && inPacket) {
25      buf[len] = '\0';
26      inPacket = false;
27      int pot, btn, sum;
28      if (sscanf(buf, "%d,%d,%d", &pot, &btn, &sum) == 3 && sum == pot + btn) {
29        digitalWrite(LED_PIN, btn);
30        Serial.printf("pot=%d btn=%d\n", pot, btn);
31        Serial2.printf("ACK %d\n", pot);                // vericiye cevap / reply to the sender
32      }
33    }
34    else if (inPacket && len < sizeof(buf) - 1) buf[len++] = c;
35    else inPacket = false;
36  }
37}

Combining the ESP32's Wi-Fi with the HC-12 gives you a powerful setup: a battery-powered Arduino in the garden sends sensor data indoors over HC-12, and the ESP32 indoors receives it and passes it on to the internet. That way you can collect data even from places your Wi-Fi can't reach.

HC-12 with the Raspberry Pi Pico (MicroPython)

On the Pico, connect the HC-12 to UART0, that is GP0 (TX) and GP1 (RX). MicroPython needs no extra library; the UART class in the machine module is enough. The code below first reads the module's settings with AT+RX, then sends a packet every half second in the format the Arduino receiver understands, and prints any incoming data.

MicroPython
1# Raspberry Pi Pico + HC-12 (MicroPython): UART0 ile gönder ve al / send and receive on UART0
2from machine import UART, Pin
3import time
4
5uart = UART(0, baudrate=9600, tx=Pin(0), rx=Pin(1))   # GP0 -> HC-12 RXD, GP1 <- HC-12 TXD
6set_pin = Pin(2, Pin.OUT, value=1)                     # SET: 1 = normal mod / normal mode
7
8
9def at(cmd):
10    set_pin.value(0)          # komut modu / command mode
11    time.sleep_ms(50)
12    uart.write(cmd)
13    time.sleep_ms(300)
14    reply = uart.read()
15    set_pin.value(1)          # normal moda dön / back to normal mode
16    time.sleep_ms(100)
17    return reply
18
19
20print(at("AT+RX"))            # tüm ayarları göster / show all settings
21
22counter = 0
23while True:
24    uart.write("<%d,0,%d>\n" % (counter % 1024, counter % 1024))   # Arduino alıcısıyla aynı paket / same packet as the Arduino receiver
25    counter += 1
26    if uart.any():
27        print("Gelen / received:", uart.read())
28    time.sleep_ms(500)

HC-12 vs nRF24L01 vs LoRa

FeatureHC-12nRF24L01LoRa (SX1278)HC-05 Bluetooth
Frequency433 MHz2.4 GHz433 MHz2.4 GHz
InterfaceUARTSPISPIUART
LibraryNot neededRF24LoRaNot needed
Typical range100 m – 1 km, 1.8 km in FU450–100 m (~1 km with PA+LNA)1–3 km in town, up to 10 km in open space~10 m
Air data rate0.5–236 kbps250 kbps – 2 Mbps0.3–5.5 kbpsUp to the serial rate
Current while sending~100 mA (full power)~11–12 mA40–120 mA~30–40 mA
Best forA simple, long-range replacement for a serial cableFast remote control, multi-node networksVery distant, infrequent sensor dataShort range to a phone
nRF24L01 2.4 GHz wireless module
nRF24L01: the faster but shorter-range 2.4 GHz alternative, connected over SPI.

In short: if you want to drop the cable without changing your existing serial code at all, the HC-12 is the easiest way. If you're building a fast-reacting RC car or a network with many nodes, the nRF24L01 is a better fit. If you need a reading once a minute from a field kilometres away, LoRa takes the lead. To see every option side by side, look at the Arduino wireless communication guide.

HC-12 project ideas

  • A wireless DHT11 weather station that carries readings from a battery-powered sensor in the garden to an LCD indoors.
  • A tank gauge that measures the level of a rooftop water tank with an HC-SR04 and sends it to a display downstairs.
  • A robot car you can drive from a few hundred metres away with a joystick remote.
  • A wireless gate alarm that sounds a buzzer indoors when the garden gate opens.
  • A small radio network that sorts packets from several sensor stations by their number and shows them on one screen.

Common problems and fixes

SymptomCauseFix
No reply to ATSET not LOW, baud rate mismatch or TX/RX swappedCheck SET, restart the module with SET on GND, verify the crossed wiring
Data arrives as garbage charactersThe two modules, or Arduino and module, use different baud ratesCompare both modules with AT+RX and set them all to the same rate
Nothing arrives at allChannel or FU mode differsUse the same AT+C and AT+FU values on both modules
Works close up, drops out further awayWeak antenna, low power or high baud rateLower the baud rate, fit a 17.3 cm wire antenna, raise the AT+P value
Arduino resets while sendingThe 100 mA current burst pulls the supply downAdd a 470 µF capacitor, use a separate 5 V supply
Packets corrupt at 57600 baudSoftwareSerial makes errors at high speedUse 9600 on the Uno or choose a board with a hardware UART
When troubleshooting, first test both modules on the same desk, 1–2 metres apart, with factory settings. If it works on the desk, the problem isn't your settings or code but range, antenna or power. After changing settings, always confirm with AT+RX that both modules really have the same values.

The HC-12 is one of the few modules that carries the serial communication you already know hundreds of metres away with almost no code changes. To strengthen your grasp of serial communication, look at the wiring diagrams and code of the "2 Arduino One-Way Communication" and "2 Arduino Two-Way Communication" projects in the BlueGrays app step by step, then make the same idea wireless over the HC-12 with the packet format from this article.

Frequently asked questions

What is the range of the HC-12?

The manufacturer quotes about 1 km in open space in FU3 mode at 1200 baud, and about 1.8 km in FU4 mode. At the factory default of 9600 baud this drops to about 600 m. In town, behind walls and trees, the real range is usually much shorter; a good antenna and a low baud rate increase it noticeably.

How do I put the HC-12 into AT command mode?

Pull the SET pin to GND and wait at least 40 ms; the module then listens for AT commands on its serial port. When you set SET HIGH again, it returns to normal transmission mode after about 80 ms. If you don't know the baud rate, power the module up while SET is on GND and it will accept commands at 9600 baud.

How many HC-12 modules can talk to each other?

All HC-12s set to the same channel, mode and baud rate hear each other, so one transmitter can broadcast to many receivers at once. The module has no addressing, so with several stations you need to put a station number inside the packet. If two modules send at the same time the packets collide; set your stations to send at different times.

Which is better, the HC-12 or the nRF24L01?

They suit different jobs. The HC-12 gives you a longer-range serial link over UART with no library, but a lower air data rate. The nRF24L01 is much faster, draws less current and supports multi-node networks, but needs an SPI connection and the RF24 library.

Does the HC-12 work at 5 V?

Yes, the HC-12's supply range is 3.2–5.5 V, so it can be powered from the Arduino Uno's 5 V pin. For long-term use, a 1 kΩ series resistor in the Uno's TX line is a cheap precaution. On the ESP32 and the Pico, powering the module from 3.3 V is the simplest solution.

What frequency does the HC-12 use, and is it legal?

The HC-12 works on 100 channels between 433.4 and 473.0 MHz, with 433.4 MHz as the factory default. In Europe the licence-free 433 MHz band is roughly 433.05–434.79 MHz, so only the first 4 channels fall inside it, and the allowed power is low. Rules differ between countries, so check your local regulations for permanent installations and keep the power as low as you can.

See all projects
Temperature and Humidity with DHT11
AR-55Intermediate

Temperature and Humidity with DHT11

How warm is your room, and is the air humid or dry? The DHT11 sensor measures temperature and humidity, and the Arduino writes the values on a two-line LCD screen, refreshing every couple of seconds.

4.7(47)
96
HC-SR04 Distance Measurement (Serial Display)
AR-27Beginner

HC-SR04 Distance Measurement (Serial Display)

The HC-SR04 sensor works just like a bat finding its way in the dark: it sends out a sound you cannot hear, listens for the echo and measures how far away the object in front of it is.

4.6(52)
94
One-Way Communication Between 2 Arduinos
AR-57Intermediate
Premium

One-Way Communication Between 2 Arduinos

You get two Arduinos talking over a single wire: press the button on one and the LED on the other lights up, press it again and it goes off.

4.5(38)
51
Two-Way Communication Between 2 Arduinos
AR-58Intermediate
Premium

Two-Way Communication Between 2 Arduinos

Two Arduinos are wired together and talk to each other: press the button on one and the light on the other comes on, press it again and it goes off.

4.5(20)
26
Control an LED from Your Phone via Bluetooth
AR-34Beginner
Premium

Control an LED from Your Phone via Bluetooth

A small rehearsal for switching the lights in your room on and off from your phone.

4.8(69)
91
Bluetooth Controlled Car with L298N
AR-80Advanced
Premium

Bluetooth Controlled Car with L298N

Turn your phone into a remote and drive your own robot car. The Arduino receives commands from a remote-control app on your phone through a Bluetooth module and spins the wheels with a motor driver…

5.0(39)
66
ESP32 DHT22 Temperature and Humidity (with LCD Display)
ES-15Intermediate

ESP32 DHT22 Temperature and Humidity (with LCD Display)

This project measures ambient temperature and humidity using a DHT22 sensor and displays the data in real time on a 16x2 I2C LCD. Data is read from the sensor using the one-wire protocol via the Adafruit DHT library. This project serves as the foundation for IoT weather stations, smart home automation, or environmental monitoring systems in greenhouses. Communication with the DHT22 is established via the ESP32's GPIO 4 pin.

4.8(38)
57
ESP32 HC-SR04 Ultrasonic Distance Sensor
ES-14Intermediate

ESP32 HC-SR04 Ultrasonic Distance Sensor

The HC-SR04 ultrasonic sensor measures distance by timing how long its sound pulse takes to bounce off an object and return (time of flight). In this project the ESP32 sends a 10-microsecond pulse to the TRIG pin and reads the echo time from the ECHO pin with pulseIn(). The distance is shown in cm on a 16x2 I2C LCD. The HC-SR04 runs on 5V, so the ECHO pin needs a voltage divider, or the ESP32's 3.3V GPIO gets damaged.

4.9(29)
51