Component & example project for sending sensor data to cloud
Built on top of esphome-influxdb and using ESP8266 Influxdb, this is a simplified component to send data to an InfluxDB 2 database. It will send all sensor updates in one batch, as fields of the same measurement.
You can use it in your project by pulling from Git or downloading the source - see the air-quality.yaml file.
We will send data from an air quality sensor directly to the cloud, so we can avoid having to set up any local hub like Home Assistant. We will use the free versions of InfluxDB Cloud Serverless and Grafana Cloud, which lets us retain data for 30 days.
Ingredients:
- NodeMCU-ESP32S - documentation, buy (select model
NodeMCU-ESP32S
) - Sensirion SEN55 - documentation, buy
- JST GHR-06V-S connector - buy (select model
Single Connector
,6p
)
Wiring:
SEN55 Pin | NodeMCU Pin |
---|---|
1 - VDD | 5V - VIN 5V |
2 - GND | GND |
3 - SDA | P21 - GPIO21 |
4 - SCL | P22 - GPIO22 |
5 - SEL | GND |
6 - NC | - |
Cable:
See the ESPHome Sen5x documentation for details on the sensor, and the air-quality.yaml file for an example configuration.
Set up a free InfluxDB Cloud Serverless account, create a bucket and a token with write access to the bucket. Configure the access parameters in your secrets.yaml
, see the secrets.template.yaml for example.
After flashing and running the firmware, you should see a Connected to InfluxDB
message in the logs and you should be able to query your data points with the Data Explorer on the InfluxDB Cloud portal.
Set up a free Grafana Cloud account as well, and follow the instructions to connect them. I used the FlightSQL plugin, which had to be installed first in Grafana.
You can find the description of the sensor readings in the application notes from the sensor documentation page. See an example Grafana dashboard at air-quality.grafana.json, or another one at anotter-sensor-hub.