Skip navigation

In the Air Design Challenge

10 Posts authored by: tomaja

Previous posts:

In the Air Design Challenge - Pollen & Allergen Sensing

In the Air Design Challenge - Pollen & Allergen Sensing – Post 1 (Pollen Sensor)

In the Air Design Challenge - Pollen & Allergen Sensing – Post 2

In the Air Design Challenge - Pollen & Allergen Sensing – Post 3 (AirVantage Intro)

In the Air Design Challenge - Pollen & Allergen Sensing – Post 4 (Preparing the InTheAir Power Board)

In the Air Design Challenge - Pollen & Allergen Sensing – Post 5 (InTheAir Power Board)

In the Air Design Challenge - Pollen & Allergen Sensing – Post 6 (HDC1000 Sensor)

In the Air Design Challenge - Pollen & Allergen Sensing - Post 7 (WE Direkt PCB)

In the Air Design Challenge - Pollen & Allergen Sensing - Post 8 (InTheAir application)

 

Introduction

Thanks to all the sponsors of this contest! Special thank you to doctorcdf who has been very helpful throughout this entire challenge.

I'm very happy that I got the chance to take part in this. I made contact to some great people who were always willing to help even though they compete too.

Now, as the title suggests, my intention with this post is to just take the current project snapshot, not to end it.

This project is not complete due to very bad estimation of the required time and some missing hardware components. Anyway, I plan to finish the project - I'll continue posting about the progress until I'm done. Next up will be the detailed post about InTheAir Qt application running on a BeagleBone Black without X server.

 

Components status

 

1. BeagleBone Black with BB_View43

BBB is used as a Control Panel with current sensor readings displayed in a full-screen C++ application. I spent way too much time on trying to make touchscreen work properly but I failed - pointer kept jumping to the right side of the screen by itself. It's probably some hardware fault so I decided that I will use the screen as a regular non-touch screen and make the kiosk mode application - this could still be nice.

I setup my BBB to run Debian Linux without window manager (or X server). Qt application writes directly into the framebuffer so X server is not required (The Virtual Framebuffer | Documentation | Qt Project). This is very convenient (no unnecessary resources are being used). The application itself is fully functional but I built Qt without OpenSSL so REST requests are failing so I need to rebuild Qt before I make the detailed post on this subject. Here's a short demo of my Qt application running on the BBB:

Video 1. BBB running my InTheAir application

 

2. CC3200 Launchpad with custom power supply board

This component of my project was looking very nice until I got to the part where I want to use solar panel for battery charging.

The board was designed using Eagle and made by Wurth Elektronik and I'm more than happy with how it turned out. Great job Wurth.de and thank you sleuz for your help!

IMAG0054.jpg

Figure 1. Connected board with TI's HDC1000 and Sharp dust sensor

 

My board is using two TI boost converters with fixed output voltage for 3.3V (TPS61201 | Step-Up (Boost) Converter | Converter (Integrated Switch) | Description & parametrics) and 5V (TPS61202 | Step-Up (Boost) Converter | Converter (Integrated Switch) | Description & parametrics) rails on TI Launchpad. 5V supply is used for the Sharp dust sensor. This part of circuit works fine - if I drive this part of board with 3.8V input from a LiPo battery, I get proper voltages on TPS61201 and TPS61202 outputs.

This board also includes two headers one for TI HDC1000 and one for Sharp dust sensor. I followed shabaz's advice and included a OpAmp to put the dust sensor output in the MSP430 ADC input range. Since I wasn't thinking about this problem (input incompatibility) I designed the board without taking the OpAmp into account so I had to build a small board for that and place it in the middle of the dust sensor "cable". This isn't pretty but it works (especially that epoxy connector)!

IMAG0052.jpg

Figure 2. Small board with OpAmp for level adjustment

 

One more thing that wasn't well considered was the choice of pin for the dust sensor output - I selected a pin that's being used for UART Rx and since I plan to use UART later I did a small PCB modification (using X-acto knife and a piece of wire) and changed the dust sensor reading pin.

IMAG0053.jpg

Figure 3. PCB modification

 

BQ25504 is where the problem is. Everything looks nice, no shorted pads, everything soldered but this part doesn't give output when I connect a charged battery (charged to ~3.8V).

I decided to leave this for a while and work on other components until I get another sample from TI.

 

3. FRAM Launchpad

FRAM Launchpad will be used to operate the pollen sensor. My plan is to connect FRAM with CC3200 Launchpads via UART and feed the sensor readings to CC3200. Since I'm still waiting for some essential component for the pollen sensor I didn't spend much time on the Launchpad itself apart from testing it with Energia.

As for the pollen sensor, since I don't have means for pollen sensor calibration, I plan to provide readings of "low/medium/high" type.

I did some tests with detecting dust particles using a photodiode with built-in operational amplifier (OPT101P) but I think that the sensitivity is too low for my application so I ordered separate photodiodes and operational amplifiers and read some literature on photo-sensing. This will be in my focus until I complete the project.

I would like to express my gratitude to shabaz and michaelwylie for providing very useful information and resources.

Also, janisalnis's work on dust detection encouraged me to keep working on the pollen sensor.

 

4. Software

Software part currently consists of Energia sketch running on CC3200 and a viewer application. This sketch currently reads the temperature, humidity and dust levels but I plan to include the pollen level as well. My initial plan was to use the collected data to operate the air purifier and automatically close window(s) depending on the sensor readings. For this I included the C MQTT library (https://eclipse.org/paho/clients/c/) into my Qt application and made some test with subscribing to AirVantage's SERIAL/tasks/messages topic - this worked as advertised but I didn't connect any actuator until today.

 

Conclusion

Even though this challenge came to its end, I plan to continue working on this project since the crucial component (pollen sensor) is not produced.

 

Thanks Element14, Wurth Elektronik, Texas Instruments, CadSoft, Eclipse and Sierra Wireless! It's been fun!

Previous posts:

In the Air Design Challenge - Pollen & Allergen Sensing

In the Air Design Challenge - Pollen & Allergen Sensing – Post 1 (Pollen Sensor)

In the Air Design Challenge - Pollen & Allergen Sensing – Post 2

In the Air Design Challenge - Pollen & Allergen Sensing – Post 3 (AirVantage Intro)

In the Air Design Challenge - Pollen & Allergen Sensing – Post 4 (Preparing the InTheAir Power Board)

In the Air Design Challenge - Pollen & Allergen Sensing – Post 5 (InTheAir Power Board)

In the Air Design Challenge - Pollen & Allergen Sensing – Post 6 (HDC1000 Sensor)

In the Air Design Challenge - Pollen & Allergen Sensing - Post 7 (WE Direkt PCB)

 

Introduction

I've been very busy at home (moving into my new home) so I didn't make too much progress but I have a multi-platform application to share. I have it running on Windows, Linux, OSX, Android and BlackBerry but should run just fine on iPhone/iPad too (haven't tried that - I don't have the iPhone).

My project will be missing the key feature (pollen sensor) but I will continue to work on it after this challenge is complete. Having the pollen sensor would be great for me, should help me fight the allergy.

 

Qt-based application

InTheAir client application currently just shows the sensor values (and history for dust and pollen). Since pollen sensor is on hold until I obtain the required parts this app only shows the dummy value for pollen. Other values seen on the screenshot are also manually submitted using the Paho MQTT client but I have other sensors working, so, in a couple of days, these will show the real values for other three parameters.

 

unnamed1.png

Figure 1. Android screenshot

 

unnamed.png

Figure 2. Android screenshot with history charts shown

 

Source code

Source code is still dirty but I shared it anyway (attached InTheAir.zip)

Previous posts:

In the Air Design Challenge - Pollen & Allergen Sensing

In the Air Design Challenge - Pollen & Allergen Sensing – Post 1 (Pollen Sensor)

In the Air Design Challenge - Pollen & Allergen Sensing – Post 2

In the Air Design Challenge - Pollen & Allergen Sensing – Post 3 (AirVantage Intro)

In the Air Design Challenge - Pollen & Allergen Sensing – Post 4 (Preparing the InTheAir Power Board)

In the Air Design Challenge - Pollen & Allergen Sensing – Post 5 (InTheAir Power Board)

In the Air Design Challenge - Pollen & Allergen Sensing – Post 6 (HDC1000 Sensor)


I was very busy at work the last couple of weeks so I couldn’t work that much but now I can concentrate on my build.

 

Power supply PCB + sensor connectors

Last week I received my prototype PCB from WE Direkt. I’m very happy with what they did. I’m not an expert since this is my second outsourced  PCB but it looks really great. SeeedStudio board that I ordered a couple of years ago was fine too, but this one is looking much more professional. Pads are gold plated (not really required but still).

Even though the price shown on WEDirekt site during checkout was a bit higher it was reduced after they did the “data check”. They take into account the board size and reduce the price if possible. So, I had to pay ~25€ after all and got the board in 7 days.

The only issue with the board (that I'm aware of) is my fault - I submitted BRD file and left some layer that wasn't supposed to be there. That's why there are overlapping silkscreen labels all over it.

I took these pictures using my phone so they’re not top quality. I will use a proper camera when I finish the board completely.

IMG-20150128-WA0007.jpgImage 1 - PCB from WE Direkt

 

Thanks to WE and especially sleuz I got the capacitor kit so I had all the necessary capacitors for my build.

2015-01-30 19.09.35.jpgImage 2 - Würth capacitor kit (0805)

 

However, I still didn’t receive inductor kits that everyone else got as part of challenge kit. As a workaround, Simon sent me just the required inductors until I (hopefully) receive those kits. Interesting thing about those inductors is that I had to pay duty + tax for 5 inductors from Simon that cost 1.15€! That’s really silly, but what can you do It was just around 0.35€ of duty and tax but it takes time to handle it so I’m still waiting for them too.

So, many thanks to Simon and WE!

Some resistors are still missing from the board but I will get those locally so they should be acquired quickly.

 

Current board state

This is my first ever SMD board/soldering but I think it might end up looking nice anyway. I was using hot air station (for SMD) and soldering iron (for through-hole parts).

Please disregard the HDC1000, I was just playing with it and forgot to take it out.

IMAG0515.jpg

Image 3 - Semi-populated board

 

 

Those inductors should be here in a day or two so I will give an update post as soon as I finish populating the board.

 

I got my hot air station last year but didn’t get the chance to use it too much until now. It was really fun!

Previous posts:

In the Air Design Challenge - Pollen & Allergen Sensing

In the Air Design Challenge - Pollen & Allergen Sensing – Post 1 (Pollen Sensor)

In the Air Design Challenge - Pollen & Allergen Sensing – Post 2

In the Air Design Challenge - Pollen & Allergen Sensing – Post 3 (AirVantage Intro)

In the Air Design Challenge - Pollen & Allergen Sensing – Post 4 (Preparing the InTheAir Power Board)

In the Air Design Challenge - Pollen & Allergen Sensing – Post 5 (InTheAir Power Board)

 

Interfacing with HDC1000 Temperature and Humidity sensor

 

Thanks to Texas Instruments I received my HDC1000EVM - TEXAS INSTRUMENTS - EVAL BOARD, HDC1000 TEMP/HUMIDITY SENSOR | Farnell element14 UK evaluation module.

HDC1000EVM.jpg

Figure 1. HDC1000 Evaluation module

 

This small module is based on a USB<->I2C interface made using MSP430 MCU. It also contains a HDC1000 chip soldered to specially designed board that can be broken into three separate pieces so that you can use the same HDC1000 chip in your own test circuit. I think that this is really great because you don’t have to make a breakout board to test it in your circuit – it’s already provided.

 

This module can be used out-of-the-box by just connecting to a Windows PC USB port and running the Qt based sample GUI application. The sample application features nice interface for HDC1000 configuration and data acquisition and display. Temperature and humidity values are shown on two separate charts. Data sampling rate can also be easily changed using this GUI app.

gui.PNG

Figure 2. HDC1000 Windows GUI Application (Board was already broken so the app is not connected to it)


Under the hood, this application is using serial port to send and receive data. I couldn’t find source code or any additional details about this application so I did my own research. It turned out that the application sends very simple and short commands to the USB module. For example, sending ‘1’ over serial port will result in module sending back the temperature value in hexadecimal format, ‘2’ is used to request humidity. ‘3’ is used to request continuous updates with both temperature and humidity values and ‘4’ stops that. I didn't really have to inspect this but I was curious and it was fun .

It would be even better if this application was provided with source code so that it can be built for other OSs too.

 

The next step was to test the sensor without the USB motherboard. For this, I used the Bus Pirate 4.0 (nice little tool that can be used to test different devices).

I soldered the male headers to the broken board so that I can easily hook up the probes.

PSBmZhT.jpg

Figure 3. Bus Pirate 4.0 with HDC1000 broken off the evaluation module

 

 

HiZ>m                          <- Choose mode
…
(3)I2C
…
HiZ>3                          <- I2C
I2C>2                          <- Hardware version
I2C>1                          <- 100KHz
I2C>W                          <- Enable PSU
I2C>P                          <- Enable Pull-Up resistors
I2C>v                          <- Check voltage levels
I2C>(1)                        <- Scan I2C bus
Searching I2C address space. Found devices at:
0x80(0x40 W) 0x81(0x40 R)      <- This is HDC1000 with the address 0x40







 

So, our sensor is configured to use 0x40 address (0x80 write address and 0x81 read address). BTW, you can use Bus Pirate to convert value between binary, decimal and hexadecimal:

I2C>=0x40
0x40 = 64 = 0b01000000







Address can be changed by adding the 0R resistors (shorting pins). Check the datasheet for details, I’m fine with this address at the moment.

 

At this point I have the Bus Pirate set to send/receive over I2C.

According to datasheet, HDC1000 can be used to retrieve both temperature and humidity simultaneously or to retrieve them separately. I chose to acquire both simultaneously.

For that, you first have to configure the sensor by writing the configuration data into configuration register (0x02).

I chose to use 14bit precision for both temperature and humidity so I had to write 0x1000 to the configuration register.

I2C>[0x80 0x02 0x10 0x00







 

After the sensor is configured, you need to issue the measurement command by writing 0x00.

I2C>[0x80 0x00







 

After the data is ready you can read it (read 4 consecutive bytes from sensor). You can just give the sensor enough time to do the conversion or wait for DRDYn signal. Since I’m entering addresses and data manually, it gives the sensor more than enough time to prepare the data between commands.

I2C>[0x81 rrrr
I2C START BIT
WRITE: 0x81 ACK
READ: 0x62
READ: ACK 0x34
READ: ACK 0x8D
READ: ACK 0xE0







 

The first two bytes are for temperature and the bytes 3 and 4 are the humidity value.

 

Temperature in Celsius degrees is calculated like this:

(0x6234 / 0x10000) * 165 - 40 = (25140 / 65536) * 165 - 40 = 23.295°C

 

Humidity is calculated like this:

(0x8DE0 / 0x10000) * 100 = 55.4%

 

For my project, I will use the broken board as it is now. This way I will have a small sensor module that has a small thermal mass and can be placed away from the board and battery.

That's all for this update

 

Have a Happy New Year!

 

Dragan

Previous posts:

In the Air Design Challenge - Pollen & Allergen Sensing

In the Air Design Challenge - Pollen & Allergen Sensing – Post 1 (Pollen Sensor)

In the Air Design Challenge - Pollen & Allergen Sensing – Post 2

In the Air Design Challenge - Pollen & Allergen Sensing – Post 3 (AirVantage Intro)

In the Air Design Challenge - Pollen & Allergen Sensing – Post 4 (Preparing the InTheAir Power Board)

 

This time I will provide just a small update on the solar power PCB.

I will send it out for fabrication to WE Direkt in a couple of days. Based on the quote on Wuerth site, PCB should arrive in 9-10 days after I order them.

 

In the meantime, I made some design change. Since there are preset versions of TPS61200 I decided to use them for both 3.3V and 5V supply.

Please keep in mind that I'm not a professional so there may be some fundamental design faults. Comments and directions from professionals are more than welcome.

Here's my PCB design for the solar power board:

Screen Shot 2014-12-21 at 11.50.08 PM.png

 

Eagle files can be found in the attached .zip archive but I also created a BitBucket repository: https://bitbucket.org/tomaja/intheair-solar-power-board

Please note that I didn't set resistor values for BQ25504 voltage dividers (ROV, RUV and ROK) since these values depend on battery type and desired limits.

 

I will soon provide the link to cross-platform InTheAir client application source code - it's still not good enough to be published.

 

Thanks,

Dragan

Previous posts:

In the Air Design Challenge - Pollen & Allergen Sensing

In the Air Design Challenge - Pollen & Allergen Sensing – Post 1 (Pollen Sensor)

In the Air Design Challenge - Pollen & Allergen Sensing – Post 2

In the Air Design Challenge - Pollen & Allergen Sensing – Post 3 (AirVantage Intro)

 

Preparing the InTheAir Power Board

 

I’m having trouble with TI LaunchPads delivery but I have to make some advance here even without having them with me in order to complete the project on time.

First, I would like to say thanks to Christian Defeo for being very helpful and patient when it comes to shipping the material and resolving customs issues. Also, I would like to say thanks to .lukasz. who was kind enough to share his work on the solar Li-Ion battery charger based on TI’s BQ25504.

 

I chose to make a power supply board in form of a LP BoosterPack.

TI’s BoosterPack template was used to develop my own board that fits to Launchpads. This template can be obtained from the following page: Build Your Own BoosterPack for TI LaunchPad

For the actual PCB design I use Eagle PCB Design software provided by CadSoft - CadSoft EAGLE PCB Design Software - Circuit Board Design Software.

 

This PCB design will be my second real attempt in making a circuit design so I will have to be very careful. In my first attempt, I created a VFD clock based on MSP430G2553 and after my boards arrived back from manufacturer I realized that I made a couple of design errors. Luckily, those were small errors that I managed to resolve using a sharp knife and a small peace of wire

 

InTheAir Power Board will host:

  • Battery charger powered by a solar cell
  • 3.3V power supply
  • 5V power supply

 

Lukasz’s battery charger circuit is used as the basis for my booster pack. I removed the connectors used for resistor connections.

At the moment, my board hosts the charger based on BQ25504 from Texas Instruments. After I made the following picture I realised that Lukasz's connectors are not 2.54mm pitch so I will change them for 2.54 pitched ones (kindly provided by Würth Electronics: Serie 2109 - 2.54mm Horiz. Entry WR-TBL - Product Catalog Electromechanical Components).

 

Here’s the current state of my Booster Pack:

PowerBoard.png

 

EDIT: After I changed the connectors there's much more space left for other components:

Screen Shot 2014-12-07 at 10.46.12 PM.png

I followed some michaelwylie's advices on using vias to avoid making unwanted antennas.

 

For 3.3V supply, I will use TPS61291 Boost Converter.

For 5V supply, TPS61200 Boost Converter will be used.

Both components have very detailed data-sheets with example usage circuits. It will be fun to fit them on my board.

 

Eagle files will be uploaded as soon as I complete the design.

I’m sure more experienced guys will have some comments when I complete. I will wait a couple of days before I send it out for manufacture.

 

As for the soldering, I have a lot of experience there so I expect that will not be too much of a problem.

 

Dragan

Previous posts:

In the Air Design Challenge - Pollen & Allergen Sensing

In the Air Design Challenge - Pollen & Allergen Sensing – Post 1 (Pollen Sensor)

In the Air Design Challenge - Pollen & Allergen Sensing – Post 2

 

Since I spent a lot of time on trying to get notifications from AirVantage when new values are published from BBB (in my case just a Paho MQTT client) I decided to dedicate a short post to AirVantage topic.

 

Wrong approach

At first, I was trying to subscribe to a topic on AirVantage MQTT and receive messages whenever BBB publishes new sensor values. I tried with a couple of different test clients and a couple of topics but no success. I tried using MQTT wildcards (# and +) but still - nothing arrived from AirVantage.

I read some AirVantage docs and find out that I could use REST API to read published data but I was under impression that I should only use MQTT (for some strange reason )

After a few hours of failed attempts I posted a question (Subscription to AirVantage MQTT topic) and soon I got a couple of replies. Some of them were from dlahay who was kind enough to answer all my questions and soon I got my app working…

 

Correct approach

The correct way to use AirVantage is the following:

  • Use MQTT to publish new data messages like sensor readings (to topic<SERIAL>/messages/json) and subscribe to a topic (<SERIAL>/tasks/json) to receive commands and settings updates. Code sample written in C for publishing data is provided in my previous post. Check API documentation to see how commands can be sent to subscribed clients.
  • On the remote clients (like mobile phones and computers) use REST API to get published data. For example, you can get historical data for the last 3 months.

 

REST API is well documented and can be found here: https://na.airvantage.net/develop/apiDocumentation/apiDocumentation?page=API+-+System+v1.html

 

The first thing you have to do to start using REST API is to obtain a valid Access Token. There are three ways to get this token and they are described in documentation too.

  1. Resource owner for really trusted application
  2. Authorization code for server-side application
  3. Implicit for client-side application

 

I chose the first one because it’s the easy to implement and fits my needs.

 

It’s as simple as making a HTTPS request to:

https://na.airvantage.net/api/oauth/token?grant_type=password&username=YOUR@EMAIL.COM&password=YOURPA$$WORD&client_id=CLIENT_ID&client_secret=CLIENT_SECRET

 

Where:

  • YOUR@EMAIL.COM is the email you use to login to AirVantage
  • YOURPA$$WORD is your AirVantage password
  • CLIENT_ID is your API Client ID
  • CLIENT_SECRET is the API Client Secret

You obviously need to have an API Client in order to fill in these parameters. If you don’t have one, you need to create it: go to AirVantage management console and there navigate to Develop -> API Clients and then click Create (Name is the only mandatory parameter). After you create a client you will have your Client ID and corresponding Secret Key.

 

In response to the above HTTPS request you will receive a JSON string which, among other values like access rights and token type, contains your Access Token that you can use to perform REST API calls. This token is valid for 1 day (86399s to be exact).

 

One more thing! Many REST API calls take system UID as a parameter, at least those that I require for my application. You can get your system's UID by clicking on System name in the Systems table under Inventory. Make sure not to click the system's serial in that table like I did the first time I tried to get the UID - this will take you to the linked Gateway instead.

 

I hope this will save time to others who are new to AirVantage or MQTT like I am.

 

Cheers,

Dragan

Previous posts:

In the Air Design Challenge - Pollen & Allergen Sensing

In the Air Design Challenge - Pollen & Allergen Sensing – Post 1 (Pollen Sensor)

 

Introduction

Since I had problem with customs and still waiting for my kits (Christian is very helpful and hopefully we will sort it out soon) I decided to spend some time in preparing software part of my project, both BeagleBone Black and remote clients.

 

Development platform

In order to make one code base that will run on multiple platforms (desktop and mobile) I decided to use Qt | Cross-platform application & UI development framework. Qt framework is packed with features that make life easier for developers. I have some experience with Qt but not too much so this will also be a fun way to get more into the Qt framework and development tools.

As we got free AirVantage MQTT access, I decided to use the C version of open source Paho MQTT library (Paho - Open Source messaging for M2M). This library provides versions for use in many popular programming languages (Java, C/C++, Python, Go, JavaScript and C#). There’s also a version called C(Embedded) suitable for microcontrollers if you plan to publish data from a LaunchPad or if you plan to send some commands directly to it (via subscription).

Additionally, I chose to use the AnalogWidgets library for Qt (nice gauges design in my opinion).

87780-1.png

This library provides some nice gauges that can easily be customized for my project. I will use it for both apps (clients and BBB dashboard).

 

BeagleBone Black

BeagleBone Black will serve as a central house unit that’s responsible for communication with AirVantage cloud service and on the other side for communication with CC3200 LaunchPad. It will also serve as a system dashboard – I ordered a 4.3” resistive touchscreen for BeagleBone Black to be used for that role. There are tutorials and even YouTube videos on Qt development for BeagleBone black so I will just provide some links:

Project specific code is the part that’s in charge of MQTT publishing and here’s how it looks like. It’s pretty much out-of-the-box example with a small addition to connection options – username and password must be provided for AirVantage. Additionaly QoS parameter had to be set to 0 for data to be published successfully.

 

Code:

#define ADDRESS  "tcp://na.airvantage.net:1883"
#define CLIENTID  "BBB_Client"
#define TOPIC  "123456789/messages/json"
#define TOPICSUB  "123456789/tasks/json"
#define PAYLOAD  "{\"machine.temperature\":39.2, \"machine.humidity\":86, \"machine.pollen\":3 }"
#define QOS  0#define TIMEOUT  10000L

QTTClient client;
MQTTClient_connectOptions conn_opts = MQTTClient_connectOptions_initializer;
MQTTClient_message pubmsg = MQTTClient_message_initializer;
MQTTClient_deliveryToken token;
int rc;

MQTTClient_create(&client, ADDRESS, CLIENTID, MQTTCLIENT_PERSISTENCE_NONE, NULL);

conn_opts.keepAliveInterval = 20;
conn_opts.cleansession = 1;
conn_opts.username = "123456789";
conn_opts.password = "supersecret";
if ((rc = MQTTClient_connect(client, &conn_opts)) != MQTTCLIENT_SUCCESS)
{
      printf("Failed to connect, return code %d\n", rc);
}

pubmsg.payload = (void*)PAYLOAD;
pubmsg.payloadlen = strlen(PAYLOAD);
pubmsg.qos = QOS;
pubmsg.retained = 0;

MQTTClient_publishMessage(client, TOPIC, &pubmsg, &token);
printf("Waiting for up to %d seconds for publication of %s\n on topic %s for client with ClientID: %s\n", (int)(TIMEOUT/1000), PAYLOAD, TOPIC, CLIENTID);

rc = MQTTClient_waitForCompletion(client, token, TIMEOUT);
printf("Message with delivery token %d delivered\n", token);

MQTTClient_disconnect(client, 10000);
MQTTClient_destroy(&client);


I plan to add the history charts to the dashboard but I still didn’t manage to get the historical data back from AirVantage. There seems to be a REST API for getting raw historical data (https://na.airvantage.net/develop/apiDocumentation/apiDocumentation?page=API+-+System+v1.html) but I didn’t find anything like it in AirVantage MQTT Docs.

I’m not sure if this is even possible with MQTT.

UPDATE: No, it's not. We have to use the REST API to get historical data. Please read the following post for more details: In the Air Design Challenge - Pollen & Allergen Sensing – Post 3 (AirVantage Intro)

 

Optionally, depending on sensor inputs or AirVantage commands, BeagleBone Black should also control actuators (if I get enough time for it). I’m not sure I will fit this task into given timeframe, might be done later.

 

Remote clients (desktop and mobile)

As I said, Qt will also be used for remote clients, both mobile and desktop. It will also be able to show readings history when I sort out how to get it from AirVantage using MQTT.

Additionally, I will support direct actuators control once I get to the point that I can add them - not necessary in the given timeframe.

I’ve come up with an initial application design that runs on Desktop(Windows, Linux and Mac), and mobile (Android, iPhone and BlackBerry) but still not good enough to be presented here so give me a week or two for screenshots.

Previous posts:

In the Air Design Challenge - Pollen & Allergen Sensing

 

ragweed-pollen-ambrosia-psilostachya-99537c.jpg

Figure 1. Bad guy (Ambrosia pollen grain)

 

As I’m still waiting for my challenge kit I’m using the time to consider pollen sensing since that might be the weakest point of my project.

 

Possibilities

At this moment I have two alternatives for pollen sensor: Homemade and commercial one.

Using commercial one would make my project much easier and the focus would be on making some nice apps for desktop and mobile but with homemade sensor most efforts would be on making the sensor do its thing...

 

1) Homemade pollen sensor

As my plan is to detect pollen, I did some research and discovered a paper on pollen sensing that proposes an idea which seems feasible (Shigeto Kawashima et al. - An algorithm and a device for counting airborne pollen automatically using laser optics).

This task would require very much hard work and could easily turn out to be a failure but I can still try. Some optics would be required - hopefully I will be able to obtain all the necessary parts to build the prototype.

Screen Shot 2014-11-03 at 11.35.55 PM.png

Figure 2. Pollen sensor

 

Authors propose that red laser should be used but I think that maybe green or yellow laser would be more appropriate because pollen colour is usually the same (i.e. it reflects green or yellow). I bought the green (532nm) one locally to be used for this purpose.

In order to observe the photodiode sensor signals an oscilloscope is required so I decided to order one that fits in the budget (PicoScope 2204A). It arrived in just two days(!) and as I last used the oscilloscope ~15 years ago (at university) I spend some time testing it – It turned out it’s like riding a bike

 

2) Commercial sensor

Now some bad news regarding the commercial pollen sensor… The one that I found (http://www.shinyei.co.jp/stc/optical/poln/main_poln_e.html) is not suitable for my location.

It only detects Japanese Cedar and Cypress but these pollen particles are bigger than those of Ragweed (which is the most common allergen in this part of Europe). This is not completely bad news as someone in Japan might find this project useful even with this sensor but for me that's probably not good enough.

Ragweed pollen presence in Europe:

AMBR_08_2.png

Figure 3. Ragweed pollen presence in Europe (August 2014)

 

Conclusion

In short, I will most probably focus my work on homemade pollen detection.

 

 

I will update as soon as my challenge kit arrives (at this moment it’s being held at the local customs)

Comments and suggestions are always welcome.

 

Dragan

Hi, everyone!

 

This is my first Element14 design challenge - and hopefully not the last one.

First, I have to say thanks to all the sponsors and Element14 for giving me the opportunity to take part in "In the Air" design challenge!

 

Since I'm a new guy here, allow me to introduce myself

I am a software developer with a lifetime passion for electronics (I hope that this will be enough for me to come up with a sufficiently good design in February).

RC flying is my other passion that I discovered recently.

 

My plan for this challenge is to come up with a simple enough solution for allergen detection. I suffer from allergies caused by a couple of different allergens, pollen is one of them - so my choice for this challenge was natural. Sensing pollen will probably be the most difficult part of this project, since I have no experience with such sensors but I expect to learn a lot.

 

This is the initial design for Pollen and Allergen Sensing project:

in_the_air.png

I will first try to make all this work using evaluation boards and then try to make it compact by designing a single battery powered device connected to home wireless network.

 

Feel free to share your thoughts and observations.

 

Dragan