Skip navigation

In the Air Design Challenge

8 Posts authored by: nikil511

[Air ex Machina] Interlude

Posted by nikil511 Mar 1, 2015

well, obviously I overestimated my free time when I designed the project concept, hence did not manage to complete the system. It was really fun though, and a great opportunity to play with some really cool stuff, like the TI launchpads, BBB, BitScope and various sensors. Also it was good excuse to upgrade my workbench equipment, so I am now better prepared for IoT hardware adventures.  I would not want to waste all the sensors I got, plus I do want to view and log air quality information for my environment,  so I will continue with the project in my spare time, and keep blogging about it.

I guess it’s now a good time to thank all sponsors, element14, as well as all the other contesters for their generous support   :-)

One of, the most important aspects for an IoT solution, in my point of view, is device management, and more specifically the ability to receive over the air firmware updates (OTA). If OTA works, all other problems can be potentially solved.

My architecture in the [Air ex Machina] project, consists of the following layers:

  • backend, cloud based system. (e.g. airvantage)
    • gateway - integration platform (e.g. openhab on BBB)
      • sensor device (e.g. freeRTOS application on CC3200)

Cloud based systems are remote managed/updated by design, so the challenge is on the other layers. I have explored various approaches for solving this problem without having to reinvent the wheel, and I think it’s interesting to discuss the following ones:

  • Xen hypervisor / Mirage OS
  • Eclipse Kura, Leshan, Wakaama and lwM2M is a really cool startup, trying to solve both device managment problems and simplify code push / application update, on RPi/BBB/NUC hardware. They use docker containers to encapsulate the application on the end devices. I have been experimenting with their platform and it works great. So the idea here is that one could launch openhab on BBB as a docker container, through resin, and hence efficiently manage the gateway remotely.

I did not have time to test it, but I am guessing that a combination of these two should work:

By the way, resin and openhab are both partners of canonical on Snappy Ubuntu Core, so I expect to see great things coming from there..

A hypervisor could also be exploited to provide device management, running openhab within a VM. I think, this idea could work very nice with Intel NUC and VMware’s Hypervisor, but when going on a BBB (or lower) virtualization might not be so easy. However it seems with Xen this could be possible, since it does run on ARMv7

Xen has a very rich ecosystem so there must be many management tools/cloud fronts that could act as the manager-server which controls the BBB with the VM containing openhab. I am guessing that when a small change in a file takes place, a new VM image will have to get pushed, which is a disadvantage, but possibly Mirage (and Irmin?), might be able help in reducing the VM to only the necessary components of the OS along with the application. There is an interesting relevant project called which might provide such solution in the future among with solving connectivity issues between devices. If this approach is adopted for IoT, there will definitely be an interesting debate on docker containers vs hypervisors :-)

Finally, one can solve device management for both gateway and microcontrollers, by utilizing some (new) Eclipse IoT projects which are designed exactly for that.

Here is a nice overview of what's available: End-to-end IoT solutions with Java and Eclipse IoT

Kura is a Java/OSGi-based framework for IoT gateways you should definitely check out. It basicly has (almost) all the features that I could ask, for remote managment. Has APIs for hardware communication (serial ports, GPS, watchdog, GPIOs, I2C, etc.), management of network configurations, communication with M2M/IoT Integration Platforms, and overall gateway management.

and there is support for beaglebone

Kura provides a web interface, were you can control your BBB and you can upload you application as an equinox OSGi bundle. So theoretically, if you load all the OSGi bundles of openhab in to it, you will be able to have openhab running within Kura. Not very practical though, so I hope Eclipse Smarthome takes Kura into account, (or vise versa) so we can have best of both worlds :-)

Going a layer lower at CC3200, two very promising eclipse projects which I am sure IoT developers will use in the future (when OTA becomes even more nessesary) are Eclipse Leshan & Wakaama. They are OMA Lightweight M2M (LWM2M) server/client implementations in Java and C.

This is how the Leshan web interface looks like:


So one can have Leshan running on BBB, and wakaama running on CC3200 compiled together with the end application. This provides usefull data of CC3200 to BBB, but more importantly a mechanism for over the air updates, to the CC3200.
Unfortunately, there is no CC3200 port of Wakaama yet, but it should not be that difficult to port, so I guess it’s only a matter of time.

I definitely recommend looking in to Benjamin Cabé's blog, for more details:

As a software engineer, I do not normally work with custom hardware/electronics, so I was missing all basic components required for prototyping and was feeling kind of stuck. I did not want to spend the farnell budget on “consumable” general purpose electronic components, so decided to buy from ebay some cheap passive components in bulk, and use the competition budget on things that make more sense to buy from farnell.

I ordered “kits” of resistors, capacitors, dimmers, cables, breadboards, etc…mainly sourced from shenzhen, very cheap, but took more than a month to arrive in Greece (vs ~next day delivery when ordering from farnell), so lost quite some time in the hardware department, but atleast I finally now have a nice collection of passive components to use in this and future prototyping.

210Pcs 25 Value 0.1uF-220uF Electrolytic Capacitors Assortment Kit Set

1000 Pcs 50 Values Ceramic Disc Capacitors Kits

15 Values 3296 Trimmer Potentiometer Variable Resistors Kit

560pcs 56 Values (1Ω–10M Ω) 1/4W 0.25W 1% Metal Film Resistors

Breadboard, cables..


MQ7 CO Carbon Monoxide Coal Gas Sensor

MQ135 Air Quality Sensor Hazardous Gas Detection

LM2577S LM2596S DC-DC Step Up Down Boost Buck Voltage Power Converter ( will try to use it for the CO2 NDIR Infrared sensor which needs 18v)

Cheapy seansors: Rain sensor, temp-humidity, LM35 (these are for arduino so I need to check 3.3v operation)

SOT23 MSOP10 SMD to DIP10 Adapter for testing the TI temperature sensor

and two NRF24L01+ 2.4GHz Wireless Transceiver Module (in case I decide to separate CC3200 from EXP430)


Btw, Wurth was kind enough to provide me with a total of five kits of SMD inductors and capacitors, so here is a photo of my son sampling them :-)


So many sensors, so little time!

Have been studying sensor datasheets all this time to make up my mind on what sensors to use. Found it very hard come up with a meaningful, doable and useful selection. I was tempted to go for a full blown list of these popular, low-cost and popular air sensors:

You can find them on ebay for a few $ each, and it seems easy to get the readings:

However I had some concerns about the quality of their measurements. Datasheets are not very detailed, and I have no easy way of calibrating / confirming these readings.

I think one needs a second (quality) sensor as a reference and go through something like this:

Since I want to have both internal and external sensors for comparing air quality, I decided on a middle-approach. Low cost sensor outside, quality sensor inside, which is also used for calibrating/verification purposes. I’ve spent quite some time on the farnell website, and found an interesting CO2 NDIR Infrared sensor at the reasonable price of £33:


(last item, it seems its a few years old)

In terms of characteristics it looks very promising and easy to use, for newbies like myself:


Patented absorption infrared/gas sensing engine provides high accuracy in a

compact, low-cost package

• Patented ABC Logic™ self-calibration system eliminates the need for manual calibration in most applications

• Gas permeable, water-resistant diffusion filter prevents particulate and water contamination of the sensor

• Lifetime calibration guarantee

Measurement Range 0-2000 ppm factory calibrated

Duct Air Velocity 0 to 1500 ft/min (0-450 meter/min)

Temp Dependence 0.2% of full scale per ºC

*Accuracy ±40 ppm +3% of reading @ 22ºC (72ºF) when compared with a factory certified reference

Non-linearity <1% of full scale @ 22ºC (72ºF)

Power Supply Requirements 18 to 30 VAC RMS, 50/60 Hz or 18 to 42 VDC, polarity protected. Power Consumption Typical values (1.65 watts peak, 0.65 watts avg. @ 42 VDC)

Output Analog 0 to 10 VDC (100 ohm output impedance)

I know the input voltage is not ideal for TTL/CMOS stuff but I will try to "boost" things. (Any advice is more than welcome)

Btw there are newer / improved sensors from the same family but kind of expensive for my budget as I went for the SMD rework station.

My first thought with the T8031 was, "I will reverse engineer their circuit, and modify it, to power it after the voltage regulation with something closer to 5volts".

Great idea :-) if only everything was not covered in black varnish :-P

I should have guess that, by looking at the number of repetitions of the word "patent" in the datasheet :-)


Anyway, lets continue with the CO2 sensing by the book. I also found someone who has the T8031 running in parallel with MG-135 and looks ugly (probably for the MG-135),

I don't know if it’s in the same location, I will do my own tests, and in the worst case I will just keep the telaire sensor only.

I will also add Internal/external temperature and humidity but the TI SMD are soooo small. so will  start with some cheapy DHT11 & LM35 for breadboard prototyping and will go back to the SMD once I have my PCB.

Furthermore I will use the dust sensor for outdoor for outdoor measurements:

GP2Y1010AU0F - SHARP - DUST SENSOR | Farnell element14 UK

Found a nice example here: Monitoring your Air Quality

For external use, I do not like the idea of flooding the sensor when it rains, so I also got a basic rain/drop sensor (grill and LM358) in order to shut down the ventilation that will push air in the dust sensor when raining. I need to carefully think about the case. (if only I was roadtesting a 3D printer :-P )

I will also try to do a wind-meter based on a old brushless pc-fan, taking advantage the ball-bearings and the 3-wire speed sensor setup.

Hope to gain some ground during the holidays, as I did not have much free time to work on this project during the last two weeks.

Ambrogio did a very nice post on how to install java & openhab on BBB:…

Follows an alternative approach for installing JAVA and OpenHab on BBB which is hopefully more newbie-friendly.

1) Where is my Beaglebone ?


I have never played with Beaglebone before, so I assumed it was more or less an RPi and did not bother to look at the details.

Some differences that might delay an excited user are: HDMI plug is not the typical size (Type A), it is micro (type D)

So you need a micro hdmi cable or adapter to connect BBB directly on a monitor.


However, since Debian Linux is already installed in the internal eMMC 4GB, of the latest version of BBB, you can do stuff headless (without monitor) straight away.

So, hook an ethernet cable, power up BBB over USB. Note: use a dedicated PC USB (not a hub, where power is shared across).

(had to press reset for it to boot) ...and blue leds are flashing, Debian is up and running.... but what's the IP address ?


You can find out it’s IP with a number of ways, the easiest one is to try this:


this should by default work on linux/mac but for windows only if you have an mDNS/bonjour service installed.

(if you can’t be bother with bonjour, try FING or see your access point / modem DHCP list)

and you will see this web site running on BBB



of course SSH will work too, username root , with blank password.

(can use putty.exe on windows)



2) Installing JAVA

You can easily install java in BBB via the repository like this:


echo "deb precise main" | tee /etc/apt/sources.list.d/webupd8team-java.list
echo "deb-src precise main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list
apt-key adv --keyserver --recv-keys EEA14886
apt-get update
apt-get install oracle-java8-installer


The above installs the Java8 hard float after accepting the License Agreement ASCII screen, and configures the environment.

Hardfloat can have dramatic performance boost on some applications. More details here: - Oracle JDK


... Alternatively if you want to install JAVA manually:

First step is to download the JAVA8 "ARMv7 Linux - VFP, HardFP ABI, Little Endian1" from oracle. However this is not possible command line from BBB with "wget" because, oracle want's you to accept licences and login. So you need to do it from you desktop and then transfer the file to BBB. One way to transfer the file is via SFTP , so in windows you need to use something like filezilla or

you then sftp://beaglebone.lan

using root and blank password, and transfer the file across. Then...

tar xfvz ejdk-8-fcs-b132-linux-arm-vfp-hflt-03_mar_2014.gz

export JAVA_HOME=/usr/java/ejdk1.8.0/linux_arm_vfp_hflt/jre/

export PATH=$PATH:/usr/java/ejdk1.8.0/linux_arm_vfp_hflt/jre/bin/

...and add last two lines at  ~/.profile set upon boot


Eitherway, you should get something like this in the end:

java -version

java version "1.8.0"

Java(TM) SE Embedded Runtime Environment (build 1.8.0-b132)

Java HotSpot(TM) Embedded Client VM (build 25.0-b70, mixed mode)

Build 1.8.0-b132 is the lates manual one, and build 1.8.0_06-b23 the repository one.

3) Install Openhab

Openhab is very well organized as a community & java opensource project. They have debian builds/repo, and they use cloudbees for continuous integration.


That means it should be very easy to install OpenHab it in BBB/Debian, without having to do any manual stuff.


echo "deb /" > /etc/apt/sources.list.d/openhab.list
sudo apt-get update
apt-get install openhab-runtime


Thats all :-)

Reading package lists... Done

Building dependency tree

Reading state information... Done

The following NEW packages will be installed:


0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.

10 not fully installed or removed.

Need to get 37.5 MB of archives.

After this operation, 42.0 MB of additional disk space will be used.

WARNING: The following packages cannot be authenticated!


Install these packages without verification [y/N]? y

Get:1  openhab-runtime 1.5.0 [37.5 MB]


Of course, you need to select some bindings, e.g:


apt-get install openhab-addon-binding-http

apt-get install openhab-addon-binding-ntp

apt-get install openhab-addon-persistence-exec

apt-get install openhab-addon-persistence-logging

apt-get install openhab-addon-persistence-rrd4j


You will wanna change the OpenHAB's jetty webserver port in /etc/default/openhab since by default its HTTP_PORT=8080, and Debian has already a proxy service there. (e.g. change to 9090)

nano /etc/default/openhab

You may start now the openhab service

/etc/init.d/openhab start

[ ok ] Starting openhab (via systemctl): openhab.service.

service openhab status

find / -name openhab








Unfortunately openhab spreads on the above directories, (vs installing it manually from a zip, which keeps everything in one place)

If you want to replicate the demo you can download/extract the demo zip in /usr/share/openhab

If something is wrong you will need to see the log: /var/log/openhab/openhab.log

I will post more details on OpenHab on a future post, once I have some incoming sensor data.

4) Problems encountered

A) Upgrading

I always have the urge to upgrade stuff to their latest version, but maybe this is not such a good idea. Here is why:

sudo apt-get update

Fetched 20.1 MB in 48s (419 kB/s)


sudo apt-get upgrade

90 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Need to get 63.7 MB of archives.

After this operation, 264 kB of additional disk space will be used.


and got a couple of upgrade errors like:

dpkg: error processing apache2 (--configure):

dependency problems - leaving unconfigured

Setting up libdpkg-perl (1.16.15) ...

Setting up dpkg-dev (1.16.15) ...

Processing triggers for ca-certificates ...

Updating certificates in /etc/ssl/certs... 18 added, 5 removed; done.

Running hooks in /etc/ca-certificates/update.d....done.

Errors were encountered while processing:









E: Sub-process /usr/bin/dpkg returned an error code (1)


Restoring OS

So I guess, its better if you avoid upgrading, unless you want to dig deeper into what's happening.

btw, here are the images in case something goes wrong, or if you wanna try via an microSD card

To restore BBB to original state, download the emmc debian image, sector-write it on an microSD, and boot BBB with S2 button pressed.

Note:If all 4 leds flash together, try again, it should not be like that. (Its a emmc write error)

I flashed SD card again, tried everything from start, and copy finished in ~10min)


B) Debian default approach will not install java:

I could not install java the straightforward Debian way.


sudo apt-get install python-software-properties

sudo add-apt-repository ppa:webupd8team/java

sudo apt-get update

sudo apt-get install oracle-java8-installer


W: Failed to fetch  Unable to find expected entry 'main/binary-armel/Packages' in Release file (Wrong sources.list entry or malformed file)

W: Failed to fetch  404  Not Found

W: Failed to fetch  404  Not Found

W: Failed to fetch  404  Not Found

E: Some index files failed to download. They have been ignored, or old ones used instead.

root@beaglebone:~# apt-get install oracle-java8-installer

Reading package lists... Done

Building dependency tree

Reading state information... Done

E: Unable to locate package oracle-java8-installer

C) Openhab ver 1.5.1 via deb repository does not seem to work on BBB

Latest stable release of openhab is ver 1.5.1. Unfortunately I could not start the service on BBB neither could I find out what was wrong.

More details here:

They will release version 1.6 in the next few days, so I will upgrade to that version one way or another (via deb repository or manual "zip")


Next post:[Air ex Machina] #05 Lost in the sensors

Downloaded CCStudio, after creating an account on TI

I am familiar with eclipse based IDEs (for java though), so I thought how hard can this be ?

well... took me an couple of hours to find my way, and understand just the basics.


I started doing random stuff (like always) but this time nothing worked :-) so had to follow carefully this excelent guide (thank you for that shabaz):

which also includes this guide:

Everything went smoothly, and CCStudio works as it should.

I really like the debugger  + serial console, and I guess that's one of the differences with Energia.

In Energia you can not "freeze" running code, so the only way to debug stuff is to use the Serial.println()

In CCStudio you freeze execution at breakpoints and check all variable state, etc..


Furthermore I noticed that http related examples use the TI-RTOS (right?)

I hope an embedded RTOS will not make software development more complicated (than a super loop approach), then again I guess that's unavoidable when program becomes more complex. Will report back on that.


I have encounter a problem. I can not make to "out of the box demo" work 100% correct again. I can see the web site with the demo apps, but temperature value is NaN. It was working when I first received the board, and I want to make it work again, to understand the example, so I will look deeper into that and edit this post.



found more details on the sample programs:

so the problem I had with the out of the box application is solved.

I was flashing "httpserver" and not "oob". Once I had flashed "httpserver", with the android simplelink app, I could see an (offline) website same as oob, and demo apps were not working. When I flashed oob, everything worked correct.


Next post:[Air ex Machina] #04 Beaglebone for dummies - JAVA,OpenHab

I am not the “read the manual” kind of person, so I searched for energia + cc3200, found this:

had a quick look at the instructions and started downloading/installing software. I’m runing windows 8.1 64bit, so I ‘ve installed drivers for FTDI via DPInst64.exe from cc3200_drivers_win

Then extracted and runned energia, selected correct COM, loaded blink sample, upload and….

Opening COM4

Read ACK failed

Failed to trigger bootloader

I later found this link which explains things:

CC3200 comes preloaded with a demo web server / access point. That's cool. I scanned for wifi on my Android, and simplelink, out of the box was there, working as it should…played with the demo apps, very nice way to start with these boards.


I continued with “project 0 guide” ..and realized that I had to move jumper from P58-VCC to SOP2. Tried to upload a blink sample code and..

Opening COM4

Getting storage list

Bootloader Version: 3

Silicon version ES1.32

Bootloader version is 2, 0, 3, 2

It's a CC3101 device: PG1.32

BlockSize is 4096, number of blocks is 64

erasing 1 blocks starting from  4

Switch to NWP bootloader complete

Silicon version ES1.32

Bootloader version is 2, 0, 3, 4

BlockSize is 4096, number of blocks is 16

erasing 12 blocks starting from  0

erasing file "/sys/mcuimg.bin"

deleting file "/sys/mcuimg.bin"

erase file completed

Downloading file "/sys/mcuimg.bin" with size 4128

..Download complete

However, still no led blink.. pressed reset, nothing changes, removed SOP2, pressed reset, and yes, we have a blink! :-)

Next post: [Air ex Machina] #03 CC3200 with CCStudio

When I found out about this competition, I did a search to find similar projects and get ideas.

I soon discovered these two:

A community-led air quality sensing network that gives people a way to participate in the conversation about air quality

Smart Citizen is a platform to generate participatory processes of the people in the cities. Connecting data, people and knowledge, the objective of the platform is to serve as a node for building productive open indicators and distributed tools, and thereafter the collective construction of the city for its own inhabitants.

These projects go beyond the typical diy approach. They have designed something that can really scale, trying to build communities that crowdsource data for the common good. I really like this concept of community-diy, ie lets solve a big problem all together. In many countries (like Greece where I live) weather forecast and air quality information is kind of poor to say the least. Government’s environmental agencies do not deploy fancy/expensive equipment like rain radars, air pollution sensors in many locations etc, hence people do not have accurate weather forecasts, short term hyperlocal rain forecasts and other important air pollution information. With the evolution of technology, citizens can solve this problem on their own without government support. I guess thats the case with, and many other similar projects. Once sensor-locations become dence in an area area, and all data are open/shared on a common server, it should be feasible to radar-animation of pollution or rain in real time. This can be used as a basis for hyper local, short term forecasts and various other services e.g. receive an alert on your mobile phone that it will rain at your location in 5 minutes or have pollution alerting mechanisms for people with health conditions, etc.

Introducing Air ex Machina...

Air ex Machina architecture.png

Outdoor unit:

The aim is to  create a compact, battery powered weather & air quality station based on CC3200 & MSP430FR5969 utilizing various sensors like:

  • Rain drops sensor (basic accuracy for low/high precipitation)
  • Temperature/Humidity Sensor (DHT22)
  • Grove - Air quality sensor
  • NO2/CO Sensor (MICS-4514)
  • Particle sensor (for dust or pollen)
  • Ozone (O3) Sensor
  • Volatile Organics (VoC) Sensor
  • ...or maybe an Air Quality Egg shield or an Smart Citizen ambient board.

Sensor set A,B,C will be finalized during the project - agile/prototype approach.

This outdoor, battery powered unit will require a cleverly designed box to keep the electronics dry, but expose the sensors to the elements. I am going to place it on my flat’s balcony. Wifi will be used for communication with the indoor controller (beaglebone).

Indoor controller/gateway:

Beagleboard will be located inside the house, connected with some of the above sensors again, for comparing internal with external air quality. In addition I will have openhab running on beagleboard, and configure the http binding of openhab to consume a simple http API which will be exposed by the web-server of CC3200.

Having OpenHab as an integration platform, gateway and controller, is really useful for applying some automation in the house using the OpenHab rule engine, e.g. turn ventilation on/off when certain threshold on some sensors has been reached. Also openhab will provide a mobile user interface, as well an easy way to stream sensor data to a cloud server in real time via MQTT or HTTP. I will attempt air-control with rules and some “zwave” plugs or roller shutter in order to approach the use case of opening ventilation when it makes sense based on external temperature and air quality, and will try to deploy it in my house and see if its actually realistic to have it running.

Cloud backend:

I am looking forward connecting all these things to AirVantage and see what's possible in terms of data analytics/ user interface presentation / rule engine control, etc. However as I am an opensource advocate I will also attempt to connect my things to an open source platform that could form the basis of a backend system for a new crowdsourced environmental observations community as inspired by smartcitizen and the rest. I initially had in mind, but then I found this project which seems even better suited, so I will give it a try, deploy it and connect my things with it through OpenHab.Will also need an MQTT broker like HiveMQ to have multiple backend systems running.  Of course all these cloud stuff make more sense if/once more people join the project and share their data. It would be cool, if other in-the-air competitors are interested to connect their sensors also to my backend once it’s online :-)

But first, lets play with TI's launchpads...

>>Link to next post: #02 LaunchPad cc3200 first play