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.
Common Projects & Use Cases
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
- Publish readings via MQTT to a broker or directly to an HTTP endpoint; community firmware and Arduino/PlatformIO sketches commonly support MQTT and Home Assistant discovery
- Reporting cadence: every 30–300 seconds depending on power and use case
Placement tips
- Avoid direct sunlight and heating elements
- Place sensors at representative heights for the monitored space
- For freezer monitoring, use a waterproof probe and position gateways close enough to maintain connectivity
CO2 Monitors (Sensirion SCD4x)
CO2 is a proxy for ventilation and occupancy; monitoring helps manage air quality, HVAC control, and safety.
Parts list
- CO2 sensor module (Sensirion SCD4x series recommended)
- 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; allow initial stabilization period
- Feed CO2 readings into Home Assistant or a time-series database for dashboards and trend analysis
Visualization and alerting
- Use dashboards to show real-time CO2 and historical trends and create alerts when thresholds are exceeded
Motion / Security (PIR + Raspberry Pi)
Use case: presence detection, lab security, experiment triggers, and energy-saving automation.
Parts list
- Passive Infrared (PIR) motion sensor module
- Raspberry Pi (for processing and camera integration) or ESP32 for simple triggers
- Optional camera module and relay or smart switch for actuation
Design considerations
- Mount PIR to cover the area of interest and avoid direct heat sources
- Implement debounce logic to avoid repeated triggers
- Use Raspberry Pi for advanced processing (video, edge analytics); ESP32 for low-power trigger messages
Specialized Sensors (NMEA, water, vibration)
- NMEA sensors integrate via serial to a Raspberry Pi for marine or GPS-linked measurements
- Water leak sensors, vibration sensors, and door contacts are cost-effective for physical-system monitoring
- Prefer standard transport (MQTT, syslog, HTTP) and consistent naming conventions when integrating diverse sensors
Data Collection & Monitoring
Logging to Graylog / ELK / InfluxDB + Grafana
Choose a backend based on query needs: Graylog or ELK for log-centric event streams; InfluxDB for time-series metrics paired with Grafana.
- Send sensor readings over MQTT and use a bridge or collector to ingest them into your backend
- Tag messages with sensor type, location, and device ID for efficient filtering and alerting
Key metrics to track
- Sensor uptime and last-seen timestamp
- Drift/offset comparisons for co-located sensors
- Environmental anomalies and threshold breaches
Integrating with Home Assistant
Home Assistant supports MQTT discovery and direct integrations for many sensors; use descriptive entity names and group sensors by room or system.
- Create automations for HVAC control, notifications, and failover behaviors when connectivity is lost
- Use Lovelace dashboards to present summaries and trend cards