GrzegorzBis / BME680_Indoor_Air_Quality_Sensor

BME680 Indoor Air Quality Network Sensor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Introduction

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.

enter image description here

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.

enter image description here

Additionally sensor can transmit measurements to the thingspeak.com cloud for further analysis.

Components

  • 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.

  • 10cm Male-Male Cables

  • Goldpins

  • Soldering kit- In order to solder all the necessary elements with the goldpins, you will need:

Software

After connecting your board to a PC using USB cable, you need to download set of neccessary files.

  1. 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.

  2. 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. enter image description here

  3. Install Arduino IDE - open Arduino Project Web Page,find and download Arduino IDE. enter image description here

  4. 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. enter image description here Select Tools->Board->Boards Manager and install "esp8266" platform. enter image description here 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. enter image description here

  5. 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). enter image description here

  6. 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.

  7. If everything worked correctly, you will now proceed to installing the control software for sensor.

  8. 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
  1. 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
  2. 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.
  3. Create an account.

enter image description here

  1. After successful email verification, complete your profile configuraion and please login to the thnigspeak.com.
  2. 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.

enter image description here

  1. 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.

Assembly

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.

enter image description here

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 enter image description here

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 enter image description here

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.

IAQ Sensor User Guide

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: enter image description here 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. enter image description here 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. enter image description here 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. enter image description here

About

BME680 Indoor Air Quality Network Sensor


Languages

Language:C++ 63.7%Language:C 36.3%