This project uses an ESP32 to publish temperature, pressure and humidity to AWS IoT via MQTT.
- ESP32 Dev kit
- BME280 sensor
- SDS011 sensor
ESP32 pins | BME280 pins |
---|---|
3V3 | VCC |
GND | GND |
G22 (IC2 SCL) | SCL |
G21 (IC2 SDA) | SDA |
ESP32 pins | SDS011 pins |
---|---|
5V | 5V |
GND | GND |
G16 (RX2) | RX |
G17 (TX2) | TX |
- Create a thing with certificate and policy in AWS IoT
- Install PlatformIO for VSCode
- Open
device
project in VSCode - Copy
device/include/secrets.h.template
todevice/include/secrets.h
and insert the following:THINGNAME
: choose a name for your deviceWIFI_SSID
: name of your Wifi networkWIFI_PASSWORD
: password for your Wifi networkAWS_IOT_ENDPOINT
: get it from AWS IoT settingsAWS_CERT_CA
: get it from https://www.amazontrust.com/repository/AmazonRootCA1.pemAWS_CERT_CRT
: device certificateAWS_CERT_PRIVATE
: private key from device certificate
- Build and upload with PlatformIO
- Verify that messages are published to AWS IoT
{
"time": 669776,
"temperature": 21.83,
"humidity": 36.62695,
"pressure": 997.652,
"altitude": 130.6805,
"hall": 4,
"sds_p10": 19.2,
"sds_p25": 13.8
}