JAlcocerTech E-books

Chapter 7 — The Sensor Dictionary: DHT, MLX, and What to Buy First

There are hundreds of sensor types. These are the ones that appear repeatedly in real IoT projects — cheap, well-documented, and reliably supported by MicroPython and Arduino libraries.

Temperature and Humidity

DHT22 (also called AM2302): the workhorse. Measures temperature (-40 to +80°C) and relative humidity (0–100%). Single-wire protocol. One sensor, three pins (VCC, GND, DATA). Accuracy: ±0.5°C temperature, ±2–5% humidity. Update interval: minimum 2 seconds.

DHT11: cheaper, less accurate (±2°C, ±5% humidity), narrower range (0–50°C). Use it for learning and non-critical monitoring. Use the DHT22 for anything you care about.

Both sensors are susceptible to condensation. Don’t use them in environments where humidity regularly hits 100% — the readings will drift and eventually the sensor will fail.

Infrared (Non-Contact) Temperature

MLX90614: measures surface temperature remotely, without contact. Useful for measuring the temperature of leaves (plants), water surfaces, radiators, or human skin. I2C interface. Range: -70 to +380°C. Accuracy: ±0.5°C in the 0–50°C range.

For plant monitoring, the MLX90614 complements the DHT22: the DHT22 measures air temperature and humidity, the MLX90614 measures leaf surface temperature. The difference between the two is an input to VPD (Vapour Pressure Deficit) calculations — covered in Chapter 11.

MLX90614 infrared sensor — measures surface temperature without contact

Pi, ESP32, and MLX sensors assembled — the multi-sensor node for plant monitoring

Soil Moisture

Capacitive soil moisture sensors (generic, ~€2 each) measure the dielectric constant of soil, which correlates with moisture content. They don’t corrode like resistive sensors. They need calibration: take a reading in bone-dry soil (0% moisture baseline) and in fully saturated soil (100% baseline). Everything in between is interpolated.

CO2 and Air Quality

MH-Z19 (CO2, UART or PWM): measures actual CO2 concentration in ppm. Accurate, self-calibrating, ~€20. Useful for indoor air quality monitoring.

SGP30 (TVOC and eCO2, I2C): measures volatile organic compounds and estimated CO2. Less accurate than the MH-Z19 for CO2, but adds TVOC measurement. Cheaper (~€8).

The Bill of Materials for a Starting Kit

If you’re building your first IoT setup and want to cover the most common projects:

SensorQtyPrice (approx.)Use
DHT223€5 totalTemperature + humidity, multiple rooms
MLX906141€8Non-contact surface temperature
Capacitive moisture3€6 totalSoil monitoring
Tapo P1102€30 totalPower monitoring + smart switching
ESP32 (38-pin)2€10 totalSensor nodes
Pico W2€12 totalSensor nodes
5W solar panel1€8Power for outdoor node
TP4056 module2€3 totalBattery charging
18650 battery2€6 totalEnergy storage

Total: ~€88. Enough hardware for 5–6 meaningful projects.


Takeaway: DHT22 for air. MLX90614 for surfaces. Capacitive sensors for soil. Add a solar panel and TP4056 for any outdoor node.