Skip navigation

In the Air Design Challenge

6 Posts authored by: happy1

Sending sensor readings to airvantage :

 

For this i connected airvantage to the beaglebone black and after its connected go to  http://192.168.7.2:3000/

This is the cloud9 workspace.

Now in the cloud9 workspace go to terminal and in the default cloud9 location run the following :

npm install mqtt

This installs the necessary mqtt module for nodejs in cloud9 directory.

Next I created a sample file using the following code to send data to airvantage :

 

 

var mqtt = require('mqtt');
var port = 1883;
var server = "na.airvantage.net";
var serialnumber = "3713BBBK7777";                   //serialnumber of your beaglebone
var password = "1234"; //password used in credentials 
var mqtt_options = {username: serialnumber, password: password};
var client = mqtt.createClient(port, server, mqtt_options);
console.log("Client started");
//Send values
console.log("Sending value");

//Publish a message on the right topic
var room_1= {};
var timestamp = new Date().getTime();
room_1[timestamp] = { "room1.temperature": 42.2, "room1.threshold": 30, "room1.humidity": 42.2, "room1.dust": 42.2, "room1.co": 42.2, "room1.co2": 42.2,}; 
client.publish(serialnumber + '/messages/json', JSON.stringify(room_1));

console.log(room_1);

Save this file and run the file in cloud9 workspace.

 

 

Thats it . Next go to your airvantage account and go inventory >  systems > your device > timeline tosee if the readings are being uploaded. On the timeline you can see all the readings that are uploaded.

Setting up Airvantage

 

 

In this post i am going to connect beaglebone  black to airvantage. For this connect beaglebone to the pc and update it. Then following the steps below i was able to connect it to airvantage and update readings and see them.

 

 

Hardware :

Step 1. Plug the BeagleBone Black to USB and install USB drivers by reading this getting started.

Step 2. Set up Internet on your device with an ethernet cable.

Step 3. Go to the Cloud9 IDE by openning the following url in a browser: http://192.168.7.2:3000/. Where `192.168.7.2` is the default IP of the BeagleBone.

Step 4. Create a new file in the workspace.

step 5. Open a browser to this url: http://192.168.7.2/Support/BoneScript/getPlatform/. Click on the run button. Take note of the serial number and the name.

step 6. Open notepad and make a .app file to be used on airvantage with the following code:

<?xml version="1.0" encoding="ISO-8859-1"?>
<app:application xmlns:app="http://www.sierrawireless.com/airvantage/application/1.0"
        type="PollutionEffect"
        name="Application"
        revision="0.0.1">
  <capabilities>
  
    <communication>
      <protocol comm-id="SERIAL" type="MQTT" />
    </communication>
    
    <data>
      <encoding type="MQTT">
        <asset default-label="Room1" id="room1">
          <variable default-label="Temperature" path="temperature" type="double"/>
          <variable default-label="Humidity" path="humidity" type="double"/>
          <variable default-label="Carbon dioxide" path="co2" type="int"/>
          <variable default-label="Dust" path="dust" type="int"/>
          <variable default-label="Carbon Monoxide" path="co" type="int"/>
        </asset>
        <asset default-label="Room2" id="room2">
          <variable default-label="Temperature" path="temperature" type="double"/>
          <variable default-label="Humidity" path="humidity" type="double"/>
          <variable default-label="Carbon dioxide" path="co2" type="int"/>
          <variable default-label="Dust" path="dust" type="int"/>
          <variable default-label="Carbon Monoxide" path="co" type="int"/>
        </asset>
         <asset default-label="Kitchen" id="kitchen">
          <variable default-label="Temperature" path="temperature" type="double"/>
          <variable default-label="Humidity" path="humidity" type="double"/>
          <variable default-label="Carbon dioxide" path="co2" type="int"/>
          <variable default-label="Dust" path="dust" type="int"/>
          <variable default-label="Carbon Monoxide" path="co" type="int"/>
        </asset>  
      </encoding>
    </data> 

  </capabilities>
</app:application>

 

Next save it with .app extension like model.app

Zip the file in an archive.

step 7. Go to Inventory > Systems.

Click on the "Create" action.

In the "Create System" dialog:

"Name" step: Specify an optional name for your system.

"Gateway" step: Click "Create gateway" and enter the identifier of the device in the "Serial Number" field.

"Subscription" step: You won't create nor use any.

"Applications" step: Click on "Release a new application" and upload the application package archive created in the previous step.

"Credentials" step: Enter the password used to authenticate the device.

Click on "Create".

In the grid, select the newly created system and click on the "Activate" action.

Thats all for setup.

The beaglebone is now ready to go.

Setting up Beaglebone Black

This is my post for setting beaglebone for connecting to airvantage. For this beaglebone needs to be setup. For windows machine follow the following steps :

  1. Connect beaglebone to USB port of pc using usb cable.
  2. Install drivers for beaglebone from http://beagleboard.org/getting-started. It may take a while to install the drivers.
  3. Launch : http://192.168.7.2 to log into the board.

Next connect the beaglebone black to internet using Ethernet or Wifi.

Open Cloud9 IDE by going to the address http://192.168.7.2:3000/ .

Then i noticed an article on the element14 site to update the image of debian. The factory installed version has many problems. I tried to login from the user debian to root but it asks for a password which is not there. You will always notice a authorization failure in this case.

So to avoid these problem update your image. This can be done in two ways :

  1. By Flashing the image to emmc:
  2. Download the latest image from http://beagleboard.org/latest-images.
  3. The downloaded image is a .img.xz file. Then download 7zip to decompress the archive.
  4. Use 7-zip to decompress the SD card .img file. In my case 7zip was not able to open the archive.I had the following error saying “cannot open file as archive.”
  5. So i used my ubuntu pc to flash the sd card with the image.
  6. In ubuntu just click on the link and restore the image on the sd card.
  7. Now power down the beaglebone insert the sd card and press down the BOOT button and power up the board.
  8. If using BeagleBone Black and the image is meant to program your on-board eMMC, you'll need to wait while the programming occurs. When the flashing is complete, all 4 USRx LEDs will be steady on or off. The latest Debian flasher images automatically power down the board upon completion. This can take up to 45 minutes. Power-down your board, remove the SD card and apply power again to be complete.
  9. In my case i had errors in this case, the board started with the emmc flashing and the user leds started blinking in a sequence. But after 5 minutes this stopped and all of them started to glow. I powered the board down to see if the process is over but i noticed that the board wasn’t booting. I was not able to ssh into the board. So i used the other method of using an sd card to boot the board.
  10. By using sd card :
  11. Download the latest image from http://beagleboard.org/latest-images (bootable sd card image)
  12. Decompress the image using 7zip and flash it to the sd card using win32disk imager on windows or restore it in ubuntu.
  13. Now power down the beaglebone insert the sd card and press down the BOOT button and power up the board.
  14. For booting with sd card this is all you have to do. The board will boot from the card.

 

Post 3 :

I have received the boards now. I will be showing initial experience wuth the boards in the coming days. For now i am trying to interface sound in the system.

For this sound detection i will be using adafruit microphone amplifier breakout.

Adafruit Electret Microphone Amplifier : It is used to measure sound levels. The specification of the amplifier is :

Supply Voltage: 2.4v-5v

Output: Rail-to-Rail - up to to 5vp-p

Frequency Response: 20Hz - 20 KHz

Adjustable Gain 25x-125x

Connection :

The amplifier has only 3 connections:

GND -> GND

VCC -> 3.3V

OUT -> Analog input

VCC can be anywhere from 2.4-5VDC. For the best performance, we use the 3.3v pin.

The amplifier gain is adjustable from 25x to 125x.

The output will have a DC bias of VCC/2 so when its perfectly quiet, the voltage will be a steady VCC/2 (1.65v).

Measuring Sound Levels : The Audio signal from the output of the amplifier is a varying voltage.  To measure the sound level, we need to take multiple measurements to find the minimum and maximum extents or "peak to peak amplitude" of the signal.After finding the minimum and maximum samples, we compute the difference and convert it to volts.

Although the amplifier is capable of a rail-to-rail signal (3.3v in this case), we map it to a 1v peak-to-peak signal. This output is compared to a reference to know if sound is low, normal or high.

 

The overall design for sensor is :

Capture.PNG

Sensors for the competetion :

As i havent received the boards, to start with I am explaining in this post the sensors used in the competetion.

Air Pollution

For air pollution I will be using MQ series of sensors. Which sensor i will use will depend on budget and availability. Here i am detailing all such sensors that I am looking forward to.

The MQ series of gas sensors use a small heater inside with an electro-chemical sensor and are sensitive for a range of gases and are used indoors at room temperature.

They can be calibrated more or less but a known concentration of the measured gas or gasses is needed for that. Typical circuit diagram is:

 

Heater is for +5V and is connected to both 'A' pins.

The variable resistor in the picture is the load-resistor and it can be used to determine a good value.

The Vout is connected to an analog input of the Beaglebone.

The Heater

Some sensors use 5V for the heater, others need 2V. The 2V can be created with a PWM signal and a transistor or logic-level mosfet.The heater may not be connected directly to an output-pin of the Beaglebone, since it uses too much current for that.

If it is used in a battery operated device, a transistor or logic-level mosfet could also be used to switch the heater on and off.

The sensors that use 5V or 6V for the internal heater do get warm. They can easily get 50 or 60 degrees Celcius.

After the "burn-in time", the heater needs to be on for about 3 minutes  before the readings become stable.

 

 

Load-resistor

 

 

The sensor needs a load-resistor at the output to ground. It's value could be from 2kOhm to 47kOhm. The lower the value, the less sensitive. The higher the value, the less accurate for higher concentrations of gas.

If only one specific gas is measured, the load-resistor can be calibrated by applying a know concentration of that gas. If the sensor is used to measure any gas (like in a air quality detector) the load-resistor could be set for a value of about 1V output with clean air.

Choosing a good value for the load-resistor is only valid after the burn-in time.

 

 

Burn-in

It is the time to burn-in the sensor. This is meant to make the sensor readings more consistent. A time of 12 or 24 hours is usually used for the burn-in time.

The Burn-in is achieved by applying normal power to the sensor (to the heater and with the 'A' and 'B' pins connected, and with a load-resistor).

 

 

MQ-2

 

 

Sensitive for Methane, Butane, LPG, smoke.

This sensor is sensitive for flamable and combustible gasses.

The heater uses 5V.

The MQ-2 at seeed: http://www.seeedstudio.com/wiki/Grove_-_Gas_Sensor%28MQ2%29

 

 

MQ-3

 

 

Sensitive for Alcohol, Ethanol, smoke

The heater uses 5V

The Arduino blog about the "breathalyzer" using a MQ-3 : http://arduino.cc/blog/2010/09/23/arduino-breathalyzer-calibrating-the-mq-3-alcohol-sensor/

The MQ303A (also on this page) is like this sensor, but uses a lower heater voltage.

 

 

MQ-4

 

 

Sensitive for Methane, CNG Gas

The heater uses 5V.

 

MQ-7

 

 

Sensitive for Carbon Monoxide

The heater uses an alternating voltage of 5V and 1.4V.

 

 

MQ-8

 

 

Sensitive for Hydrogen Gas

The heater uses 5V.

 

MQ-9

 

 

Sensitive for Carbon Monoxide, flammable gasses.

The heater uses an alternating voltage of 5V and 1.5V. It depends on the gases how to use that alternating voltage. If only Carbon Monoxide is tested, the heater can be set at 1.5V.

The MQ309A (also on this page) is like this sensor, but uses a lower heater voltage.

 

 

MQ131

 

 

Sensitive for Ozone

The heater uses 6V.

 

 

The load-resistor is 100k...200k, which is a lot higher than for other sensors. This sensor is also very sensitive. It measures in ppb (parts per billion) where other sensors measure in ppm (parts per million).

 

MQ135

 

 

For Air Quality

Sensitive for Benzene, Alcohol, smoke.

The heater uses 5V.

An example with calculation of the CO2 value: http://davidegironi.blogspot.it/2014/01/cheap-co2-meter-using-mq135-sensor-with.html

 

MQ136

 

 

Sensitive for Hydrogen Sulfide gas.

The heater uses 5V.

 

MQ137

 

 

Sensitive for Ammonia.

The heater uses 5V.

 

MQ138

 

 

Sensitive for Benzene, Toluene, Alcohol, Acetone, Propane, Formaldehyde gas, Hydrogen gas.

The heater uses 5V.

 

 

MQ216

 

 

Sensitive for Natural gas, Coal gas.

 

MQ307A

 

 

Sensitive for Carbon Monoxide

The heater uses an alternating voltage of 0.2V and 0.9.

It detects the same gasses as the MQ-7, but uses a lower heater voltage.

 

MQ309A

 

 

Sensitive for Carbon Monoxide, flammable gasses.

The heater uses an alternating voltage of 0.2V and 0.9V. It depends on the gases how to use that alternating voltage.

It detects the same gasses as the MQ-9, but uses a lower heater voltage.

 

 

 

For Humidity and temperature sensors requirements I will be using the Sensor Hub BoosterPack from ti for it assuming the launchpads have libraries for the same on energia. The ambient light sensor will be used to complement smoke sensors of the MQ series.

Thankyou for choosing me as a competitor in In The Air Design Challenge. I will be using different sensors in the challenge. Sensors for ozone, smoke, dust , light ,sound level will be used. If possible will be looking for ph sensors and conductivity tests on water samples to get water pollution level. In addition temperature, humidity sensors will be used from ti.


The different components will be integrated in the following way:

· All the sensors will be connected to MSP430 launchpad. The launchpad using onboard supercapacitor takes reading from all the sensors , passes them serialy to CC3200 launchpad and goes to low power sleep mode to save power.

· The CC3200 launchpad using wifi sends this to beaglebone.

· The beaglebone wifi dongle catches the data and stores the data in sierra cloud services.

· The CC3200,sensors and MSP430 is powered from a power circuit board that is made using wurth electronics pcb service. The power comes from 12v battery. The battery will be charged through solar cells. The charger will be made using wurth electronics inductors and passive components and ti solar charger ic with fabrication done through wurth pcb services.

· A mobile app will be made using eclipse iot and sandbox softwares.

· As regards how to get the Android devices talking to the Beaglebones, we'll need to send our data to a place that both devices can access. One simple way of doing this would be to use Google Spreadsheets. The Beaglebones could write data to the spreadsheets, and the Android app could display that data. The Android app could send command messages back to the spreadsheet and the Beaglebones could watch out for those messages and take the appropriate action.over.PNG