Introduction: Environmental Pollution

Project description
The aim of this project is to build a full mobile application to detect environment pollution. The application is composed of an independent unit powered by a battery with different kind of sensor (C6H6 sensor, CO sensor, dust sensor) that get the concentration of pollution. The unit will send by Bluetooth the data to a smartphone that provide to gathering the measures and send them to cloud.

Team Members:

  • Enrico Beltramo
  • Fabrizio Bonetto
  • Danilo Avalle
  • Roberto Ferrero
  • Alessandro Marcon
  • Elisa Buccaresi

With the contribution of FabLabCuneo

Step 1: Architecture Definition

The structure of the project is composed by follow elements:

  • 1 station (build with 1 Intel Edison + 1 Arduino board + 1 C6H6 sensor + CO sensor + dust sensor + Bluetooth transmitter)
  • 1 app installed on the smartphone

Each station measure periodically the data pollution with the sensors. After a complete measurement, it send the information by Bluetooth to paired smartphone. The app installed on the smartphone will provide to show the data and, if you want, to send them to a remote server.

Step 2: Station Build

Each station is composed by:

  • 1 Intel Edison
  • 1 Arduino adapter board
  • 1 HC 06 bluetooth transmitter
  • 1 CO sensor
  • 1 C6C6 (benzol) sensor
  • 1 Dust sensor

The connection between Arduino board pins and modules are follow:

HC 06 bluetooth transmitter:

  • 5V --> 5V Arduino
  • GND --> GND Arduino
  • RX --> digital pin 1 Arduino board
  • TX --> digital pin 0 Arduino board

C6H6 sensor:

  • 5V --> 5V Arduino
  • GND --> GND Arduino
  • SIGNAL --> analog 0 Arduino board

CO sensor:

  • 5V --> 5V Arduino
  • GND --> GND Arduino
  • SIGNAL --> analog 0 Arduino board

Dust Sensor grove:

  • 5V -->5V Arduino
  • GND--> GND Arduino
  • SIGNAL --> digital 7 Arduino board (or any other available interrupt pin)

After make all connection, the Arduino should programmed.

The program provide follow features:

  • Periodical read of all sensor
  • Send data by bluetooth
  • A small Serial interface for log and configure Arduino

After program the Arduino, it shall configured using serial communication. It’s possible to use the serial monitor of Arduino IDE:

  • see --> picture serial monitor

just ensure to set 9600 baud and CR option.

For send command, write command and press “ENTER”. The available commands are:

  • LOG ON: to enable verbose log
  • LOG OFF: to disable verbose log
  • CALIBRATION RUN: To star the sensor calibration (see next paragraph about those sensors) It will automatically store in Arduino EEPROM the calibration values and they will be available for the next reading
  • CALIBRATION: to see actual calibration parameters

The SW, after a correct calibration of sensor, will start to read the different pollution concentration and send them to onboard bluetooth serial. The Bluetooth device will forward the data to connected smartphone that gathering all information.

Step 3: Sensor Tuning

    The CO and C6H6 sensors are simply to use: they provide an analog value that is function of the relative measurement. Nevertheless isn’t easy to convert the measured analog value to a true PPM concentration. Here we will show the step necessary to make a measurement.

    The sensors are variable resistances that value depends of measured pollution. There is a reference resistance value (R0) that should be considered the “0” value and that corresponding to clean air. When the concentration of measured pollution increase, the value of resistance change and the ratio of the new value (Rs) and R0 is function of concentration of pollution. So the sequence to do is:

    • Measure the analog value with clean air in V
    • Calculate the resistance with follow formula: R0 = (V / Vref – 1)*Rref where:

    ⦁ Vref is powered sensor tension (5V for Edison/Arduino board)
    ⦁ V is measured tension ⦁ Rref is reference resistance of sensor interface (typically 1/10 Kohm)

    • Place the sensor in not clean air and measure again the voltage
    • Calculate the new value of resistance (Rs)
    • Calculate the ratio Rs/R0 and look in datasheet table to know the measured PPM of pollution. Doing the ratio, the Rref value is deleted, so it don’t matter for calculation.

    Looking in datasheet we can discover that the relation between ppm and Rs/R0 is absolutely not linear (logarithmic), but we can approximate it with a good resolution with follow formula:

    Rs/R0 = (a*PPM)^b

    Reverting this formula:

    PPM = (Rs/R0)^(1/b)/a = (Rs/R0)^(c)*d where c= 1/a and d = 1/b

    The values of a and b (and related c and d) depends of kind of sensor. In order to simplify things, here an Excel sheet where we make calculation to get those values:

    • Download --> excel table

    In the sheet, we took two points in datasheet curve of sensors and used them to calculate a and b. Using this approach is simple to calculate the interpolation curve for most all similar sensors.

    So, in your application is necessary before to start measurement, to provide a calibration of sensor. That is possible moving the station in a clean air and start the calibration with a serial command (see previous paragraph to see the list of commands). The calibration is done executing for each sensor many reading and executing an average of measured values.

    About the dust sensor the feedback is a digital signal, with a duty that change with a near-polinomial relation of concentration of detected dust. The signal is catch using interrupt in order to have a better resolution. In the same Excel file, it’s possible to have the relation formula of dust concentration/duty.

    Step 4: Smartphone Application

    On the smartphone is necessary to create an application that connect to bluetooth unit and collect and show all data received. There are many way to do that, but one of the most simple is to use BluetoothAdapter class. For this application we make an App that provide to:

    • Get and show all paired Bluetooth device, asking who to connect
    • Open a SPP Bluetooth channel to read and write data from our station

    In the application there are some features like to star the calibration of sensor or to force a immediate reading of actual status of pollution. Here the code (done with Android studio) for the application:

    The app should be customized in order the data to your preferred cloud server.

    Important: before to start a connection is necessary to pair your device to smartphone using Bluetooth configuration menu.

    see --> picture app

    Here the reference that we used to make the application: on Android Devices