Introduction: Creating an IOT Air Quality Monitor With the Intel Edison

Clean air is becoming a luxury in today's society. Become familiar with your invisible surroundings using an Intel Edison with Arduino breakout board, a Grove Starter Kit, and IBM Bluemix - an online resource for geeks, tinkerers, and science-minded individuals.

Step 1: Preparation!

Let's start by preparing resources and tools to set up the Intel Edison. There are many online resources and tools to aid you in this process. Before connecting our Intel Edison to the computer, we will need to collect all of the downloadable content.

We will need the drivers and latest firmware update, this can be found here:

https://software.intel.com/en-us/iot/software/inst...

We will also want to ensure we have our favourite Integrated Development Environment (IDE). The download links have been compiled all into one central location, making this quick and easy for us. (This can also be done directly from the driver installer).

https://software.intel.com/en-us/iot/software/ide

PuTTY will help us with configuration of our Intel Edison:
http://www.chiark.greenend.org.uk/~sgtatham/putty/...

Step 2: Setting Up Your Intel Edison

Time for the fun stuff!

Hate to break it to you, but you'll want your Intel Edison NOT connected to your computer, or power. Patience pays off!

Open up Phone Flash Tool Lite, and start by clicking "Browse" and navigating to the Intel Edison firmware file that you downloaded in the last step. The file you are looking to select is called "FlashEdison.json".

Click on "Start Flash" and follow the on-screen instructions. These instructions basically say to connect your Intel Edison to your computer (finally!) and inevitably waiting. It is pretty painless.

Once you have your Intel Edison updated, and your drivers installed, your device manager should have two entries, as seen in the attached picture. Your COM port numbers will likely vary.

Step 3: Setting Up Your Intel Edison (cont.)

Next, we are going to want to fire up PuTTY, select the Serial port option, type in the COM port number, and 115200 for the speed. Click open and you will be welcomed with a blank window - but don't despair! Press enter twice and you'll see the name of the Intel Edison appear - type in "root" without the quotation marks to root into the device.

Let's set up the WiFi - type in "configure_edison --wifi", again without the quotation marks.

After 10 second, you will we a list of all the WiFi signals in your surroundings.

Type in the number in the list of the WiFI you wish to connect to, and click enter.

This will ask you to confirm with a yes or no, "y" or "n" respectively.

Type in your WiFi password when prompted and again click enter.

This will give you an IP address you can test with - Open your favourite browser and type in this IP address.

If you see the Intel "device information, you're connected! Congrats!

Step 4: Set Up an Account With IBM Bluemix

IBM Bluemix is an easy to use and powerful tool set to visualize your data online and take your project to new horizons. Go to the IBM Bluemix website and set yourself up for a free trial.

https://developer.ibm.com/sso/bmregistration

Step 5: BlueMix Quickstart

Follow THIS quick and easy guide:

https://developer.ibm.com/recipes/tutorials/intel-...

Once loaded onto your Edison board, this will read an analog value on A0 of your Intel Edison breakout board.

/* Be prepared for epicness, this is the moment you've been waiting for. */

We used an MQ type gas sensor with it's analog output connected to A0.

Step 6: Let's Take This a Step Further..

Did you know that the Intel Edison can run js and Arduino code side by side? Oh yes it can!

Open up Arduino IDE and ensure you have the Intel Edison hardware package installed under boards manager.

Select the Intel Edison board under Tools> Board, and then the corresponding COM port.

Upload the code below and check it out!

We have LEDs on pins D2, D4, and D6 to indicate BAD air quality (We used two LEDs and a buzzer)

We have LEDs on pins D3 and D7 to indicate GOOD air quality.

We also have a serial monitor so you can view the output. (A second input, A1 is present for later development)

const int analogInPin = A0;
int sensorValue = 0; // value read from the gas sesnor

const int analogInPin1 = A1; // Analog input pin that the potentiometer is attached to int sensorValue1 = 0; // value read from the gas sesnor int BAD = 0; int GOOD = 0;

void setup() { // initialize serial communications at 9600 bps: Serial.begin(9600); // pinMode(LED, OUTPUT); pinMode (2, OUTPUT); pinMode (3, OUTPUT); pinMode (4, OUTPUT); pinMode (5, OUTPUT); pinMode (6, OUTPUT); pinMode (7, OUTPUT);

}

void loop() { // read the analog in value: sensorValue = analogRead(analogInPin); sensorValue1 = analogRead(analogInPin1);

// map it to the range of the analog out:

// print the results to the serial monitor: Serial.print(sensorValue); Serial.print(","); // separated by a comma

Serial.print(sensorValue1); Serial.print(","); // separated by a comma delay(200); // ***********THIS IS FOR THE AIR QUALITY SENSOR***********

if (sensorValue >= 450) { // BAD!! digitalWrite(2, HIGH); digitalWrite(6, HIGH); digitalWrite(4, HIGH); digitalWrite(3, LOW); digitalWrite(7, LOW); Serial.print("BAAAAAD!"); Serial.println(); // print a linefeed character } else { digitalWrite(2, LOW); digitalWrite(6, LOW); digitalWrite(4, LOW); digitalWrite(3, HIGH); digitalWrite(7, HIGH); Serial.print("GOOD!"); Serial.println(); // print a linefeed character

} }