Skip to content

An ESP8266-based temperature/humidity/CO2/TVOC sensor.

Notifications You must be signed in to change notification settings

miskcoo/esp8266_sensor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ESP8266 Sensor

This is an ESP8266-based environmental sensor. We use AM2320 as the temperature / humidity sensor, and SGP30 as the CO2 / TVOC sensor.

Usage

#ifndef WIFI_CREDENTIALS_H
#define WIFI_CREDENTIALS_H

#define WIFI_SSID      "your WiFi SSID"
#define WIFI_PASSWORD  "your WiFi password"

#endif
  • (optional) Set the SGP30 CO2 / TVOC baseline in esp8266_sensor.ino (see the TODO comment in this file).
  • Wire SGP30 to ESP8266: SDA -> GPIO4 (D1) and SCL -> GPIO5 (D2)
  • Wire AM2320 to ESP8266: SDA -> GPIO12 (D6) and SCL -> GPIO14 (D5)
  • Compile and upload the binary
  arduino-cli compile --fqbn esp8266:esp8266:nodemcuv2 . --libraries libs
  arduino-cli upload --port /dev/ttyUSB0 --fqbn esp8266:esp8266:nodemcuv2 .
  • Query the sensor data via curl http://your-esp8266-ip, an example output is
  { 
      "uptime": 3318604, 
      "am2320": { 
          "status": "ok", 
          "temperature": 28.60, 
          "humidity": 65.10, 
          "last_time": 12154 
      }, 
      "sgp30": { 
          "status": "ok", 
          "eCO2": 408, 
          "TVOC": 273, 
          "last_time": 158 
      }, 
      "sgp30_baseline": { 
          "eCO2": 36622, 
          "TVOC": 41061, 
          "last_time": 12152 
      } 
  }

Instantiation

About

An ESP8266-based temperature/humidity/CO2/TVOC sensor.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages