Hardware
Sensores IoT: panorama técnico por categoría y bus
Sensores IoT por categoría: ambientales (BME280, SHT40), IMU, presencia (PIR, mmWave), corriente y GPS. Buses I2C/SPI/UA
Sensores IoT: panorama técnico por categoría y bus
Updated: 2026-05-24
Executive summary
- Sensors are the entry point of any IoT system: they transduce physical quantities (temperature, humidity, acceleration, presence, current) into digital or analog electrical signals that the MCU can read.
- They are classified by physical category (environmental, motion, presence, electrical, position) and by data bus (I2C, SPI, UART/serial, analog/ADC, 1-Wire, SDI-12).
- The most common in professional IoT projects: the BME280 (temp+humidity+pressure), SHT40 (high-precision temp+humidity), MPU-6050/ICM-42688 (6-axis IMU), PIR HC-SR501 (passive presence), LD2410 (active mmWave presence), ACS712/SCT013 (AC current), u-blox NEO-M9N (GNSS/GPS).
- Selection criteria that matter: measurement range/resolution, absolute vs relative accuracy, operating current, the bus available on the MCU, packaging (IP67 for outdoors), cost, and availability through European distribution.
- Most sensors connect to an ESP32 or similar in minutes; the complexity lies in calibration, temperature compensation, and low-interference PCB design.
Why the sensor is the real bottleneck
An IoTITermIoT (Internet of Things)The IoT (Internet of Things) is the network of physical objects with sensors, software and connectivity that collect and exchange data and act autonomously.View profile system can have the best MCU, the best MQTTProtocolMQTTThe standard pub/sub protocol of IoTView profile network, and the most sophisticated cloud platform. If the sensor measures poorly, everything else measures poorly. This obvious truth is frequently ignored in projects where sensors are bought on price from AliExpress without checking the datasheet.
The three most common mistakes:
- Confusing accuracy (how close to the true absolute value) with resolution (the smallest value the sensor can distinguish). A 16-bit sensor may have a resolution of 0.01 °C but an accuracy of ±2 °C.
- Not compensating for the self-heating of the MCU itself on the temperature sensor when they share the same PCB.
- Ignoring temporal drift: some low-cost sensors drift their zero offset by 1-2% per year.
This guide organizes the most-used sensors in IoT projects by category and bus, with real specifications and selection criteria, no filler.
Category 1: Environmental sensors (temperature, humidity, pressure)
These are the most common in smart cities, buildings, industry, and precision agriculture. Most use I2C or SPI.
BME280 — Bosch Sensortec
The de facto standard for maker projects and many commercial products. It measures temperature, relative humidity, and barometric pressure in a tiny chip (2.5 × 2.5 mm LGA).
| Parameter | Value |
|---|---|
| Temperature | -40 to +85 °C, accuracy ±1 °C, resolution 0.01 °C |
| Humidity | 0-100% RH, accuracy ±3% RH, response time 1 s |
| Pressure | 300-1100 hPa, accuracy ±1 hPa |
| Bus | I2C (0x76/0x77) or SPI |
| Operating current | ~3.6 µA at 1 Hz |
| Sleep current | ~0.1 µA |
| Price | ~2-4 USD module with regulator |
The BME280BHardwareBME280Temperature, humidity and barometric pressure sensorView profile has internal temperature compensation that affects the humidity reading: always read temperature first for correct compensation. To measure air temperature, distance it from the PCB's heat with a perforated cover or a separate location.
SHT40 — Sensirion
When absolute accuracy matters more than price. Sensirion is the reference manufacturer for humidity sensors in industrial and medical applications.
| Parameter | SHT40 | BME280 |
|---|---|---|
| Temperature accuracy | ±0.2 °C (typ.) | ±1 °C |
| Humidity accuracy | ±1.8% RH (typ.) | ±3% RH |
| Bus | I2C (0x44/0x45) | I2C / SPI |
| Operating current | ~0.4 µA @ 0.1 Hz | ~3.6 µA @ 1 Hz |
| Price | ~4-8 USD | ~2-4 USD |
The SHT40's advantage is its integrated heater: by activating it for 1 s at high temperature, it evaporates condensation from the sensor without disassembly, crucial in environments with cyclical high humidity (greenhouses, cold rooms).
DS18B20 — Maxim/Analog Devices
The most widely installed wired temperature sensor in the world. It uses the 1-Wire protocol: a single data pin (plus GND and VCC) lets you chain multiple sensors on the same cable, each with a unique 64-bit ID.
Accuracy ±0.5 °C between -10 and +85 °C. A waterproof submersible TO-92 package version is widely used to measure the temperature of liquids, agricultural soil, and pipes.
Category 2: IMUs — Inertial Measurement Units
They measure linear acceleration and angular velocity (gyroscope). Essential in wearables, robotics, fall detection, and industrial vibration.
MPU-6050 — InvenSense (TDK)
The most popular 6-axis IMU (3-axis accelerometer + 3-axis gyroscope) in maker and education. I2C or SPI bus, with an internal DMP to compute angles without using the MCU's CPU.
| Parameter | Value |
|---|---|
| Accelerometer | ±2/4/8/16 g, 16-bit |
| Gyroscope | ±250/500/1000/2000 °/s, 16-bit |
| Bus | I2C (0x68/0x69) |
| Current | ~3.9 mA active, 5 µA sleep |
| Price | <1 USD chip, ~2 USD module |
For commercial production the MPU-6050MHardwareMPU-60506-axis IMU (accelerometer + gyroscope)View profile is discontinued; its successor is the ICM-42688-P (also TDK/InvenSense), with better noise, lower consumption, and 24 MHz SPI.
LSM6DSO — STMicroelectronics
ST's alternative, with a 6-axis accelerometer + gyroscope plus a hardware pedometer and activity detection. Widely used in wearables and medical applications where certification and long-term support are sought. Price ~2-3 USD.
Category 3: Presence and motion detection
The difference between a PIR (passive infrared sensor) and mmWave (millimeter-wave radar) is substantial: the PIR detects thermal changes from moving bodies; mmWave detects static presence via micro-Doppler, even people sitting or sleeping.
HC-SR501 — generic PIR
The reference PIR in maker projects. It detects motion within ~5-7 m, a 120° angle, with sensitivity and hold-time adjustment via potentiometer. A single digital output pin (HIGH when it detects motion).
Real-world limitations: false positives from abrupt temperature changes (warm air currents, direct sun), it doesn't detect completely still people, and an initial "blind" time of ~60 s after power-on.
LD2410 / LD2410C — Hi-Link
The paradigm shift in presence detection: a mmWave radar (24 GHz) that detects the micro-Doppler of human breathing. It detects static presence (a person sitting, sleeping) where the PIR is blind.
| Parameter | LD2410 |
|---|---|
| Technology | FMCW radar 24 GHz |
| Motion detection | up to 6 m |
| Static detection | up to 6 m (breathing) |
| Detection angle | ±60° horizontal, ±40° vertical |
| Bus | UART 256000 baud |
| Current | ~90 mA active |
| Price | ~5-10 USD |
The LD2410 is the presence sensor the Home AssistantHTermHome AssistantHome Assistant is an open-source home automation platform focused on local control and privacy, with broad integration support.View profile/ESPHome ecosystem has adopted with the ESP32 over the last two years. Its UART output lets you configure detection zones and thresholds with proprietary commands.
Category 4: Electrical current (AC and DC)
Monitoring the electrical consumption of machines or circuits is fundamental in Industry 4.0, energy efficiency, and predictive maintenancePUse casePredictive maintenanceView profile.
ACS712 — Allegro
Hall-effect, non-intrusive (no series resistor). Variants for 5 A, 20 A, or 30 A. Analog output: 2.5 V at rest, sensitivity ~185/100/66 mV/A depending on the variant. Read via the MCU's ADC.
Typical accuracy ±1.5%, temperature offset ±0.02%/°C. Sufficient for consumption monitoring, not for precision energy metering.
SCT-013 — YHDC
A clamp-on current transformer. It clips around the cable without cutting the circuit. For AC current 0-100 A. Current output (convert to voltage with a burden resistor) or voltage directly in the "000" variants (3.3 V output via an internal clamp).
Widely used with the ESP32HardwareESP32Dual-core WiFi + BT/BLE SoC at €-tier priceView profile + the
EmonLib library for home consumption monitoring in 230 V AC installations. No direct contact with the power line.
INA226 — Texas Instruments
The standard for high-precision DC power measurement on digital buses (I2C). It measures differential voltage (shunt up to 36 V), current (with an external shunt resistor), and computed power. Resolution 1.25 µV in voltage mode, 2.5 µV in current mode. Widely used in battery management systems and solar panel monitoring.
Category 5: Position and location (GNSS/GPS)
u-blox NEO-M9N
The reference GNSS module for professional European projects (a Swiss manufacturer). It supports GPS, GLONASS, Galileo, and BeiDou simultaneously. Typical horizontal accuracy 1.5 m CEP. NMEA output over UART, plus proprietary UBX over SPI/I2C.
For low-cost asset trackers, the NEO-M8N (the previous generation) remains the most balanced option. Price ~25-40 USD for a complete module.
Quectel L76-L
A more economical alternative (~8-12 USD module). GPS + GLONASS, UART, integrated or external active antenna. Widely used in prototypes and small runs where BOM cost rules.
Data buses: I2C, SPI, UART, and analog
| Bus | Typical speed | No. of devices | Pins | Ideal use |
|---|---|---|---|---|
| **I2C** | 100 kHz / 400 kHz / 1 MHz | Up to 127 (by address) | 2 (SDA + SCL) | Environmental sensors, IMU, OLED displays |
| **SPI** | 1-80 MHz | Unlimited (CS per device) | 4+ (MOSI, MISO, SCK, CS×n) | SD cards, TFT displays, high-speed ADCs |
| **UART** | 9600-256000 baud | 1-to-1 (full-duplex) | 2 (TX + RX) | GPS, modems, gas sensors, LD2410 |
| **Analog (ADC)** | — | 1 per ADC pin | 1 | Resistive/capacitive sensors, potentiometers, pH |
| **1-Wire** | ~16 kbps | Many chained | 1 | DS18B20 in a temperature sensor network |
I2C is the most convenient bus for prototyping: two shared wires, mature libraries in Arduino
CompanyArduinoOpen source hardware and software platform for makersView profile/ESP-IDF/Zephyr, and most breakouts include pull-ups. The limitation is speed (400 kHz is the practical maximum on long cables) and the fact that all devices share the same bus—an address conflict blocks everything.
SPI is faster and more deterministic but uses more pins (one CS per device). Necessary when working with high-sampling-rate sensors (an IMU at 8 kHz, an audio ADC).
How to choose the right sensor
The process, in order of priority:
- Define the range and the quantity: temperature from -20 to +80 °C, or from -200 to +400 °C? Filter by this first.
- Define the accuracy you actually need: ±1 °C is enough for most HVAC applications; a scale needs ±0.01 g. Accuracy has a cost.
- Check the bus available on your MCU: an ESP32 has multiple I2C and SPI buses; an MCU with only UART limits you to serial sensors.
- Consult the datasheet, not the AliExpress description: check error-vs-temperature curves, response time, and consumption in the manufacturer's datasheet, not on the generic module listing.
- Evaluate the packaging: for outdoors you need IP65 minimum (IP67 for immersion). Breakouts with a bare DHT22 don't withstand rain.
- Calculate battery consumption: a sensor that draws 1 mA for 10 ms every 60 s has an average consumption of 0.17 µA—basically nothing. One that draws 90 mA continuously (mmWave radar) changes the battery design entirely.
Real code: read the BME280 over I2C with an ESP32 (Arduino)
#include <Wire.h>
#include <Adafruit_BME280.h>
#include <PubSubClient.h>
#include <WiFi.h>
Adafruit_BME280 bme;
WiFiClient espClient;
PubSubClient mqttClient(espClient);
void setup() {
Serial.begin(115200);
Wire.begin(21, 22); // SDA=GPIO21, SCL=GPIO22
if (!bme.begin(0x76)) {
Serial.println("BME280 not found. Check wiring and I2C address.");
while (1);
}
// Low-power mode: forced mode, oversampling x1
bme.setSampling(
Adafruit_BME280::MODE_FORCED,
Adafruit_BME280::SAMPLING_X1, // temperature
Adafruit_BME280::SAMPLING_X1, // pressure
Adafruit_BME280::SAMPLING_X1, // humidity
Adafruit_BME280::FILTER_OFF
);
WiFi.begin("ssid", "password");
while (WiFi.status() != WL_CONNECTED) delay(500);
mqttClient.setServer("broker.local", 1883);
mqttClient.connect("esp32-bme280");
}
void loop() {
bme.takeForcedMeasurement(); // take one sample and go back to sleep
char payload[80];
snprintf(payload, sizeof(payload),
"{\"temp\":%.2f,\"hum\":%.2f,\"pres\":%.1f}",
bme.readTemperature(),
bme.readHumidity(),
bme.readPressure() / 100.0F
);
mqttClient.publish("sensors/indoor/bme280", payload);
Serial.println(payload);
delay(60000); // send every 60 s
}This code uses the ESP32 in forced mode (the BME280 sleeps between measurements) and publishes the JSON with temperature, humidity, and pressure over MQTT. A subscriber on the cloud platform or on a local Raspberry Pi
CompanyRaspberry PiSingle-board computers and RP2040/RP2350 microcontrollersView profile broker receives the data in real time.
Primary sources
- Bosch Sensortec — BME280 datasheet (accessed: 2026-05)
- Sensirion — SHT4x datasheet (accessed: 2026-05)
- Hi-Link LD2410 product page (accessed: 2026-05)
Frequently asked questions
Which temperature sensor do you recommend for outdoors?+
The SHT40 from Sensirion (I2C) in a package with a PTFE membrane filter (which keeps out dust and water) is the standard in low-cost professional weather stations. For long cabling with multiple points, the DS18B20 in a waterproof TO-92 package with 1-Wire is more practical. Avoid the DHT22 outdoors without a proper enclosure: its plastic casing is not IP-rated.
What's the difference between PIR and mmWave for presence detection?+
The PIR detects changes in infrared radiation: it needs the body to move or a thermal difference to exist. It's blind to still people. mmWave (the LD2410, for example) emits 24 GHz radio and detects the micro-Doppler of breathing: it detects someone sitting or sleeping. For home automation and smart HVAC, mmWave is superior but draws 90 mA vs the <1 mA of a PIR in standby.
Can I connect several I2C sensors to the same ESP32?+
Yes. The I2C bus allows up to 127 devices with different addresses (in practice, far fewer due to pull-ups and cable capacitance). Each manufacturer assigns a fixed address (most configurable between two values via a selection pin). A common problem: two BME280s share addresses 0x76 and 0x77, so only two on the same bus; for more points, add a TCA9548A multiplexer (8 I2C channels).
Which current sensor is more accurate, the ACS712 or the INA226?+
The INA226 is significantly more accurate for DC current measurement: ±0.1% vs ±1.5% for the ACS712. The ACS712 has the advantage of working in AC and DC with no series resistor (Hall effect). For DC energy monitoring on a battery, solar panels, or a digital power bus, use the INA226 with a precision shunt resistor. For home AC consumption monitoring: an SCT-013 clamp transformer with the EmonLib library.
Which bus should I use when the MCU has only 2 free pins?+
I2C only needs 2 pins (SDA + SCL) and allows multiple devices. It's the obvious answer when there's a pin constraint. If the 2 pins are for something else, consider 1-Wire (1 pin) for DS18B20 temperature sensors.
Are generic AliExpress sensors reliable?+
It depends on the manufacturer of the actual chip. A "BME280" module from AliExpress that carries the original Bosch chip (verifiable by the chip marking) is just as reliable as one from Adafruit or Waveshare—the difference is in the supporting module (solder joints, regulator, pull-ups). The real problem is when the module carries a clone of the chip (a BMP280 instead of a BME280, for example) without disclosure. Check the actual chip with i2cdump and compare the manufacturer ID registers before trusting the data.