An indoor air quality network sensor based on BME680 measures temperature, humidity, barometric pressure and gas resistance. Below, you can find the information need to build the device together with control software.
Control software for the sensor is based on open software from www.luftdaten.info Outdoor Air Quality sensor project. It provides nice WEB based interface to all the features of the sensor.
Additionally sensor can transmit measurements to the thingspeak.com cloud for further analysis.
-
BME680 board is a sensor that measures temperature, pressure, humidity and gas concentration. More details on the sensor can be found in the datasheet, which is available here: BME680 datasheet There are many variants of BME680 boards available, in my project I am using BME680 from nettigo: BME680 Wemos board
-
Breadboard- I used a regular breadboard with 63 rows of pins, however you only need at least 40. I wanted to avoid soldering, however it will be inevitable. Breadboard allows you to connect all the devices with cables.
-
Wemos D1 mini pro board is a small single board computer. It has 16MB of flash memory and I2C bus to communicate with external sensors. It has a built-in Wi-Fi module. For host access and power it uses a micro usb port.
-
OLED Screen- I used a regular blue OLED screen with a resolution of 128 x 64 pixels. It is very simple and can be easily plugged.
-
Soldering kit- In order to solder all the necessary elements with the goldpins, you will need:
After connecting your board to a PC using USB cable, you need to download set of neccessary files.
-
In order to communicate with the board, you need to install USB-UART bridge SW. Depending on the CPU board you are going to use, different USB-UART bridge driver might be needed. As Wemos D1 mini Pro uses CP2104 USB-UART bridge and NodeMCU V2 uses CP2102 USB-UART bridge you will have to install for them CP210X SW driver. If you plan to use different boards to run my software, check what UART chip type it has and install a proper driver. You can dowload CP210X driver from this website: SiLabs CP210X USB-UART bridge driver. After extracting all the files from the archive, for 64-bit system install x64 installer, for 32-bit system install the x86 one.
-
Find COM port assigned to your device. To do so, open the Windows Device Manager and look for Ports (COM&LPT) -> Silicon Labs CP210X USB to UART Bridge.
-
Install Arduino IDE - open Arduino Project Web Page,find and download Arduino IDE.
-
Install ESP8266 Board Support package. Open Arduino IDE and select from menu: File -> Preferences. Enter http://arduino.esp8266.com/versions/2.5.0/package_esp8266com_index.json into the Additional Board Manager URLs field. Select Tools->Board->Boards Manager and install "esp8266" platform. Don't forget to select proper board type after ESP8266 package installation. In Tools->Board menu set NodeMCU 1.0 (ESP-12E Module) for NodeMCU V2 or LOLIN(WEMOS) D1 mini Pro for Wemos D1 mini Pro.
-
Change the Tools->Flash Size to 4M (3M SPIRFFS) for NodeMCU V2 and the Port to the one you found in device manager(step2 above).
-
To check whether you did everything properly, you can upload a test sketch on your board. In order to do so, select File->Examples->ESP8266->Blink. To build and upload program to the device, in the new window, select Sketch->Upload. The lamp on the board should start blinking, after the program will be loaded.
-
If everything worked correctly, you will now proceed to installing the control software for sensor.
-
Before you can install it, you need to install set of Arduino libraries. Go to Sketch->Include Library->Manage Libraries, install the following libraries:
- ESP 8266 and ESP32 Oled Driver for SSD1306 by Daniel Eichhorn and Fabrice Weinberg, version 4.0.0
- ArduinoJson by Benoit Blanchon, version 5.13.4. DO NOT INSTALL THE BETA VERSIONS.
- Adafruit BME680 Library by Adafruit, version 1.0.7
- Adafruit Unified Sensor by Adafruit, version 1.0.2
- ThingSpeak by MathWorks version 1.4.3
- Clone or download a zip file with the source code for the BME680 Indoor Air Quality Sensor from https://github.com/GrzegorzBis/BME680_Indoor_Air_Quality_Sensor
- Congratulations! You successfully installed the software. The next installation steps are optional. If you want to be able to have access to your measurements online, or you want to track history of your measurements you have to set the Thingspeak support. This is free service, where sensor data can be stored and retrived later.
- Create an account.
- After successful email verification, complete your profile configuraion and please login to the thnigspeak.com.
- Select ´New Channel´to configure thingspeak channel which will be used to collect and visualize IAQ sensor data. Please fill with data the following fields on ´New Channel´ page (see image below): Name, Field1, Field2, Field3, Field4. The name given in 'Name' field on 'New Channel' page can be arbitrary, it only serves as information to you describing your channel.
- Go to 'Channels'->'My Channels', select channel you just created and select 'API Keys' tab. Write down the Write API Key and Channel ID from this page, you will need them later to configure thingspeak settings on IAQ sensor configuration screen.
After obtaining all the components, we can start by soldering the goldpins to the Wemos D1 Mini Pro and the BME680 just like on the picture below.
NodeMCU V2 has goldpins soldered by default. In the next step plug Wemos/NodeMCU, the BME680 and OLED screen boards to the breadboard just like on the picture at the top of this page. Plug the cables using schematics shown below. Connection scheme for BME680 Indoor Air Quality Sensor with Wemos
For Wemos I2C bus where BME680 and OLED screen will be connected has the following layout:
- D1 pin -> I2C SCL
- D2 pin -> I2C SDA
Connection scheme for BME680 Indoor Air Quality Sensor with NodeMCU
For NodeMCU I2C bus where BME680 and OLED screen will be connected has the following layout:
- D3 pin -> I2C SDA
- D4 pin -> I2C SCL
Both BME680 board and OLED screen are powered from 3.3V pin.
After the IAQ sensor software is installed on the sensor, please login to the IAQsensor-ID WIFI network (where ID is the unique number assigned to the sensor board). The following screen will appear after login in: Please select one of the available WiFi networks and provide password for it. In the next step IAQ sensor will automatically log in into the selected WiFi network. New IP address assigned automatically to the IAQ sensor will be displayed on the IAQ sensor screen. When the sensor is loged in into the WiFi network, further access to the IAQ sensor can be done using Web browser, eg. google-chrome or mozilla-firefox and the IP address displayed on the sensor screen. On the picture below the IAQ sensor home page is presented. In order to perform sensor configuration, please select the configuration button on the sensor home page. On the picture below the IAQ sensor configuration page is presented. To enable IAQ sensor sending measurement data to ThingSpeak clound please tick the check box 'API thingspeak.com' and enter 'API key' and 'Channel Number' received during the thingspeak.com configuration setup. In order to get access to the current IAQ sensor readings, please select the current data button on the sensor home page. On the picture below the IAQ sensor current data page is presented.