This project its about the creation of an indoor weather station with air quality sensors.
The station has several sensors for:
- Humidity
- Temperature
- CO2
- VOCs
- Lux
- Pressure
The resulting data can be displayed both on a TFT screen connected to the sensors and through an online dashboard thanks to the services of adafruit.io website.
In order to develop the project we will need the following components:
Let’s see how to connect the different sensors and the TFT screen to our microcontroller:
- TSL2561 Lux sensor: The TSL2561 Lux sensor uses the I2C bus protocol, so we will need to connect the SDL and SDA pins of the sensor to the SDL and SDA pins of the microcontroller (in our case D1 and D2, but you will need to check for your specific microcontroller).
- BME085 Pressure sensor: The BME085 sensor, as the TSL2561, uses the I2C bus protocol, so we will need to connect the SDL and SDA pins of the sensor to the SDL and SDA pins of the microcontroller (in our case D1 and D2, but you will need to check for your specific microcontroller).
- CCS811 Air quality sensor: The CCS811 sensor, as the previous sensors, uses the I2C bus protocol, so we will need to connect the SDL and SDA pins of the sensor to the SDL and SDA pins of the microcontroller (in our case D1 and D2, but you will need to check for your specific microcontroller).
- DHT22 Temperature and humidiy sensor: The DHT22 sensor uses a different comunication protocol, so we will need to use some unused digital input GPIO for receiving the signal data from the sensor.
- ST7735 TFT Screen: The ST7735 TFT Screen uses the SPI bus (HSCLK, HMISO, HMOSI, HCS) and several extra pins definded on the ST7735 datasheet.
IMPORTANT NOTE ABOUT THE COMPONENTS: I used those components because were the components that I had avialable, BUT there are better options, like using BME280 instead of BME085 + DHT22, or maybe using a ILI9341 TFT screen.
I Also changed the CCS811 air quality sensor for the more reliable but also more expensive MH-Z19B.
In the github repo you will find the updated code for all those sensors.
Building a support for the station:We are going to build a very basic support for the weather and air quality station components, remember that most sensors must be open to the environment and not enclosed inside any kind of box, even with some kind of ventilation, in order to function correctly.
My option has been to mount the sensors and the microcontroller on a protoboard solder board and the TFT screen on a smaller one, using 2 pieces of wood of 14x8cm and 8x4cm as support.
After finishing the assembly of the elements that make up the weather and air quality station, we will have a device that will show all the sensors information through the TFT screen, but taking advantage of the WiFi capabilities of our microcontroller we can also send the data to an MQTT online broker that includes dashboard functionalities, being able to view the data remotely.
To do that, we have several options, but we have chosen AdafruitIO service, since it has a very powerful free tier and is very easy to use.
First thing we must to is register ourselves on the Adafruit website.
Once registered, we must go to the adafruitIO platform and create the feeds, each of the feeds will receive data from a sensor. In this case we must have 6 feeds (temperature, humidity, lux, pressure, eCO2 and VOCs)
Remember that the feeds that you create at the adafruitIO platform must have the same name that the ones you use in the microcontroller source code:
When we have the feeds configured, we must create a dashboad where we must setup the feeds visualization and view the data of the feeds:
Finally, remember that you must write our username and your Adafruit IO Key (¡not your user password!), together with the SSID and password of your WiFi connection in the microcontroller source code to setup the connection correctly:
Comments