U4/Sensors

ESP32 Compatible Sensors

Wiring diagrams, pinouts, specs and working code for every sensor in the catalog - so you go from bare module to live readings, fast.

Need a board to run them? Browse ESP32 boards →
127 sensors Wiring diagrams Compile-tested code I2C · SPI · UART & more
serial monitor · 115200 baud
BME280   23.4 C  45.2 %RH  1013 hPa
LD2410   presence: yes  1.82 m
VL53L0X  distance: 142 mm
MH-Z19   CO2: 618 ppm
DS18B20  probe: 21.9 C
HC-SR04  distance: 88 cm
Live readings - the fun part of every build
127
Sensors documented
9
Categories
12
Protocols
5
Code frameworks

Browse by category

9 categories
environment
Temperature, humidity and pressure
30
Air Quality
Gas and particulate monitoring
6
Human Presence
PIR and mmWave radar
14
distance
Ultrasonic and laser ToF
12
SIM
Cellular connectivity
11
servo
Motors and drivers
5
RTC
Real-time clocks
4
NFC
RFID and tag readers
3
KY-0xx module
37-in-1 kit modules
42

Browse by protocol

12 protocols

The right sensor for the job

quick picks
You want to...Start withWhyMore options
Measure temperature & humiditySHT40 · BME280Accurate I2C parts; the BME280 adds barometric pressure30 environment sensors →
Measure temperature where it's wet - outdoors, soil, liquidsDS18B20Sealed waterproof probe on a long lead - rain, ponds, soil, freezers30 environment sensors →
Monitor CO2 levelsMH-Z19True NDIR CO2 measurement, not a VOC estimate6 air quality sensors →
Detect a person sitting stillLD241024 GHz mmWave radar picks up micro-motion PIR misses14 presence sensors →
Measure distance on a budgetHC-SR04Ultrasonic, roughly 2-400 cm, needs just two GPIOs12 distance sensors →
Measure distance preciselyVL53L0X · VL53L1XLaser time-of-flight, millimeter readings - L0X to ~2 m, L1X to ~4 m12 distance sensors →
Drive many servos at oncePCA968516 PWM channels over I2C, offloads timing from the ESP325 servo modules →
Read NFC / RFID tagsPN532Reads and writes 13.56 MHz tags over I2C, SPI or UART3 NFC / RFID modules →

Popular sensors

See all 50 →

Buyer's guides

from the blog

Common questions

Do 5V sensor modules work with the ESP32?▾
The ESP32 runs 3.3V logic and its GPIOs are not 5V tolerant. Many modules work fine from a 3.3V supply; some want 5V power but still signal at safe levels; a few need a level shifter or voltage divider on the data lines. The wiring table on each sensor page shows the safe hookup for that exact module.
What are the default I2C pins on the ESP32?▾
GPIO21 (SDA) and GPIO22 (SCL) on the classic ESP32 dev boards these guides target. The wiring diagrams and code examples use those pins unless a page says otherwise, and most breakout boards bring their own pull-up resistors.
What are the default SPI pins on the ESP32?▾
The examples use the VSPI defaults: SCK on GPIO18, MISO on GPIO19, MOSI on GPIO23, with GPIO5 as the chip-select. Any free GPIO can serve as chip-select, which is how several SPI devices share one bus.
Which pins do UART sensors connect to?▾
The examples use UART2: sensor TX to GPIO16 (RX2) and sensor RX to GPIO17 (TX2). That leaves UART0 free for flashing and the serial monitor, and the ESP32 can remap its UARTs to most other GPIOs if those pins are taken.
Can the ESP32 read analog sensors?▾
Yes - use the ADC1 pins (GPIO32 to GPIO39) and convert with raw * 3.3 / 4095 at the default 12-bit resolution. The examples avoid ADC2 pins because they stop working while Wi-Fi is active.
Which code frameworks do the examples cover?▾
Every sensor page carries compile-tested examples for Arduino IDE, ESP-IDF, PlatformIO and MicroPython, and nearly all include ESPHome as well - a few modules simply have no ESPHome support. Each example names the libraries or components it needs.
How many I2C sensors can share one bus?▾
Dozens in practice, as long as every device has a distinct address - you will find each sensor's address in its wiring notes. When two modules share a fixed address, an I2C multiplexer such as the TCA9548A puts them on separate channels.