Sensors

IoT Desktop Environmental Monitor

An ESP32-based desktop environmental monitor with temperature/humidity, CO2, and VOC sensing, LCD touchscreen interaction, Wi-Fi upload, OTA updates, real-time weather, and historical data charts accessible on both the device and phone, with bypass charging for battery protection.

Sensors environmental monitoringLCD touchWi-FiOTAbattery charging ESP32

Official path: https://oshwhub.com/vrxiaojie/all-in-one-iot-desktop-environme

01 Overview

This is an ESP32-based desktop environmental monitor designed to track indoor air quality in real time, including temperature, humidity, CO2 concentration, and VOC index.

It addresses the need for awareness of indoor environmental conditions, making it suitable for offices, bedrooms, or newly renovated spaces, helping users ventilate or adjust their environment promptly.

The device features an LCD touchscreen for intuitive display and interaction, allowing users to view real-time data, historical charts, and configure settings.

With Wi-Fi connectivity, it can upload data to the cloud or a mobile app, and supports OTA firmware updates for easy maintenance and feature enhancements.

A built-in battery with bypass charging ensures uninterrupted operation during power outages while protecting battery health.

This is not an industrial-grade instrument but a user-friendly desktop gadget focused on convenience and aesthetics.

02 Hardware

  • MCU: ESP32 family chip with Wi-Fi and Bluetooth, responsible for data acquisition, processing, display, and communication.
  • Sensors: Temperature/humidity sensor (e.g., SHT30 or DHT20), CO2 sensor (e.g., SGP30 or MH-Z19), VOC sensor (e.g., SGP30 or CCS811); exact models see schematic.
  • Display: LCD touchscreen (e.g., ST7789 or ILI9341) connected via SPI or parallel interface for data display and touch input.
  • Power: Li-ion battery with bypass charging circuit (e.g., TP4056 or SX1308 boost converter) to allow operation while charging, with overcharge and over-discharge protection.
  • Connectors: USB for charging and debugging, plus pin headers for sensors and display; pin definitions see schematic.
  • Buses: I2C for temperature/humidity and VOC sensors, UART or I2C for CO2 sensor, SPI for LCD.
  • Layout notes: Keep sensors away from heat sources (ESP32 and power ICs) to avoid temperature measurement errors; ensure antenna clearance for reliable Wi-Fi.

03 Software flow

1. Flash firmware: Compile with ESP-IDF or Arduino framework and flash via USB-UART.

2. Configure Wi-Fi: On first boot, enter provisioning mode to set SSID and password via phone or web, stored in NVS.

3. Initialize peripherals: Set up I2C, SPI, UART, configure sensors and LCD, load calibration parameters.

4. Data acquisition: Periodically read temperature, humidity, CO2, and VOC, apply filtering and calibration, update LCD.

5. Interaction handling: Detect touch input to switch pages (real-time data, historical charts, settings).

6. Data upload: Send data to cloud or mobile via MQTT or HTTP with reconnection logic.

7. OTA update: Check for new firmware, support manual or automatic updates, ensure data integrity during upgrade.

8. Power management: Monitor battery level, enter sleep or reduce sampling on low battery; enable bypass mode while charging.

04 Core points

Sensor selection affects accuracy and lifespan; CO2 sensors may require periodic baseline calibration.

LCD touch driver must match the specific model; pay attention to SPI timing and backlight control.

Implement Wi-Fi reconnection and local caching to prevent data loss during network instability.

Battery charging management must consider current and temperature to prevent overheating.

OTA updates should verify firmware integrity and rollback on failure.

Different ESP32 variants (e.g., ESP32 vs ESP32-S3) have different pinouts and memory; code must be adapted.

中文

传感器

IoT桌面环境监测仪

基于ESP32的桌面环境监测仪,集成温湿度、CO2、VOC传感器,通过LCD触屏交互,支持Wi-Fi上传、OTA升级、实时天气,可在监测仪和手机端查看历史数据曲线,支持旁路充电保护电池。

传感器 environmental monitoringLCD touchWi-FiOTAbattery charging ESP32

官方路径: https://oshwhub.com/vrxiaojie/all-in-one-iot-desktop-environme

01 项目概述

这是一款基于ESP32的桌面环境监测仪,用于实时监测室内空气质量,包括温湿度、CO2浓度和VOC指数。

它解决了用户对室内环境质量的感知问题,尤其适合办公室、卧室或新装修房间,帮助用户及时通风或调整环境。

设备配备LCD触摸屏,提供直观的实时数据展示和交互操作,可查看历史数据图表,并支持Wi-Fi连接上传数据至云端或手机端。

支持OTA升级,方便后续功能更新和修复,无需拆机。

内置电池和旁路充电设计,确保在断电时仍能工作,同时保护电池寿命。

这不是一款工业级设备,而是面向个人用户的桌面小工具,注重易用性和美观性。

02 项目硬件描述

  • 主控: ESP32系列芯片,支持Wi-Fi和蓝牙,负责数据采集、处理、显示和通信。
  • 传感器: 温湿度传感器(如SHT30或DHT20)、CO2传感器(如SGP30或MH-Z19)、VOC传感器(如SGP30或CCS811),具体型号见原理图。
  • 显示: LCD触摸屏(如ST7789或ILI9341),通过SPI或并行接口连接,用于显示数据和接收触摸输入。
  • 电源: 采用锂电池供电,支持旁路充电电路(如TP4056或SX1308升压),确保充电时设备可正常工作,并有过充、过放保护。
  • 连接器: 包括USB接口用于充电和调试,以及传感器和屏幕的排线连接器,具体引脚定义见原理图。
  • 总线: I2C用于连接温湿度和VOC传感器,UART或I2C用于CO2传感器,SPI用于LCD屏幕。
  • 布局注意: 传感器应远离发热元件(如ESP32和电源芯片),避免温度测量偏差;天线区域需净空,确保Wi-Fi信号强度。

03 项目软件流程描述

1. 烧录固件:使用ESP-IDF或Arduino框架编译固件,通过USB-UART烧录到ESP32。

2. 配置Wi-Fi:首次启动进入配网模式,通过手机或网页配置Wi-Fi SSID和密码,保存到NVS。

3. 初始化外设:初始化I2C、SPI、UART总线,配置传感器和LCD屏幕,读取校准参数。

4. 数据采集:周期性读取温湿度、CO2、VOC数据,进行滤波和校准,更新LCD显示。

5. 交互处理:检测触摸屏输入,切换显示页面(实时数据、历史图表、设置等)。

6. 数据上传:通过MQTT或HTTP将数据上传至云端或手机端,支持断线重连。

7. OTA升级:检查服务器是否有新固件,支持手动或自动升级,升级时保持数据不丢失。

8. 低功耗与充电管理:检测电池电量,低电量时进入休眠或降低采样频率;充电时启用旁路模式,保护电池。

04 项目核心点

传感器选型需考虑精度和寿命,CO2传感器可能需要定期校准(如基线校准)。

LCD触摸屏的驱动需适配具体型号,注意SPI时序和背光控制。

Wi-Fi连接不稳定时,应实现重连机制和本地缓存,避免数据丢失。

电池充电管理需注意充电电流和温度,防止过热。

OTA升级时需确保固件完整性,失败回滚到旧版本。

不同ESP32型号(如ESP32、ESP32-S3)的引脚和内存不同,代码需适配。