Introduction
This guide helps hobbyists, home lab builders, and small business testers create reliable sensor nodes for temperature, humidity, CO2, and motion monitoring. It covers practical projects using ESP32 and Raspberry Pi, parts lists, integration patterns (MQTT, Home Assistant, Graylog/InfluxDB), deployment tips, and criteria to choose commercial sensors for long-term or production use.
If you want fast prototypes, DIY is cost-effective and highly flexible. If you need guaranteed accuracy, anonymous occupancy sensing, or enterprise support at scale, commercial solutions may be a better fit — see the "When to Choose Commercial Sensors" section for guidance, including considerations like heat-based anonymous sensing offered by some providers.
Temperature & Humidity Monitors (ESP32)
Use case: room climate, server rack monitoring, cold storage alerts, and environmental baselining.
Parts list
- ESP32 development board (Wi‑Fi enabled, e.g., ESP32-WROOM series)
- Temperature & humidity sensor (e.g., SHT3x or DHT22; SHT3x preferred for accuracy)
- Optional enclosure and waterproof probe for freezers or external spaces
- Power options: USB adapter, PoE adapter, or Li-ion battery with charging circuit
- Level-shifting or pull-up resistors if needed by the sensor
Wiring & connections (conceptual)
- Power the sensor from the ESP32's 3.3V rail, not 5V if the sensor is 3.3V rated.
- Connect sensor data line to a GPIO configured for I2C or single-wire as the sensor requires.
- Use common ground between ESP32 and sensor, and keep data lines short or shielded for longer runs.
Firmware & communication
- Use firmware that publishes readings via MQTT to a broker, or directly to an HTTP endpoint. Popular open-source firmware projects and Arduino/PlatformIO sketches support MQTT and Home Assistant discovery.
- Reporting cadence: every 30–300 seconds depending on power and use case. Faster for active control, slower for battery life.
Placement tips
- Avoid direct sunlight and heating elements.
- Place sensors at representative heights for the monitored space (e.g., rack middle for server temperatures, breathing height for room CO2 correlation).
- For freezer monitoring, use a waterproof probe and keep the radio shields in mind; put the Wi‑Fi gateway close enough to maintain connectivity.
CO2 Monitors (Sensirion SCD4x)
Why CO2 matters
CO2 is a proxy for ventilation and occupancy. Monitoring helps manage air quality, HVAC control, and safety in labs and workspaces.
Parts list
- CO2 sensor module (Sensirion SCD4x series recommended for small DIY projects)
- Host controller: ESP32 or Raspberry Pi
- Power supply suitable for stable operation
- Enclosure with adequate airflow
Integration notes
- SCD4x uses I2C; connect SDA/SCL to the host I2C pins and share ground and 3.3V.
- Calibrate according to the sensor datasheet recommendations; these sensors often need an initial stabilization period.
- Feed CO2 readings into Home Assistant for dashboards and automations, or into a time-series database for trend analysis.
Visualization and alerting
Use dashboards to show real-time CO2 and historical trends. Create alerts when CO2 exceeds thresholds that indicate poor ventilation.