Work done by Enora Latour, Raphaël Ruelle and Saïd Ider.
The goal of this project is to build a meteo station with a BME280 captor connected to an ESP32. The ESP32 then sends the values to a ThingsBoard who's goal is to collect, process and display the values of multiple ESP32.
To make this project work, you'll need :
-
ESP32 board
-
BME280 captor
-
ThingsBoard
-
WiFi connection to internet (or local if the thingboard is self hosted) that the ESP32 can reach
-
Wiring (cables, breadboard, ...)
-
Arduino IDE (or other equivalent) to install libraries, adapt and upload the code to the ESP32
To make multiple meteo captors, you'll need multiple ESP32s and BME280 captors. All will be connected to your unique ThingsBoard.
To connect the BME280 captor to the ESP32, you'll need to wire each of the captor's pins to the corresponding ESP32's as follows :
-
SCL to pin 18
-
SDO to pin 19
-
SDA to pin 23
-
CSB to pin 5
-
VCC to 3v3 pin
-
GND to GND pin
Various models of BME280 exists. Stick with this wiring according to the pin names.
The required dependencies are :
-
WiFi.h
-
ThingsBoard.h
-
PubSubClient.h
-
ESPping.h
-
SPI.h
-
Adafruit_BME280.h
-
Adafruit_Sensor.h
So in Arduino IDE, go to Sketch then include library, Manage libraries and install all the following :
-
PubSubClient
-
ESPping
-
Adafruit BME280 (this library will install all the necessary dependencies)
On the ENVIRONMENT VARIABLES section from the meteo_measurement_esp32_to_thingsboard.ino
code, change the WiFi and ThingsBoard parameters as needed.
An exemple of connection to thingsboard.cloud ThingsBoard is given on the next section to complete the TOKEN and DEVICE_ID fields.
Here is how to connect the ThingsBoard to collect the data from the ESP32 :
-
Connect and login to https://thingsboard.cloud/login
-
Go to Entites and select devices
-
Click on the "+" (add device) and select Add New Device
-
Enter the name of your device, then click on Add and then click on close
-
To get the credentials, click on device then click either on : Copy device ID to get the DEVICE_ID value, or Copy access token to get the TOKEN value
-
Modify the DEVICE_ID and TOKEN values in your ENVIRONMENT VARIABLES from the
meteo_measurement_esp32_to_thingsboard.ino
code accordingly.
You can verify if the ThingsBoard get the values by clicking on the device and then Latest telemetry. If values change or are displayed correctly, your connection is good !
Once you have finished correctly the previous steps, you can upload the code to your ESP32 and find a way to supply energy to the plateform to make it autonomous.
If you need multiple meteo captors, just follow the same steps from the beginning with the others ESP32s and BME280 sensors.
You can have as much captors as needed in the same ThingsBoard who will collect, process and display the values of each meteo captor.
To display the data from all the meteo captors on the ThingsBoard do this steps :
-
Connect and login to https://thingsboard.cloud/login
-
Go to Dashboards
-
Click on "+" (add dashboard), then Create new dashboard (or go to one already created)
-
Fill with the name and description you want to use then Add
-
From here you can add new widgets by clicking on the button
-
Select a widget of your liking that can support your data (for example data then value card)
-
Click on device and select the device you want to display the values. Then on data key remove the current parameter by clicking on the cross. Click again on data key and select the data type you want to display and click on Add.
-
Don't forget to save you dashboard
If you want process (min, max, average...) your data from a device do this steps :
-
Do the previous steps until step 6.
-
Click on device and select the device you want to display the values.
-
Then on data key remove the current parameter by clicking on the cross. Click again on data key and select the data type you want to display. Select the processing you want to use for your data by selecting it from the aggregation menu. You can also enable delta calculation from a time period and results with the options below.
-
Click on Save
-
Finally click on Add.
We deployed our work and here are the results.
Wiring :
All the devices and ThingsBoard working simultaneously :
And here is an example of dashboard with results at two different moments :