Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/miskcoo/esp8266_sensor
An ESP8266-based temperature/humidity/CO2/TVOC sensor.
https://github.com/miskcoo/esp8266_sensor
am2320 esp8266 esp8266-arduino sgp30
Last synced: about 1 month ago
JSON representation
An ESP8266-based temperature/humidity/CO2/TVOC sensor.
- Host: GitHub
- URL: https://github.com/miskcoo/esp8266_sensor
- Owner: miskcoo
- Created: 2023-09-04T12:21:49.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-02-18T19:36:37.000Z (10 months ago)
- Last Synced: 2024-02-23T01:10:13.179Z (10 months ago)
- Topics: am2320, esp8266, esp8266-arduino, sgp30
- Language: C++
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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
- Install [arduino-cli](https://github.com/arduino/arduino-cli) and the [ESP8266 core](https://arduino.github.io/arduino-cli/0.33/getting-started/#adding-3rd-party-cores).
- Create and edit `credentials.h` to specify the WiFi SSID / password:
```c++
#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
```bash
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
```json
{
"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
![](https://blog.miskcoo.com/assets/images/esp8266-sensor/esp8266-sensor-example.jpg)