Skip navigation

In the Air Design Challenge

6 Posts authored by: rmlab


The image below shows my sensor node enclosure. The enclosure is an air-tight box where all electronics ( MSP430FR5969, batteries, C110L tranceiver) will be fixed inside. A total of four PVC elbows with 12 inches pipes are mounted on two longer sides of the air-tight box for sensor probes that will be submerged in the water. Additionally, upward pipe on one of the shorter side is also mounted for the Air temperature and Carbon dioxide sensors. A 5W soloar panel is placed in an inclined position on top of the box. I am still working on the removable holder for the solar panel that can adjusted 45 degrees on the pivot point. This enclosure will be embedded on a bamboo tray before deploying in sea water.

 

 

parts_placement.jpg


Additional photos of the sensor node enclosure.

20141210_062042.jpg  20141210_061915.jpg  20141210_061958.jpg

Click this link Ryan Labutap to view my previous post on this project.

This is a continuation of Post#4 , data received through UART in Beaglebone board is displayed in terminal. My problem the last time is that I can't send data to AirVantage using MQTT since my Beaglebone is behind university proxy. MQTT is using default port 1883 as reserved with IANA. To avoid this problem, I will be using REST API instead.

In this post, data will be sent to AirVantage using Python with REST API.

 

About AirVantage:

 

 

Sierra Wireless AirVantage M2M Cloud provides a seamless connection between devices, M2M cloud and the enterprise. Devices include Sierra wireless' modules and gateways but third party hardware like Beaglebone may be used instead which may communicate to AirVantage Cloud using standard protocols like MQTT and HTTP. AirVantage platform offers secure big data storage and management with good features like data and communication monitoring. Stored data may be retrieved and integrated with multiple backend systems, web and mobile application. All of this can be tried for six months with up to 5 connected devices through this link Sierra Wireless - AirVantage Enterprise Platform (AVEP)

 

Connecting Beaglebone to AirVantage Cloud with Python using REST:


Here are some guides on how to setup system on AirVantage:

1. Video Link: Building IoT Projects on the AirVantage M2M Cloud

2. To interface with AirVantage: Using REST API for devices

 

Command to access Beaglebone serial number:

# hexdump -e '8/1 "%c"' /sys/bus/i2c/devices/0-0050/eeprom -s 16 -n 12 2>&1



 

After AirVantage setup is to write a code in Beaglebone for publishing data. You will need to install "requests" to use example code below:

# pip install requests



 

Edited version of post#4 Python code ( added sending data to AirVantage )

import serial
import time
from xbee import XBee
import json
import requests

serial_port = serial.Serial('/dev/ttyO2', 9600) #UART2 of Beaglebone
host = "https://na.airvantage.net"
url = "{}/device/messages".format( host )

def print_data(data):
  if 'source_addr' in data:
  hex_data = data['rf_data']
  sensor_data = map(ord, hex_data)
  doxy = sensor_data[1]
  data = [
  {
    "algal.doxy": [
      { "value" : doxy }
    ]
  },
  {
    "algal.threshold": [
      { "value" : "30" }
    ]
  }
  ]
  requests.post( url,
  auth=("XXXXXXXX", "1234"), #replace XXXXXXXX with Beaglebone serial number
  data=json.dumps(data),
  headers={'Content-type': 'application/json'}
  )
  print 'D.O. = %d'%sensor_data[1]

xbee = XBee(serial_port, callback = print_data)

while True:
  try:
      time.sleep(0.01)
  except KeyboardInterrupt:
      break

xbee.halt()
serial_port.close()


 

Run the python code in Beaglebone and monitor updates in AirVantage cloud.

reading nov24.png

 

Data History: D.O. chart for last 3 hours


graph.png


Next post: Since I have already tested Beaglebone and AirVantage, I might shift my work on CC3200 and post my experience with it next week.

In this week's post, I will be using a transceiver connected to a UART of BBB to collect data.

  • Cool features of Beaglebone Black rev C
  • Hardware setup
  • Using UART of BBB

 

Cool features of Beaglebone Black:

     This is the first time I use BBB and below are some of the cool features I love during the first few days of use. This board is amazing and I'm sure there will be more features to enjoy.

  1. Processor. 1GHz chip with 512 of DDR3 RAM
  2. OnBoard Flash Memory. Referred to as eMMC with pre-installed Debian OS. With this, I was able to use BBB out of the box even without MicroSD card and the change from Angstrom to Debian makes my transition from RaspPi easier.
  3. Mini USB Port. This allows you to access BBB through your computer aside from the ethernet port. Since I frequently change IP address of eth0 of the board, the mini usb port gives me a fix way to access BBB (BTW through 192.168.7.2).
  4. Expansion headers. There are two headers labeled P9 and P8 for GPIO, I2C, SPI, UART, CAN, PWM, ADC

 

Hardware setup:

xbee_analog.jpg xbee_bbb.jpg

The materials used in this post including Arduino board, shields and XBee radios are just to test the UART of BBB and will not be used in the design challenge instead they will be replaced by MSP4305969 and CC110L. The left figure above is the source of data. I am using Arduino Mega with Wireless shield. The transceiver is XBee series 1. The potentiometer is to simulate analog sensor and connected to A5 of the Arduino board.

The right figure is a Beaglebone Black conncted to my computer. The XBee s1 is attached to an XBee shield for Arduino but this shield is just used as breakout board in this setup.

  • XBee pin 1 is Vcc connected to P9_3 of BBB (3.3V source) Caution: XBee operates at 3.3V and check the BBB pin mapping below
  • XBee pin 10 is GND connected to P9_1 of BBB (GND)
  • XBee pin 2 is Dout connected to P9_22 of BBB (UART2_RXD)
  • XBee pin 3 is Din connected to P9_21 of BBB (UART2_TXD)

 

Using UART of Beaglebone Black:

Pin mapping of BBB with UART pins highlight

UART BBB.pnghttp://beagleboard.org/Support/bone101

TxRxdevice
UART0J1_4J1_5/dev/ttyO0
UART1P9_26P9_24/dev/ttyO1
UART2P9_22P9_21

/dev/ttyO2

UART3P9_42/dev/ttyO3
UART4P9_11P9_13/dev/ttyO4
UART5P8_38P8_37/dev/ttyO5

 

1. To use a particular UART, it has to be enabled first:

# echo BB-UART2 >> /sys/devices/bone_capemgr.9/slots

 

2. Before the code, you have to install xbee library for python:

#wget https://python-xbee.googlecode.com/files/XBee-2.1.0.tar.gz
#tar -xvf XBee-2.1.0.tar.gz
#cd XBee-2.1.0
#python ./setup.py install


3. Create a python file and give it a name:

# nano xbee_bbb.py


4. Code:

import serial
import time
from xbee import XBee

serial_port = serial.Serial('dev/ttyO2', 9600)

def print_data(data):
     if 'source_addr' in data:
          hex_data = data['rf_data']
          sensor_data = map(ord, hex_data)
          print 'D.O. = %d'%sensor_data[0]
          print sensor_data[1]
          print sensor_data[2]
          print sensro_data[3]

xbee = XBee(serial_port, callback = print_data)
while True:
     try:
          time.sleep(0.01)
     except KeyboardInterrupt:
          break
xbee.halt()
serial_port.close()

 

Note: Check the table above for device name if you want to use other UART

 

5. Run the code:

#python xbee_bbb.py

 

Here is the output:

code.jpg

6. Turn the potentiometer connected to A5 of Arduino to see change of value for  D.O. The other 3 values below D.O. are analog readings from A4,A3 and A2 of Arduino and these will be just random values since nothing is connected to these ports.

 

I am supposed to publish the received data by the BBB to AirVantage cloud but I am having trouble with proxy configuration since my device is behind university proxy.

I will update this post or have it another post with data in the cloud as soon as I'm able to figure out my proxy configuration.

I am able to update and install in my BBB but sending data to cloud fails. Any help on this is much appreciated. Thanks.

Title: Low Cost Harmful Algal Bloom Monitoring


In post#2, I have identified the sensors, microcontroller and transceiver to be used for the sensor node. For this week to complete the whole system, detailed on the 2nd subsystem(the receiving end) will be illustrated.


Gateway.jpg


A. Aggregator node:

This node collects data from one or more sensor nodes through CC110L transceiver, but this node has more functions than just receiving data. Using CC3200 wifi Launchpad, the node will act as MQTT client, directly publishing received sensor data to AirVantage cloud. With air and water temperature, humidity, color, dissolved oxygen and CO2 data available in the cloud, coastal managers and other authorities can easily assess the possibility of harmful algal bloom through smartphone apps.

Additional function of this node is being a messaging client connected to a messaging server. I am thinking of using this so authorities after receiving data through the cloud may in return send messages that will control sensor nodes in the field.


B. Beaglebone as messaging server:

Sensor data are only particularly useful to authorities who can analyze these parameter but fishing operators, fishermen and ordinary consumers don’t care about these data, all they need is advisory/notification whether it’s safe to harvest/consume marine products. With this in mind, Beaglebone will be setup as XMPP server to send alert messages. This will allow coastal managers to directly communicate to consumers, fishermen and as well as our aggregator node since it was configured to be an XMPP client as well.


C. AirVantage cloud:

All data will be published and stored in this cloud service.


D. Data clients/messaging clients

These refer to consumers, fishermen and other interested parties. I will be creating apps (through the help of my colleagues) that able to graphically display data coming from Airvantage cloud through REST api. The app should have a messaging (similar to Viber) feature, user registered to any XMPP public server will be able to receive messages from Beaglebone XMPP server as long as it’s federated.

Title: Low Cost Harmful Algal Bloom Monitoring

Recap: This is my second post. Last week, I gave a brief introduction on what is HAB (Harmful Algal Bloom) and its impact (economic, environmental and health). I also gave its cause including the role of climate change (temperature and Carbon dioxide) in frequent occurrence of HAB. On the technical side, I gave an overview on how the system would be setup and look like. Basically the system can be divided into two subsytems: the wireless sensor node part ( enclosed in a buoy and deployed in coastal water) and the base station (located inland near the coast).


For this week's post, detailed information on sensor node.

 

 

                                    Sensor node.jpg

WIRELESS SENSOR NODE:

 

A. Microcontroller:

    16 bit MSP430FR5969 is the main microcontroller for the wireless sensor node. This MCU has two UARTs: one can be used for the transceiver and the other for sensors. Since I will be attaching multiple sensors to  a single UART, I will be using a 74HC4052 Mux/Demux IC capable of connecting up to four asynchronous serial UART devices into one single microcontrollers UART RX/TX pins.

 

B. RF communication:

    Data acquired by the node through its sensors will be sent to the base station through RF transceiver and I will be using TI's CC110L transceiver. Ideally, transceivers with longer range and capable  of mesh topology  should be  used considering node will be placed far from base station and my ultimate goal is to build and deploy network of wireless sensor nodes ( if I have enough fund or if our local government will give ). So for a single node project, CC110L will do with limited budget.

 

C. Power source:

    3.7V lithium ion battery with charging circuit and solar panel.

 

D. Sensors:

    1. Carbon dioxide sensor

              - with analog interface and using MG811

    2. Temperature and Humidity sensor

              -measure air temperature and humidity using SHT10 sensor

        • Humidity Ranger:0-100%RH
        • Temperature ranger: -10-80℃
        • Humidity accuracy:±5.0%RH
        • Temperature accuracy:±0.5℃

    3. Submersible temperature sensor

              -  digital output temperature probe with UART interface

              -  accuracy +/- 1C operating at 3.1-5V

    4. Color sensor

              - color probe can be used to monitor slowly changing events like algal bloom

              - outputs 8-bit format R,G,B data

              - outputs light intensity in lux

              - operating at 3.1-5V

              - UART interface

    5. Dissolved Oxygen sensor

              - during algal bloom, D.O. level drops and this will be a good indicator

              - output range of probe is 0-20 mg/L

              - interface either UART or I2C

 

So, that's it for now.

Next week, I will be posting detailed information on the second subsystem: the base station.

Once I receive the challenge kit, I'll post my tinkering experience with the kits next week as well.

Pls do comment for suggestions and questions. Thank you.

Hi everyone!

 

This is my first design challenge and got really excited when I first learned my proposal was accepted.

Many thanks Dr. Defeo and sponsors (Texas Instruments, Wurth Electronics, Cisco, element14, Eclipse, Sierra Wireless) for the opportunity.

Never had the chance to  use  Beaglebone, TI launchpads and other tools in this challenge before,

so I'm excited to start playing with these cool and powerful boards once I receive the challenge kit.


To readers, just few thoughts, this project is not the typical air monitoring system.

This is more on monitoring harmful algal bloom(HAB) in water and the impact of climate change to HAB considering temperature and carbon dioxide in the air.

Suggestions and any help will be much appreciated.

 

Introduction:

Philippines, located in Asia-pacific, ranks 12th in the world for marine capture production with 2.127 million tons in 2012 according Food and Agriculture Organization of United Nations. The country has a total of 13 major fishing grounds including Samar Sea in the eastern part. Samar Sea is known for marine shell products and contributes 6,809.7 MT of mussel, about 25% of country’s total mussel production. According to the country’s Bureau of Food and Aquatic Resources (BFAR), mussel production in Samar has greatly decreased from 105,000 MT in 1985. Major reason for this drop in production is high incidence of HAB or Harmful Algal Bloom (commonly known as Red Tide) in the area. Annually, BFAR releases number of advisories preventing harvest and consumption of mussel due to HAB. During HAB, certain marine products including mussels are banned to avoid food poisoning. This also caused several millions of pesos on potential income of Filipino fishermen and losses in revenue for the government.

          Harmful Algal Bloom describes coastal phenomenon where high algal biomass or concentration of algae is detected with effects including depleted dissolved oxygen and discoloration in bodies of water (Burlingame et. al, 1992). According to US EPA (Environmental Protection Agency), frequent occurrence of HAB is attributed to climate change along with nutrient pollution. Some climate impacts favoring harmful algae are warmer temperature, higher carbon dioxide levels in the air and water, and changes in rainfall pattern that might lead to more intense storms causing nutrient runoff to coastal areas. HAB cannot be prevented due to uncontrollable causes like climate change, the best option for coastal managers is constant monitoring and timely dissemination of information. Pre mature ban of harvesting marine products means economic loss while late advisory will harm environment, organisms and human that might lead to death. Thus, almost real time HAB information in critical.

          Numerous HAB monitoring methodology have already been established from traditional method of water sampling then conducting test on water samples in the laboratory, to  modern sophisticated method such as satellite imaging (Tresscot, 2012). In the Philippines, common method is still water sampling and testing in laboratory which wastes so much time for information/advisories to be accessible to public. Modern methods are not considered due to very high cost that can range up to millions of dollars. This project proposal aims to address these problems.


Project Design:

Wireless sensor network will be used to monitor HAB. Sensor nodes enclosed in a buoy moored through an anchor will be deployed in Maqueda bay( center of mussel production in Samar sea). Sensor nodes wirelessly transmit sensor data to a gateway located inland. The gateway is connected to Internet so data can be saved and accessed through a cloud service. Authorities and the public will have access to the data in a form of notifications through a messenger application.

Sensors: Color, Dissolved oxygen, temperature, and Carbon dioxide sensors

 

Note: I will post details on the sensor node and gateway design soon.

 

 

 

 

 

Thank you Dr. Tiglao of UP for inputs and encouragement, Samar State University for support.

Of course my family, thank you and I'll be busier for next 3 months.

Thanks everyone!