Skip navigation
1 2 Previous Next

In the Air Design Challenge

18 Posts authored by: ipv1 Top Member

Introduction

 

Air pollution has taken a toll on everything around us and we seldom realize how our action effect the environment. This project was aimed to create a system of wireless, self-sustained sensors that can monitor air quality out doors and in doors. The initial plan was to create a solar harvesting system that would power the node and it could connect to a gateway device that would intern send data from multiple nodes to the Sierra Air Vantage Cloud. More nodes could be added as per requirement. A secondary standalone unit was also proposed that could be used as an indoor sensor node and could provide indoor air quality information via the Air Vantage Cloud service. The sponsors Element14, Texas Instruments, Wurth Electronics, Eclipse IoT and Sierra Wireless provided support along the way. A diagram of the proposed system is given below.

diag1.jpg

 

 

Work Plan

The entire project was done in phases since it had some hardware and software components. On the hardware side, TI had proposed some components such as BQ25504, HDC1000, TPS62740 and TPS61200 to name a few for use in the design. The entire system was divided into submodules as explained in the proceeding sections. Additionally, I created some tutorial like posts which I will index in one of the proceeding sub-sections.

 

A list of submodules is as follows

 

  1. Energy Harvester Module based on the TI BQ25504 and a SuperCap
  2. Energy Efficient Wireless Sensor Node based on the TI CC110L and FR5969
  3. Gateway device Based on the BeagleBone Black
  4. Standalone Sensor Node based on the TI CC3200
  5. Connectivity with the Sierra Air Vantage cloud Service.

Not all modules are finished but there are lessons learned which will influence future work.

 

Additionally it took me a lot of time to research sensors as many sensors in the market are NOT suitable for outdoor usage as per manufacturer recommendations.

 

Energy Harvester Module based on the TI BQ25504 and a SuperCap

 

One of the requirements of the Design Challenge was that the sensor nodes should require least bit of human intervention. Additionally, we were instructed to use certain parts such as the BQ25504 which is a energy Harvesting IC and hence a module was designed around it and TPS62740 and TPS61200 which are voltage regulators. The deviation from conventional design was to use a SuperCap instead of a battery and use the energy efficient MSP430FR5969. Hence I designed a circuit using Eagle CAD, got the passives from Wurth Electronics, Element14 and chips from TI as samples. Some parts arrived around two weeks from the dealline leaving very limited room for testing. Additionally the BQ25504 was so small that soldering it was a challenge but completed successfully. The result is shown in the image below.

 

420dc2a1525503d9313ebf58be008cbb.jpg

 

It works to some extent but I had some minor issues as shown in the video below.

 

I want to assemble some more boards and experiment before I move on and that will take some time mainly because I have run out of chips and will request TI to supply some more. I am sure I can get it to work and will update once I do.

 

This module is hence parly complete due to lack of time and timely delivery of some passives.

 

Energy Efficient Wireless Sensor Node based on the TI CC110L and FR5969

 

This part is quite simple and is mainly a software segment. I used the FR5969 Launchpad along with Air Booster Packs to fabricate a wireless sensor node. With my unsuccessful attempt at making the Energy Harvester, I moved to use the TI Fuel Booster Pack and connected a solar panel to it. The code was written entirely in Energia which makes prototyping quick. There was a requirement that the system should "Sleep" when not transmitting. For this LPM3 was used along with a timer and interrupts to make sleepy delays possible making the node more energy efficient.

 

 

A potentiometer is used in place of a sensor. As a bonus, I used the TI HDC1000 and soldered on by hand. The result is as follows.

IMG_20150119_225845.jpg

 

 

I got it to work using a buspirate but since I have to use softI2C on the FR5969 there is still a bit of debugging to be done. Just a matter of time.

 

This module is complete with the absence of sensors which have yet to arrive. I hope the sensor module comes through as I would like to finish this project in the future.

 

Gateway device Based on the BeagleBone Black

 

A BeagleBone Black gateway is used to send data to the AirVantage Cloud for logging. I was able to put together a custom setup with a NodeJS script to connect to the AirVantage Cloud and I wrote a tutorial in the process so that it may be useful to people in the future. Additionally, I made an Additional launchpad a wireless receiver based on the CC110L and it captures all the information from wireless node and funnels it to the BBB via USART. This data is conditioned and sent via Javascript(NodeJS) to the cloud service. The image of the setup is given below.

 

IMG_9565.jpg

 

 

This module is also complete to the original intention.

 

Standalone Sensor Node based on the TI CC3200

 

One of the targets was to have a standalone Wireless Node which did not require a gateway. This is useful where only a single node is required or nodes spaced far apart are required. I used the CC3200 LP to accomplish this along with a Fuel Booster Pack. Again since the sensors are not yet available, a demo system was constructed. The code was written in Code Composer Studio and the system can talk to the cloud via MQTT. Since this node is designed to be an indoor unit, the charging can be done manually. In this case, it happens via Wireless Charging using the Wurth Electronics Wireless Power Design Kit(which I got in a previous Design Challenge. The result is shown in the following images

e878796280cd2f1af36e354eb9992aaa.jpg

315798cdc3cc984636f09014db1ef6f7.jpg

 

 

The basic system is working but I am using the onboard temperature sensor and logging the Fuel Tank values of Time to Empty and Time to full via MQTT. The base is ready and working.

 

Connectivity with the Sierra Air Vantage cloud Service

 

I managed to connect to the Air Vantage Cloud via MQTT and wrote a little bit about it. There is not much to it, but I hope my writing helps other in the future.

 

Conclusion and Future Work

Lots needs to be done at this point since I blew up some parts and got the circuit working a bit too later. Time was a crunch factor and I have learned a few lessons on project management. I will be continuing this project at my pace post challenge deadline since I want to have a project like this added to my porfolio. I am waiting for sensors to arrive and will be requesting TI for more samples. The harvester will also get an upgrade from it's current 0.1Farad SuperCap to something bigger. Every component needs a better enclosure and I hope to have some more PCBs in the future which have sensor circuits on them.

 

Additionally, I am studying Eclipse KURA as a gateway platform but I am not using it until I understand it a bit better. I am an EEE engineer and so my Java skills are a bit limited.

 

At the time of posting this Summary, I am working on more tutorials as I work.

 

Tutorials and Other Posts

 

My posts for the duration of the challenge are as follows:

 

Work progress and Design Posts

[Firecracker Analyser] [week 0] Project Description

[FireCracker Analyzer]: Index

[Firecracker Analyser] [week 0] Sensor Research

[Firecracker Analyzer] [week 1] System Design and ReDesign

[Firecracker Analyzer]Brief update

[Firecracker Analyzer] Another small update

 

Tutorial on LCD

[Firecracker Analyzer] Messing with an I2C LCD and using the BUS PIRATE

 

Posts on the Energy Harvester

[Firecracker Analyzer] Making the Power PCB with Eagle, TI BQ25504, TPS62740 and TPS61200

Bus pirate meets the HDC1000 Texas Instruments

Assembly intro to the Solar Harvesting Board

[Firecracker Analyzer] Hot air assembly of TI Solar Harvester

[Firecracker Analyzer] Successful QFN Assembly

[Firecracker Analyzer] Testing the Texas Instruments BQ25504 - Success?

Energy Harvester prototype Demo based on the TI BQ25504

 

Posts on the HDC 1000

[Firecracker Analyzer] Testing the HDC1000 on my Own board

Bus pirate meets the HDC1000 Texas Instruments

 

Tutorial on the CC3200

[Firecracker Analyzer] (Another) Guide to getting started with the CC3200

 

Tutorial on using the Air Vantage Cloud and NodeJS

[Firecracker Analyzer] Obligatory Guide - Using Sierra Air Vantage with your Device

 

Posts on the Launchpads and CC110L Based Wireless sensor System

Demo of working CC110L Modules with different Launchpads

[Firecracker Analyzer] Creating a Wireless Sensor Node using TI's stuff.

 

Acknowledgements

 

I would like to thank Element14, Wurth Electronics, Texas Instruments, EclipseIoT, Sierra Wireless and all the sponsors for their support and this opportunity. Special Thanks to Dr. Christian DeFeo Sir, Shabaz Sir(Cisco), Benjanine Cabe(Eclipse IoT), Crystal Lam(Sierra Wireless), Simon Leuz(TI), Peter Oakes for their support and amazing content on the forums. Very Special Thanks to all the community members for their support because without it, I would have dropped this project in a dark day.

 

Hope to produce more useful content in the future.

 

Cheers,

IP.

Prelude

 

In my last post here ([Firecracker Analyzer] Creating a Wireless Sensor Node using TI's stuff.) I built up a wireless sensor node using the Anaren Air Booster Pack. They are cheap and I think I will be using these quite a lot in future projects. I wanted to use my solar harvester to power the FR5969 board but have run into issues with the boards I made and don't have any more BQ25504s to experiment with hence it has come to a halt. Instead I am now using the Fuel Booster Pack with some minor surgery to be charged by solar panels. In this post I have two things to explain.

1. To finish the code on the Wireless Node for the FR5969 and give it to you for further modification

2. Modifying the Fuel Booster Pack for Solar Power

Lets get started

 

Making the Wireless Node

Recap

 

15 - 1.jpg

I have the two launchpads setup as follows:

1. Wireless Node with the FR5969 Launchpad and Fuel Booster Pack and the Air Booster Pack

2. Station Node with the F5529LP with the Air Booster Pack

Lets start with some code.

 

Wireless Base Station Code

 

The base station code is the same as from the Energia Examples. For Demo purposes, the serial stream is connected to the USB emulated port and ot the PC. I will make one modification that will allow me to send this data to the Pins on the Board itself and then I will connect this to the Beagle Bone Black which is my gateway. The code is as follows:

 

/**
*  ----------------------------------------------------------------------------
*  WirelessMonitorHub.ino - wireless monitor hub sketch using AIR430Boost ETSI driver.
*  Copyright (C) 2012-2013 Anaren Microwave, Inc.
*
*  This library is free software; you can redistribute it and/or
*  modify it under the terms of the GNU Lesser General Public
*  License as published by the Free Software Foundation; either
*  version 2.1 of the License, or (at your option) any later version.
*
*  This library is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
*  Lesser General Public License for more details.
*
*  You should have received a copy of the GNU Lesser General Public
*  License along with this library; if not, write to the Free Software
*  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*  This example demonstrates usage of the AIR430BoostETSI library which uses
*  the 430Boost-CC110L AIR Module BoosterPack created by Anaren Microwave, Inc.
*  and available through the TI eStore, for the European Union.
*
*  ----------------------------------------------------------------------------
*
*  Note: This file is part of AIR430Boost.
*
*  ----------------------------------------------------------------------------
*
*  Description
*  ===========
*
*  Acts as a simple receiver for a star network. The hub node can receive both
*  broadcast messages and messages directed to its assigned address. The hub
*  node should not be assigned to address 0 (broadcast address). To create an
*  additional network, simply change the hub address.
*
*  ----------------------------------------------------------------------------
*
*  This example assumes that two BoosterPacks will be used to showcase the
*  wireless radio communication functionality. This same code should be
*  programmed to both LaunchPad development kits.
*
*  This BoosterPack relies on the SPI hardware peripheral and two additional
*  GPIO lines for SPI chip-select and GDO0 for packet handling. They use pins 18
*  and 19 respectively.
*
*  In the default configuration, this BoosterPack is not compatible with an
*  external crystal oscillator. This can be changed, if necessary, and would
*  require reconfiguration of the BoosterPack hardware and changes to the
*  AIR430BoostETSI library. Refer to the BoosterPack User's Manual if necessary.
*
*  ETSI regulations must be followed when using this library. This example
*  limits the wireless duty cycle to 0.1% per ETSI.
*
*  For complete information, please refer to the BoosterPack User's Manual
*  available at:
*  https://www.anaren.com/air/cc110l-air-module-boosterpack-embedded-antenna-module-anaren
*
*  To purchase the 430Boost-CC110L AIR module BoosterPack kit, please visit the
*  TI eStore at:
*  https://estore.ti.com/430BOOST-CC110L-CC110L-RF-Module-BoosterPack-P2734.aspx
*/


/**
*  The AIR430BoostETSI library uses the SPI library internally. Energia does not
*  copy the library to the output folder unless it is referenced here. The order
*  of includes is also important due to this fact.
*/
#include <SPI.h>
#include <AIR430BoostETSI.h>


// -----------------------------------------------------------------------------
/**
*  Defines, enumerations, and structure definitions
*/


#define ADDRESS_LOCAL    0x01


/**
*  sPacket - packet format.
*/
struct sPacket
{
  uint8_t from;          // Local node address that message originated from
  uint8_t message[59];    // Local node message [MAX. 59 bytes]
};


// -----------------------------------------------------------------------------
/**
*  Global data
*/


struct sPacket rxPacket;


// -----------------------------------------------------------------------------
// Main example


void setup()
{
  // The radio library uses the SPI library internally, this call initializes
  // SPI/CSn and GDO0 lines. Also setup initial address, channel, and TX power.
  Radio.begin(ADDRESS_LOCAL, CHANNEL_1, POWER_MAX);


  rxPacket.from = 0;
  memset(rxPacket.message, 0, sizeof(rxPacket.message));


  // Setup serial for debug printing.
  Serial.begin(9600);


  /**
  *  Setup LED for example demonstration purposes.
  *
  *  Note: Set radio first to ensure that GDO2 line isn't being driven by the
  *  MCU as it is an output from the radio.
  */
  pinMode(RED_LED, OUTPUT);      // Use red LED to display message reception
  digitalWrite(RED_LED, LOW);
}


void loop()
{
  // Turn on the receiver and listen for incoming data. Timeout after 1 seconds.
  // The receiverOn() method returns the number of bytes copied to rxData.
  if (Radio.receiverOn((unsigned char*)&rxPacket, sizeof(rxPacket), 1000) > 0)
  {
    digitalWrite(RED_LED, HIGH);
    Serial.print("FROM: ");
    Serial.print(rxPacket.from);
    Serial.print(" MSG: ");
    Serial.println((char*)rxPacket.message);
  digitalWrite(RED_LED, LOW);
  }


  // Note: This sketch never transmits so no additional delay required to meet ETSI
  // requirements.
}





























 

In the above code, instead of Serial, we will use Serial1 which will cause the data to be sent over USART1 which is the Pins on the LP. Thats it! The LED will blink every-time data is received allowing us to debug.

 

Wireless Node

 

The code for the wireless node is also very simple, but is a bit tricky since the FR5969 shares PINs when it comes to the I2C and SPI. My problem is that I have the sensors and Fuel Booster Pack talking over the I2C and the CC110L talking over the SPI bus which causes a conflict. The solution is to have a soft I2C which I can just bit bang. I got a library from the 430oh forums but faced some issues with it. The second problem is that the Fuel Booster Pack has the I2C pins on the wrong side hence I need to do a little modificaion as follows.

Fuel Tank Modification

 

Below are some images of the modifications I made to the Fuel Tank.

514d4cbbc03b5bec25e790c51907d6ab.jpg

 

 

2219f0c17389090367d64e2cbacf9e07.jpg

d76a685b049ef8d98dadeeed21ff5ab3.jpg

2438ac319b70cc53c4b1acf375bbeba6.jpg

As you can see, the I2C lines traces are cut on the PCB and then wires are used to reconnect them to the appropriate pins. Additionally I soldered some wires for the Solar Panel from the GND and Charge In test points. Simple.

 

Node Code

 

Before I give you the code, I will explain a few things about it. The base code is the same as the demo code from energia. I added a soft Serial Library but faced some problems while using it. I also added some code to add my data to the packet which will be sent across.

One major change here is that I have a sleep function that allows me to take the FR5969 into LPM3 which means the timer is active and everything else is shutdown. The function was taken from the forums as well and modified a bit to work with the FR5969

Here is the code.

 

/*
* Description: This file is part of the Air Quality Sensor Project. Parts of the
* code have been forked from the Demo code for the ANaren Booster Packs.
*
* --
* Copyright (C) 2014 Inderpreet Singh(er.inderpreet@gmail.com),
  Thought Process Designs
* Web      :  http://google.com/+InderpreetSingh
*      http://embeddedcode.wordpress.com
*
* This software may be distributed and modified under the terms of the GNU
* General Public License version 2 (GPL2) as published by the Free Software
* Foundation and appearing in the file LICENSE.TXT included in the packaging of
* this file. Please note that GPL2 Section 2[b] requires that all works based
* on this software must also be made publicly available under the terms of
* the GPL2 ("Copyleft").
*
* We put a lot of time and effort into our project and hence this copyright
* notice ensures that people contribute as well as each contribution is
* acknowledged. Please retain this original notice and if you make changes
* please document them below along with your details.
*
* The latest copy of this project/library can be found at:
* https://github.com/inderpreet/
*
*/
// ----------------------------------------------------------------------------
#include <SPI.h>
#include <AIR430BoostETSI.h>
#include <I2C_SoftwareLibrary.h>
#define SCL_PIN P3_5
#define SDA_PIN P3_6


// -----------------------------------------------------------------------------
/**
*  Defines, enumerations, and structure definitions
*/


#define ADDRESS_LOCAL    0x02
#define ADDRESS_REMOTE  0x01


/**
*  sPacket - packet format.
*/
struct sPacket
{
  uint8_t from;          // Local node address that message originated from
  uint8_t message[59];    // Local node message [MAX. 59 bytes]
};


volatile unsigned long delaycounter;


void StartTimer()
{
    //To use the VLO, Use the following:


    //BCSCTL &= ~DIVA_3;      // ACLK without divider - nominally 12kHz
    //BCSCTL3 = (LFXT1S_2);    // Source ACLK from VLO
    TA1CCTL0 = CCIE;        //  CCR0 interupt activated
    TA1CCR0=11999;          // 12000 ticks is nominally 1 second
    TA1CTL = TASSEL_1 | ID_0 | MC_1; // Clock for TIMER = ACLK, No division, up mode


  //Alternatively to use the Crystal for more accuracy use the Following
/*
    P2SEL |= (BIT6 | BIT7); // Reset P2_6 & P2_7
    BCSCTL1 &= ~DIVA_3;    // ACLK without divider - 32768kHz
    BCSCTL3 = (LFXT1S_0 | XCAP_3);// Source ACLK from XTal
    TA1CCTL0 = CCIE;            //  CCR0 interupt activated
    TA1CCR0=4096-1;      // we are dividing clock by 8, so 4096 ticks = 1 second
    TA1CTL = TASSEL_1 | ID_3 | MC_1; // Clock for TIMER = ACLK, By 8 division, up mode
*/


}
void StopTimer()
{
  TA1CTL|=TACLR;
}


//Set Up the Interrupt routine...
__attribute__((interrupt(TIMER1_A0_VECTOR)))
void timer_isr (void)
{
        ++delaycounter;        //increment our seconds counter
        __bic_status_register_on_exit(LPM3_bits); //exit at full power.
}


//And here is our delay function...
//this will create delays of up to approx 136 years
//with 1 second resolution.
void longdelay(unsigned long delayseconds)
{
  delaycounter=0;
  StartTimer();                    //start our timer up
  while (delaycounter<delayseconds)  //while we haven't reached our count...
    __bis_status_register(LPM3_bits+GIE); //switch back to LPM3.
  StopTimer();                      //times up, stop our timers.
};


// -----------------------------------------------------------------------------
/**
*  Global data
*/


struct sPacket txPacket;
SoftwareWire Wire(SDA_PIN, SCL_PIN);


void confHDC1000(void){
  Wire.beginTransmission(0x43);
  Wire.write(byte(0x02));
  Wire.write(byte(0x1e));
  Wire.write(byte(0x00));
  Wire.endTransmission(true);
}


void readTemp(void){
  Wire.beginTransmission(0x43);
  Wire.write(byte(0x00));
  Wire.endTransmission(false);
  delay(500);
  Wire.requestFrom(0x43, 4);
  while(Wire.available()){
    char c=Wire.read();
    Serial.print(c, HEX);
  }
}


// -----------------------------------------------------------------------------
// Main App Code


void setup()
{
  // The radio library uses the SPI library internally, this call initializes
  // SPI/CSn and GDO0 lines. Also setup initial address, channel, and TX power.
  Radio.begin(ADDRESS_LOCAL, CHANNEL_1, POWER_MAX);


  txPacket.from = ADDRESS_LOCAL;
  memset(txPacket.message, 0, sizeof(txPacket.message));


  // Setup serial for debug printing.
  Serial.begin(9600);


  /**
  *  Setup LED for example demonstration purposes.
  *
  *  Note: Set radio first to ensure that GDO2 line isn't being driven by the
  *  MCU as it is an output from the radio.
  */
  pinMode(RED_LED, OUTPUT);      // Use red LED to display message reception
  digitalWrite(RED_LED, LOW);
  Wire.begin();
  confHDC1000();
}


void loop()
{
  int i;
  int temperature, humidity, dust;
  //readTemp();
  temperature=17;
  humidity=23;
  dust=25;
  digitalWrite(RED_LED, HIGH);
  // Carpet bom with zeros
  for (i = 0; i <= 0x2A; i++)
  {
    txPacket.message[i] = 0x00;
  }
  // Fill In packet Data Here
  /* TO-DO
  Need to get sensor data and fill it here
  */
  sprintf((char*)txPacket.message, ":T%dCH%d\%D%d#", temperature, humidity, dust);
  // Transmit Data Here
  Radio.transmit(ADDRESS_REMOTE, (unsigned char*)&txPacket, sizeof(txPacket));
  digitalWrite(RED_LED, LOW);
  longdelay(10);
}









 

The node will essentially read sensors, create a packet, send the data and go to sleep. The original author says we can make it sleep for a LONG time so feel free to experiment with it and let me know how that goes. The library is attached at the bottom.

 

ScreenShot

Here is the screenshot of the console. Not very interesting but this is what is received by the base station...

ea29a6b31fc0df43c305c133a840cd1b.jpg

It can be seen that temperature, humidity and dust values arrive in ascii format. This is useful for debugging and we can use javascript to extract what we want easily. Our gateway is running NodeJS as shown in my blog post

[Firecracker Analyzer] Obligatory Guide - Using Sierra Air Vantage with your Device

and we will use some JS to do the rest.

 

At this point, our Node and Base station is ready. I don't have the sensors but its a simple matter of either I2C reading or analog reading which can be done according to the sensor selected

 

 

I hope this helps anyone wanted to make a wireless sensor node in the future. In my next post, I will connect it the the BBB vs JS and then allow the data to be sent to Sierra wireless.

 

Cheers

IP

All Previous Posts

http://www.element14.com/community/tags#/?tags=iot_firecracker&ICID=intheair-15grid

 

Prelude

I had initially planned to make an evergy harvester circuit around the BQ25504 which was one of the parts from Texas Instruments for this challenge. I managed to assemble one board partially since the size was so small that I managed to destroy three chips before getting one to work. Once I got it to work, I posted some information about my results. Related posts are

In this post I present a video demo of the circuit.

 

The Video

THe first thing is to present the working circuit with the issues I am facing.

The thing that I did not mentioned in this video is that the Cap charges to 3.8V or so which may be one reason for the output being disabled.

 

Next step

 

I have put this circuit on the back burner and wanna request for more samples of the BQ25504 to assemble more boards and compare them. Right now I am stumped! I will be copmpleting the rest of the build using TI's Fuel Tank booster packs but will come back to this once I have more boards built up.

 

 

Cheers

IP


My Question to TI

Does the VSTOR Pin provide output voltage in the absence of the VIN BUT in the presence of a Storage element.? NOT!

 

Introduction

I finally got around to testing the BQ25504 and it was not what I expected but I am stupid so its all good.. I assembled the required circuitry and connected my solar panel and super cap and expected the output to be reasonably 5V. Unfortunately it was not. I am going to do a flashback on what I designed and then a little on what I got.

 

Flashback

I started with a schematic in Eagle that looks like this...

Image.png

I did an entire post on the matter at [Firecracker Analyzer] Making the Power PCB with Eagle, TI BQ25504, TPS62740 and TPS61200 In this instance, I only mounted the BQ25504 part for testing and instead of connecting a battery, I connected a 0.1F(not uF) capacitor as my storage element.

 

The results

The solar panel can produce voltages around 2volts in low light and up to 5volts in direct sunlight. For test purposes, I connected it to my bench power supply and set it to 1.9Volts. The boost converter came alive and punched out 3.7Volts at the output and the capacitor began to charge. I connected a Tektronix Scope to the output and it was captured as follows.

TEK0015.JPG

It is seen that the capacitor charges to 3.96Volts and then the output steadies. Once I switch off the power, the output ramps down. Good right? Wrong. This waveform is for the output voltage and without any load other than the Scope. This means the output will be valid only until there is an input from the solar panel. The vstor output is used to drive things when there is solar panel input and if it goes down, it will NOT connect it to the storage element.

 

Furthermore, when I switch on the Vin, the output jumps up directly to 3.96Volts which means my Cap is already fully charged. The capacitor is rated at 5.5V and the voltage to the terminals is 4.08V and keeps steady even after I have switched off my supply or solar panel. Hence what I am SUPPOSED to do is to use the battery/capacitor directly. I can then use my buck and boost converters to create the voltages I like. Fancy that!. I have the buck converter already connected to the VBAT so my 3.3V should be painless.

 

The boost converter is however connected via the VSTOR which means it will provide stable 5V only when there is a solar pannel power generation. I may be doing something wrong here but this is what I have got!

IMG_9549.jpg

IMG_9556.jpg

 

Next steps.

I need to mount the buck converter to create the 3.3V for the launchpad and cut traces on the boost converter. I am going to assemble the boost converter on a seperate PCB and connect them together. Fingers crossed!

Not a very complicated post just a few pics of the assembly.

1b824788fcbf19d45967c497d05217b1.jpg

I use some flux and copper wire strands and used it to sweep the extra solder out... The above is the result and I check with the DMM to see if any pins were bridged. They weren't .

6453f6db76d69dfd1aeabd7a3bfeb3c3.jpg

I then moved on to solder the rest of the parts and...

IMG_9547.jpg

Viola! All I need to do is mount the coil and connect the inputs and outputs. This should be fun...

Introduction

 

In my previous posts here and here, I made a small circuit with the prescribed parts from Texas Instruments and made a PCB for it. I recently received the passives and went on the assemble the board. This is the story of how I failed!

 

Setting things up

 

I started very enthusiastically and the video below is me setting up for the assembly...

 

Results

 

No I did not make a video. I tried assembly of three boards and failed when it came to the QFN BQ25504. One of my boards is shown in the image below.

 

5a5d1108e5cf073adfa4de8f3f78d654.jpg

There is obvious excessive solder paste on this one...

 

 

5c99e5cd55c16d8c314b49a67e2ec8da.jpg

Board Assembled partly.

 

The basic problem I faced was the repeated bridging of pins on the QFN. I tried varying the quantity of solder paste but the pitch is so fine that it almost always failed. I tried it on three different boards and the problem is the same. My solder paste is a bit old but I use just enough flux to make it creamy but since my hot air station has no temperature indicator, I am flying blind. The air control is tweaked to a minimum but still the parts get blown here and there.

 

Lessons learned

 

Here is a list of lesson s learned for now so I don't forget.

1. Get extra samples! - I requested just enough samples and that means I will only be able experiment so much.

2. Just enough solder paste. If the paste is more then pins will bridge and paste should only be applied to the pads. Clean up the extra since it may bubble up and move the parts.

3. Have a temperature reading on the hot air station. Unless you are really practiced, you need to control the temperature of the hot air.

4. Practice practice practice. I am going to take apart every smd circuit I have in my scrap bin and practice before I jump back.

5. Build a Reflow Oven. Ben-Heck has some tutorials on making a reflow oven and I think that will make one in the near future.

 

 

Status

I am short of silicons and with the deadline this coming week, I will tread carefully. Lucky for me I made jumpers so I can make the three sections separately and join them together. Finger crossed...

 

Update 1

 

I got some new solder paste from a friend and it has a lot less flux in it. Used that and the QFNs seem to get soldered pretty well. After a few tries, the bridging stopped happening. Just reduced the amount of solder and it worked. Unfortunately, I am out of BQ25507s so I am putting up another request to TI. It will take a while but I will get it working in the long run.

Introduction

 

The objective of this post to completely describe the creation of a wireless sensor node which can be used for IoT Applications. Texas Instruments was kind enough to sponsor the parts for this build hence the entire demo is TI BOM. Additionally, the code used is also available free of cost via github.com . Lately security has become a concern for IoT in addition to the cost of the components involved and their maintenance is also an issue. If you are planing a system with lots of nodes to be deployed in an existing system or environment or if you plan to have a temporary system with sensor nodes to be deployed, wireless self powered systems are the optimum solution. The issue in making these solutions is where to start. Such a requirement pops up frequently for me where I want to deploy a sensor in a location where I cannot establish a cable connection or if I am prototyping a system where I need to monitor a quantity in real-time and log it remotely(for comparison with other such nodes). My original solution was based on XBEE's which transmit to a central BeagleBoneBlack however this becomes less and less cost effective when the deployment quantity increases. Hence I have turned to experimenting with other solutions out of which one is using the CC110L radio Chip from TI. There are cheaper basic RF Tx Rx modules available out there but they are dumb modules and cannot provide any information about the connection state nor any intelligent control over the transmitter. For this exercise I work with Anaren Modules LR09A which are part of the TI Air Booster Pack and are available relatively cheap from Element14. I will go into the details of the steps I follow to design my little wireless network. Lets go!

 

Topology and CC110L Dissection

 

One of the things that XBEEs offer is the ability to form networks where a co-ordinator xbee can act like a hub and the nodes can be used to form a mesh network. This ability is great for deployments where the network will span large distances and the gateway or controller is at one end of the installation e.g. office/building lighting. THe diagram below show this capability.

Mesh2.jpg

 

Our test setup is simpler where we need a star topology as shown below and may even contain just a single node in addition to the coordinator.

This topology takes advantage of the smart features of the CC110L. A quick look at the block diagram of the CC110L shows a packet handeler which offloads a lot of the processor responsibilities to itself. This includes Preamble detection, Sync word detection CRC checking which form the basics of a reliable communication system. These features means that the controller does not have to keep scanning the module for valid signals nor does it have to compute CRCs which will save some Lookup table space as well as time & effort. Additionally if you plan to have a small network and you can have an addressing scheme with a single byte, you can have the CC110L do that on it's own. For larger addressing space you will have to write your own layer but for my application this fits in quite nicely.

 

CC110L_simp_bd_swrs109.gif

 

If you have an RF analyzer, you can see the following packet transmitted over the air which the micro-controller will be oblivious to anything other than the data field. This is a good thing!

packet_format_swrs109.gif

I am NOT an FAE with TI hence I will skip the marketing lingo on the other features. The bottom line is that its a simple RF chip with just enough capabilities to make a simple network. The CC110L also has power down capabilities for sensor nodes that run on battery. Choose when to power the PA and disable it when not needed. There is also the ability to select a channel which means I can isolate two sub networks in the same physical space. Neat!

 

The only bottleneck is that the FIFO buffer is 64-Bytes which means that if I want it to send a sonnet, I will have to break it down. We'll see about that later. Right now I just need to make two device talk over the Air!

 

The Air Booster Pack

 

As always I won't try to replicate existing content and there are plenty of good reviews on the CC110Ls as well as the Anaren Air BoosterPacks. The microcontroller talks to the CC110L via SPI and there are two configurable IOs on the Chip as well. One should be used to generate an Interrupt on successful transmission or reception. The datasheet talks of the GPIO being used for serial data input but I really do not want to get into that unless absolutely necessary. Simplify things and get the job done I say. Below is the image of the Air Booster on the MSP430fr5969 LP and one on the MSP430F5529 LP.

 

I am still experimenting with some permutations and combinations on a better way to prototype things but right now, for this exercise I will be using these two standard Launchpads. The FR5969 is a low power LP and the 5529 is a USB LP and will be used for this exercise. The Kit contains two MSP430s preprogrammed with demo code and the Booster pack has the basic circuit layout on it. You can mount a few components and it will function without the need to purchase a LP. Cool concept and I am temped to try it myself however if I want to have sensors then I have to add connections or make a separate board anyway so this arrangement is good for demo purposes and I would rather make my own addon board... and I will... eventually.

 

Right now I want to get up and running as soon as possible so its use it as is for now.

 

The rise of Energia

 

The reason why AVRs are so popular is simple. Arduino! Its a IDE and language and hardware prototyping made for hobbyists in mind. The code may not be optimized and the boards may be awkwardly sized but they are easy to use and have a LAAAARGE base of libraries, demo apps and communities built around it. Hence it makes everyone want to use one. TI saw this and came up with energia which is basically their clone of the Arduino Environment. Same language and similar looking IDE but for their MSP430 and now CC3200 line of controllers. I support the Energia Project Completely because it gives me the capability to use the Launchpads in applications where the arduino doesnt fit. 3V# GPIOs and higher frequency controllers with some made for low power is what I see MSP430s as. I was initially put off by the convoluted architecture of the MSP430 but with the advent of Energia, my MSP430s became useful again. Needless to say I just avoid Code Composer for MSP430s all together because of the bas experiences I have had in the past.

 

This instance is no different and using the CC110L is a breeeze with Energia and there are libraries and demo code that come with the IDE itself. The same code runs on both the launchpads without me having to change anything other than the target board name and port number. How cool is that? Bravo Energia! Below are some screenshots of the IDE and demo code at work.

 

f8889e59b5c1f3a7494eaa5bb1296576.jpg

 

The easy way to setup a link

 

I could go in and explain the SPI interface and then the code that goes along with it, but I won't... because its not necessary. This is the reason why this writeup exists in the first place. It requires NO coding experience to get started with these modules and that is the best part. I want to showcase how easy it is to setup these modules and I hope people will actually try out these modules because these are pretty good.

 

Step 1.

The first step is to put the Air Booster Packs together with a Launchpad. As stated before, I have the MSP430FR5969 and the other is the MSP430F5529 each with an Air Booster. The FR5969 is programmed to be the sensor node which can measure temperature and values from a dust sensor. These are transmitted to the 5529 LP which acts like a hub and sends the data via serial connectivity to the console. The image below show my setup.

 

Step 2.

Get Energia and from the examples menu, find the air430boost sub menu. First we want the hub to be setup hence select the appropriate example. Image below shows a screenshot of the Menu.

 

15 - 1.jpg

 

Next select the board which in my case is the F5529 and click compile. Once this is done, we upload the code to the board after connecting it via USB.

 

Step 3.

Next we setup the node(s) and to do so we select the wireless node example as shown below.

 

Change the target board selection which in my case is the FR5969 and hit compile. Next select the upload after connecting the board via USB.

 

Step 4.

There is no step 4! You are done. It's that simple. Just power up these boards and you should be able to press a button on the node and the hub should reflect the communication.

 

Video Clip

 

Here is a short video clip of the demo in working.

 

 

Comparison

I don't have much to compare with. The XBEEs cost a little above INR 2300 which is quite expensive in my opinion but for applications where quick deployment is required, these are a slightly better option. I say slightly because the costing of so many XBEEs will accumulate and burden the project budget. Another option is the LPRC eRIC modules(Antenna Extra) cost INR1549 from element14 and even though I have not used these myself, I have heard good things about these. Lastly the Anaren CC110L modules are priced a little less than INR1650 which have the Antenna onboard are currently the modules under test here. Of the three, the Anaren modules are the only ones without a dedicated micro controller inbuilt but the cost of an additional MSP430 is not that much either.

 

 

To be continued...

I plan to continue this discussion but adding some custom code to transmit data to a console in the next part. My parts of the Power board just arrived and I wanna try and complete that part first... Stay tuned.

 

Prelude

The challenge is to create a system for air quality sensing which can operate without human intervention. My idea is to create a system that can measure air quality indoors and outdoors and log this data to the Sierra Wireless System. For the indoor unit, I have a CC3200 power unit which can measure temperature and an MICS5524 sensor which can measure air pollutants and connects to the cloud over wifi. It is powered by the TI Fuel Booster Pack and charged wirelessly with the Wurth Electronics Wireless Charging System. All parts are TI and Wurth Electronics.

 

The second outdoor unit is made up of the FR5969 Launchpad and uses the Alphasense Sensor for SO2 measurements and a Dust Sensor to measure particulate matter. This data is transmitted via CC2500 modules wirelessly to the BeagleBone Black which also has a CC2500. The BBB acts like a gateway device and sends the data to the Sierra Wireless Cloud via Wifi. This can be expanded to include more nodes to connect to this gateway and will allow future work to be done.

 

In addition to this functionality, I created a small board that can harvest solar energy and store it in a Li-Po battery. BQ25504, TPS61200 and TPS62740 are used to create a power harvesting circuit and the details are explained.

 

In this post I present a tutorial on how you can get started with using Sierra's Air Vantage Cloud Storage system.

 

Introduction

One of the sponsors is Sierra Wireless who provide cloud based services for embedded devices and gateways. In the world of IoT, devices connected to the Internet can be easily managed using platforms like Air Vantage where devices can send their status like health, signal strength and other diagnostic info and a bulk of devices can be monitored easily from a single online point. Alerts can be generated as well as action can be taken for IoT Gateways. As a thanks to our sponsors, I wanted to create a graphical tutorial which lets 'developers' and 'hackers' to create their own little system and I found out a little late that there is already a tutorial on the subject at https://doc.airvantage.net/display/USERGUIDE/Using+MQTT+with+AirVantage

A lot of discussion has also happened on the topic as well so I offer my two cents worth here.

 

The objective is to setup Air Vantage Cloud services for MQTT and then connect to it via an embedded device. In this tutorial I use NodeJS BUT the script runs on my PC to demonstrate portability of the code. I have been able to run the same code on the BeagleBoneBlack and the snippets have been modified according to the instructions given at https://doc.airvantage.net/display/USERGUIDE/Enable+BeagleBone+Black+With+AirVantage+using+MQTT

 

Setting up Air Vantage

This tutorial is very graphic hence viewer discretion is advised What that means is that most of the tutorial is in screenshots and quite self explanatory.

Setup the App

When you login for the first time, you see...

556e97919a6fb05277dd025062b4cdb7.jpg

The first thing we need to do is create something called an APP. This will basically define how data is communicated which in our case is via MQTT. Additionaly we define variables that will be used in the communications.

In my case, I am sending temperature, Dust and Hydrogen Sulphide Concentration in this instance. I have a different system which sends temperature and VOCs but that's a different tutorial since the code is in cpp. Here is how you do it.

e8c50d3360f6a4d392aaf6951f83a583.jpg

Next we need an APP. I am attaching mine at the end of the tutorial but feel free to type up yours or modify the given file which looks like.

0af38b33595882a5c42bd9f2bb9f2f1c.jpg

In the data section, remember to note the asset ID and variable paths. These will later on be used like...

BeagleBoneBlack.temperature etc where BeagleBoneBlack is my 'id' specified here. Put it in a zip file by any name. Next...

3a2d60ac620e4581c8e015b08a1d047b.jpg

And then...

306eeafd7e742ddd1ff809e411dc62fb.jpg

And then...

f749f434869e3d635e00573849c76755.jpg

And then...

871e998f1f988f034dcacaa3d28e19cf.jpg

And then...

e01b54199eabd57e5ee5b2fa38fe262a.jpg

And then...

c99ef1f9c7612b353c2bff629c31da75.jpg

And then...

c2e944a650ca7bec81df04e0760ad88a.jpg

And then...

aad733fadd34fc2d24870b30fa6cbcc1.jpg

And then...

e928c2e9161de97232a932cc708fe70e.jpg

And then...

fe14fe264e6542aa1e13d48988707591.jpg

And then...

 

You are done with setting up the basic APP! Great

 

 

Setup the gateway

The next thing to do is set up the gateway. The app is released but not published hence we need to create credentials to allow login and post data. This is pretty simple.

In the inventory section we currently have no systems... so click click click

6197d9dcad9e9a4527304c9886247bd4.jpg

And then...

d0d0cd8462668bf95dbcd856c9748e6a.jpg

We need a name and in the gateway section enter your BBB serial Number. This is just a unique identified and since I am using a PC, I just used a random sequence. For the Applications, we already have one and when you select the drop down, you should see some familiar name(s).

77f2a11e27a8b692a140dabacc4922ab.jpg

If you did not add credentials then it will ask you for em. Enter a password to be used with MQTT.

4ab92cd1423bd2f0ea4cc2689ea4a7af.jpg

You should be able to see the above.

 

 

Next we need to activate it...

7757aa752d91491f8cdb6e84244bd4c5.jpg

 

 

0d6734b1271206013c25ef0bf05be33a.jpg

Click click click and then...

You should end up with somthing like this...

1328b0e4e1d05ed7cb6f58f16dc531e2.jpg

Clicking on the app will take you to...

d9e34868fe28e92e4ba83c893177d28b.jpg

 

So we have no data. BUT we can see our variables. Excellent. Now to push some data onto it.

 

Meet NodeJS

For those who don't know what NodeJS is, it javascript that runs without a browser. You can run simple scripts and with the help of libraries you can access GPIOs and connect to the internet. With more libraries, we can even create a webserver entirely on NodeJS(See NodeJS and Express if interested). All we want here is to use MQTT with a little JS since the BeagleBoneBlack can run JS from the Cloud9 IDE. I want to do my development on my 100year old PC since it generates a lot of heat and its still winter here

I have installed NodeJS on my PC and have created a folder to work in.

In a NodeJS Command Prompt with NPM setup, I navigate to the folder where I want to develop the things.

 

Step 0.

This is not mandatory but I create a NodeJS package so that every time someone uses it, the dependencies are automatically installed as well. Type..

npm init

Enter the name and revision and author name. The entry point is by-default the name of the folder but make sure you name your .js script with the name entered here. Leave the rest blank and enter yes at the end.

 

Step 1.

Install mqtt if not already installed by typing..

npm install mqtt --save

the --save saves the version of mqtt library being used.

 

Step 2.

Create the script with the name used as entry point. Mine looks like this...

73ef4a9c8a28d7a003614efaf0d173ea.jpg

Save and in your node command prompt...

5b3b9957b47c7396fff5c8d2739271f6.jpg

That worked... right?

On the airvantage site, we refresh and then...

d011d9b7b1af79e88312c85167141194.jpg

Click on one of the buttons to see a graph like...

f95f6b2392a10a4b6fd0a62772dc51fb.jpg

 

 

Success!

 

Conclusion

This is just the tip of the iceberg and I just took longer to do a simple thing. I hope this tutorial is helpful for those who wish to use the airvantage platform and they get a running start. If it was helpful, say hi and gimme a pingback. If there is something I missed, lemme know and I will do the needful.

Thanks,

IP

 

EDIT1. Since I could not attach a .js, the script is given below.

var mqtt = require('mqtt');
var port = 1883;
var server = "na.airvantage.net";
var serialnumber = "3713BBBK7777"; //serialnumber
var password = "Make your own password";

var mqtt_options = {username: serialnumber, password: password};


// I know 'createClient' is depreciated but it has a lot of examples for it. 
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 payload= {};
var timestamp = new Date().getTime();

payload[timestamp] = { "BeagleBoneBlack.temperature": 16.2, "BeagleBoneBlack.dust": 10.0, "BeagleBoneBlack.hydrogensulphide": 2.0 };
client.publish(serialnumber + '/messages/json', JSON.stringify(payload));


console.log(payload);
console.log('Done');
client.end();

 

The BBB.app is...

<?xml version="1.0" encoding="ISO-8859-1"?>
<app:application xmlns:app="http://www.sierrawireless.com/airvantage/application/1.0"
        type="com.wordpress.embeddedcode.bbb"
        name="In The Air App for BBB"
        revision="0.0.2">
  <capabilities>
  
    <communication>
      <protocol comm-id="SERIAL" type="MQTT" />
    </communication>
    
    <data>
      <encoding type="MQTT">
        <asset default-label="BeagleBoneBlack" id="BeagleBoneBlack">
          <variable default-label="Temperature" path="temperature" type="double"/>
          <variable default-label="Dust" path="dust" type="double"/>
   <variable default-label="HydrogenSuplhide" path="hydrogensulphide" type="double"/>
        </asset>
      </encoding>
    </data> 

  </capabilities>
</app:application>

Prelude

The challenge is to create a system for air quality sensing which can operate without human intervention. My idea is to create a system that can measure air quality indoors and outdoors and log this data to the Sierra Wireless System. For the indoor unit, I have a CC3200 power unit which can measure temperature and an MICS5524 sensor which can measure air pollutants and connects to the cloud over wifi. It is powered by the TI Fuel Booster Pack and charged wirelessly with the Wurth Electronics Wireless Charging System. All parts are TI and Wurth Electronics.

 

The second outdoor unit is made up of the FR5969 Launchpad and uses the Alphasense Sensor for SO2 measurements and a Dust Sensor to measure particulate matter. This data is transmitted via CC2500 modules wirelessly to the BeagleBone Black which also has a CC2500. The BBB acts like a gateway device and sends the data to the Sierra Wireless Cloud via Wifi. This can be expanded to include more nodes to connect to this gateway and will allow future work to be done.

 

In addition to this functionality, I created a small board that can harvest solar energy and store it in a Li-Po battery. BQ25504, TPS61200 and TPS62740 are used to create a power harvesting circuit and the details are explained.

 

Status

I await some passive components as well as the sensors to arrive. I have been able to mount the HDC1000 using a hotair station and test out it's functionality. In this post I go through my experience with the CC3200 and connecting with the Sierra Wireless Cloud.

 

 

The CC3200

TI calls this the 'Internet of A Chip' and rightly so since it has a wifi stack as well as a microprocessor on the same die. The first thing we need to do is get this baby up and running. TI did something brilliant with this chip- they supplied demo code for a broad spectrum of applications from Basic Timer and peripheral stuff to the extensive access point mode. The Out Of The Box demo starts as an AP and you can configure it to connect to the Internet. I will go step by step here rather than write a journal about it since that has been done so many times.

(Disclaimer: Some Images have been taken from the TI Website because of their awesomeness)

 

Step 1: UnBox it and Get started

Yea that simple enough but the fact is the device come with little more than a USB Cable and the board itself.

The getting started instructions can be found here http://processors.wiki.ti.com/index.php/CC32xx_Quick_Start_Guide

The idea is to connect to the CC3200

OOB_AP_step2.png

This will give you a basic idea of the AP mode of the CC3200. Now we need to connect it to our router.

 

Step 2: Connect to our router.

In order to do some real work, we need to connect to our wireless router. For that, go to the settings page once connected to the CC3200

GSG_CC3200_LP_2.png

Enter the SSID of your router and also the password and type of Security. Do an ADD and power off the board. Next, pluck out the jumper shown in the image below

OOB_AP_step1.png

Power it back on and you should be able to see the board in your network. Just connect to your wirless router and go to mysimplelink.net

Congrats you are now on the network. Lets complicate things...

 

Step 3: Install the Dev IDE

We need to configure the CC3200 to do our bidding hence we need to install the tools necessary. (http://www.ti.com/lit/ug/swru376a/swru376a.pdf) This document can help you get started but I recommend visiting...

CC3200 "Internet-on-a-Chip" Getting Started Guide – Part 1

shabaz sir wrote this so beautifully that I just cannot do it better.

 

There are updates for the CC3200 available on the website which TI Recommends you download and upgrade. The post above helps you do that and steps 1 through 8 are what I used. It involves setting up the IDE and updating the firmware.

Great we now have the tools and board updated at this point. Next we need MQTT

 

 

Step 4: Start Coding

Like I said, TI did a brilliant job with the demo code and it would be wrong not to use it. I encourage you to import the examples and try em out. It's as simple as connecting your board and clicking the little bug icon on the top. DOn't worry you cannot brick your device since your program will only be in RAM and when you reboot the board, it will again start the OutOfBox Example application.

fb056ce472da60d74b5e88271b4453cd.jpg

Steps 9, 10 and 11 of the above mentioned link from shabaz sir's post do exactly that.

 

 

Step 5: Understanding MQTT

MQTT has been called the language of IoT. It's basically a small protocol that allows communication using a broker/server. The basic mechanism is a publich/subscribe type where you subscribe to a 'topic' and then when someone 'publishes' data, you get it at your end. The problem is that the message or data is typically not stored by the server/broker in the basic form. We are interested in getting basic communications up and since we have the CC3200 connected to the router, why not the internet? Instead of setting up our own broker/server, we will use the iot.eclipse.org MQTT broker which works for free! Yay! To test this out, you should first install a utility for MQTT like Google Chrome as an extension called MQTT Lens. You can get apps for android as well or iOS. Fire up the app and enter iot.eclipse.org and port 1883. No username or passwords are needed at this point but some apps may want one anyways. In the topic, use any string. I preffer strings like /Inderpreet/myProject/CC3200. This is not a folder structure but just a way to uniquely identify the Topic. Click Subscribe and now you are listening. Next we need to publish something type in the same topic name and enter some text. When you press publish, you should be able to see the message in the window below. Here is a screenshot.

 

66c35fd22891c5ea09e4d37c30c85b62.jpg

 

In my IoT Holiday Lights Challenge, I used MQTT to send strings like :TM255255255 which meant

: = start of frame

T = command for the tree

M = Manual Mode

255 =Red

255 =Green

255 =Blue

 

The crafting of such a message is done in software and we will see how. First lets see if our CC3200 can talk to the broker.

 

Step 6: MQTT on CC3200

Since our CC3200 already connects to the router, we should be able to connect to anything. My starting point for new projects is the demo code for the OOB which is provided by TI. It is the simplest way to get up and running in a jiffy. There is a wonderful video tutorial by kartben sir on the subject of running MQTT on the CC3200 and here are the blog posts.

Connect the CC3200 to the Internet of Things with MQTT and Paho embedded C client - Part 1

Connect the CC3200 to the Internet of Things with MQTT and Paho embedded C client - Part 2

Once you are done, you should have an MQTT enabled CC3200 transmitting the temperature. Cool now what? For the Forget Me Not Challenge, I used the CC3200 to read an ADC and then send that data to another topic. Lets see how to do that...

 

Step 7: Reading a Frequency and sending it via MQTT

By now you have figured out that the CC3200 is running an RTOS and everything happens in Tasks. So we will start by writing our own task and extend the capability of the system. I am going to setup the CC3200 so that it will measure a frequency of a signal and send that data over MQTT. I used this technique in the forget me not challenge to measure rainfall in a tipping bucket sensor. We will be using timers hence this should be fun. (http://www.element14.com/community/community/design-challenges/forget-me-not/blog/2014/10/20/forgetwhat-a-met-system-update-experiments-with-paho)

 

The first thing to do is to find out which pin I can use. The infographic by shabaz sir is very helpful.

pinout.png

A quick look at the datasheet and...

e57ebd059619b98836c30229bdab86e9.jpg

Its clear I can use TimerA0. Using the PinMux Utility, I can easily generate the desired code. Here is what I did...

 

a> Adding to main

In the main.c, in the void main() function, I added the following lines...

//
    // Configure the pinmux settings for the peripherals exercised
    //
    PinMuxConfig();


    PinConfigSet(PIN_58,PIN_STRENGTH_2MA|PIN_STRENGTH_4MA,PIN_TYPE_STD_PD);

    //
    // Configure TimerA0
    //
    TimerA0Init();


    //
    // Register timer interrupt hander
    //
    MAP_TimerIntRegister(TIMERA2_BASE,TIMER_A,TimerIntHandler);


    //
    // Configure the timer in edge count mode
    //
    MAP_TimerConfigure( TIMERA2_BASE,(TIMER_CFG_SPLIT_PAIR| TIMER_CFG_A_CAP_TIME | TIMER_CFG_A_PERIODIC_UP));


    // Set the prescaller
    MAP_TimerPrescaleSet(TIMERA2_BASE, TIMER_A, TIMER_PRES);


    //
    // Set the detection edge
    //
    MAP_TimerControlEvent(TIMERA2_BASE, TIMER_A, TIMER_EVENT_POS_EDGE);


    //
    // Set the reload value
    //
    MAP_TimerLoadSet(TIMERA2_BASE, TIMER_A, 0xffffff);


    //
    // Enable capture event interrupt
    //
    MAP_TimerIntEnable(TIMERA2_BASE, TIMER_CAPA_EVENT);


    //
    // Enable Timer
    //
    MAP_TimerEnable(TIMERA2_BASE, TIMER_A);




That configures the timer a and connects the Capture mode input to Pin P04 which is on J1(left side).

 

 

b> Add the handellers

Add the following functions to the main.c file

 

//*****************************************************************************
//
//! TimerA0 interrupt handler
//
//*****************************************************************************
void TimerA0IntHandler( void )
{
  if(g_change == 1)
    GPIOPinWrite(SIG_PORT, SIG_PIN, SIG_PIN);
  else
    GPIOPinWrite(SIG_PORT, SIG_PIN, 0x00);


  g_change ^= 1;
  Timer_IF_InterruptClear(TIMERA0_BASE);
}


//*****************************************************************************
//
//! TimerA0 and pin_61 Initialization
//
//*****************************************************************************
void TimerA0Init()
{


  // Configure PIN_61 for GPIOOutput
  MAP_PinTypeGPIO(PIN_61, PIN_MODE_0, false);
  MAP_GPIODirModeSet(SIG_PORT, SIG_PIN, GPIO_DIR_MODE_OUT);


  // Configure TimerA0
  Timer_IF_Init    (PRCM_TIMERA0, TIMERA0_BASE, TIMER_CFG_PERIODIC, TIMER_A, 0);
  Timer_IF_IntSetup(TIMERA0_BASE, TIMER_A, TimerA0IntHandler);


  Timer_IF_Start(TIMERA0_BASE, TIMER_A, TIMER_FREQ /TIMER_CAP_FREQ /2);
}




 

The handler function takes care of measuring frequency in the Background. Nice!

 

 

c> Add our task

 

Next I need to add my own little task... create a copy of the MQTTTask Function OR simply use the code below.

static void MQTTTaskRain(void *pvParameters){
    while(g_iInternetAccess!=0){
        osi_Sleep(200);
    }
    // Now connected
    while(1){


        MQTTPacket_connectData data = MQTTPacket_connectData_initializer;


        unsigned char buf[200];
        MQTTString topicString = MQTTString_initializer;


        char cTemp = (char) g_ulFreq;
        char payload[20];
        memset(payload, '\0', sizeof(payload));
        short sTempLen = itoa(cTemp, payload);
        int payloadlen = strlen(payload);
        int buflen = sizeof(buf);


        data.clientID.cstring = "me";
        data.keepAliveInterval = 20;
        data.cleansession = 1;
        int len = MQTTSerialize_connect(buf, buflen, &data); /* 1 */


        topicString.cstring = "/forgetwhat/cc3200/rain";
        len += MQTTSerialize_publish(buf + len, buflen - len, 0, 0, 0, 0, topicString, (unsigned char*)payload, payloadlen); /* 2 */


        len += MQTTSerialize_disconnect(buf + len, buflen - len); /* 3 */


        int mysock = sl_Socket(SL_AF_INET, SL_SOCK_STREAM, 0 );
        SlSockAddrIn_t addr;
        addr.sin_family= SL_AF_INET;
        addr.sin_port = sl_Htons(1883);
        addr.sin_addr.s_addr= sl_Htonl(0xC6291EF1);
        sl_Connect(mysock, (SlSockAddr_t*)&addr, sizeof(addr));


        // rc = Socket_new("127.0.0.1", 1883, &mysock);
        sl_Send(mysock, buf, len, NULL);


        // rc = write(mysock, buf, len);
        sl_Close(mysock);
        // rc = close(mysock);


        osi_Sleep(10000);
    }
}




 

d> Add the task to the OS

 

 

The last thing to do is add the newly made task to the OS's list of things to do. Simply add the following line to the main function.

 

 

osi_TaskCreate (MQTTTaskRain, ( signed char *)"OOBTask" ,OSI_STACK_SIZE, NULL, OOB_TASK_PRIORITY, NULL );




 

 

Done! Debug and let her rip! My box looked like this...

 

1.jpg

 

 

Step 8: Making things permanent

In order to retain this code, we need to program the flash. Step 8 of this tutorial by @shabaz sir has the correct instructions. http://www.element14.com/community/groups/internet-of-things/blog/2014/10/19/cc3200-internet-on-a-chip-getting-started-guide-part-2

 

 

Step 9: Experiment!

 

You have the basics, so now its time to move to more advanced stuff. The above link has info on how to configure I2C with the CC3200 and control an LCD which I have experimented with in a previous post.

 

Conclusion

I tried to curate the information of the best and put my little something into it as well. In the next post, I will be displaying the temperature data on the LCD as well as sending it to the Sierra Wireless Cloud and configuring the service to work with the CC3200.

 

Till then, happy CC3200

 

IP

Prelude

I have been busy with the IoT HOliday Lights project but after its completion, I have jumped right back here. I had the boards manufactured from Seeed and they look good. I will post a progress blog separately, but right now, I need to post about my experiments with the HDC I soldered.

 

I2C Testing with the Buspirate

 

This mini article is part of a larger project an I will link to it at the end. For this project, I was required to use the TI HDC1000 and instead of buying a module, I decided to get samples and a make a PCB of my own. This would be great except I had to create the footprints which are almost microscopic! Anyways I got it made from SeeedStudios and I bought one of those ultra cheap hot air stations with no indications about temperature or airflow and some paste and got started. The reflow happened painlessly and I was pretty happy with myself. Before I move on to mounting any other parts, I decided to see if the HDC1000 was alive or had kicked the bucked in my hotair experiment.

So I started with soldering the header as well as power test pins and I hooked up the BusPirate. Har har har! I think I can explain the rest via a video and so...

 

Reading the Temperature and Humidity

 

In order to read temperature and humidity, there is a set of commands you have fire at it. You should go through the datasheet but I am going to give you the quick and dirty on reading the temperature & RH. The first thing to do it configure the HDC1000 to take measurements. It is usually in deep-sleep so I need to wake it up and configure it. So I have to send...

[0x86 0x02 0x1e 0x00] Why I send that? Well the 0x86 is the address of the HDC1000 with write bit and 0x02 is the configuration register address. 0x1e & 0x00 is the configuration to write. Next we Trigger the reading by [0x96 0x00 Note that there is no ] at the end which means that I do not send a stop character. Next I send... [0x87 rrrr] Which sends another start of frame and the read address of the HDC1000. We read 4 bytes which are MSB then LSB for the Temperature and Humidity.

 

buspirate.png

 

Using the BusPirate to get T & RH[/caption] I am getting the temperature but the humidity still boggles me and I think I may have burned it out. I will post more once I test another HDC1000 or someone helps me Till then,

Cheers,

IP

Previous Posts

I read this part a little late, but there was a document shared in the content section that said something about compulsory part. So I set out to make a custom power circuit for this project. The concept is simple. I needed a power system that could work without 'user interference'. This means I need rechargeable batteries and a way to manage them. The TI Fuel Booster Pack is one way of doing this but the parts provided do not include them and what would be the fun of a copy paste. So I set out to create a new PCB...

 

This post is sort of a standalone segment on designing a power sub system.

 

The basic design

The TI Fuel booster pack can be used as a reference and the block diagram is given below.

Diagrams.jpg

 

 

Now we do not want a USB in but a solar panel instead. Also I really have no need to gauge the battery either so thats out too. Instead I will use the BQ25504 to charge the Li-ion battery. In this case, we can also use a super cap like 1farad or so because the Wolverine LP really can work on that. Unfortunately, the sensors use up a lot more power so I left that part for an expansion for later. Next the buck and boost converter and for that we are using the TPS51200 and TPS62740. These generate the 5V and 3V for various parts. Each of these has an enable pin so I can shut them down too. This is our basic requirement and its quite simple. So lets start making the ckt. Eagle!!!!!

 

The Schematic

There are a couple of ways you can get a reference design but the application circuits in the datasheet are usually good enough. These are shown below.

Image.png

Thats the BQ25504. Pretty simple...

Image.png

and the TPS61200

Image.png

and the TPS62740

 

I can use these as is but I chose to dig a little deeper. I went on to find application notes for these and the circuits were more or less the same. So I can start making the circuit in eagle? Not so fast... Eagle has a lot of parts but you will need to make these yourself. I did and there are good tutorials on how to make parts in eagle from adafruit and sparkfun. The process is a little tedious but very satisfying.

 

The schematic I made looks like this...

Image.png

The schematic is self explanatory except for a few things. I added a connector for a sensor module which operates at 5V. Another module is used to interface a different sensor module. I probably should have added a voltage divider to the ADC but I simply missed that actually. That can be rectified but cutting the track and adding it between the connector. There is also a connector to connect it to the LaunchPad but its not a booster pack and I will explain why later.

 

The best laid layout

The next part is to layout the board. Everyone has a system for doing this and I have mine. When I start making the schematic, I finish a part such as the BQ25504 and its parts and jump into the layout. I don't completely layout the board but just arrange the parts together as an estimate and then place it somewhere else. The reason is that it simplifies layouts later and I used to work with Cadence OrCAD which had the facility to group components together. On the layout, keep pressing N to get the next part in the selected group for placement and thats something very nice. In eagle I just club things together since the number of parts on the PCB are usually smaller.

 

Before your start layout, see the datasheet for layout considerations like...

Image.png

All said and done, you can even find sample layouts like the one for the HDC1000

Image.png

Neat! So my final layout looks like...

Image.png

Each module was laid out separately and put into place. The thoughprocess is to use the least space but make the layout work. I used the seeed studios fabhouse so they ask for PCB sizes as a multiple of 5cm so I chose the least i.e. 5cm x 5cm. I make the outline 49mm x 49mm and then placed everything in it. The standard booster pack is much larger hence that was out of the question. Another aspect is that I know I will need to make changes later so I want to reduce the cost of prototype as much as possible. And lastly I want this thing to be reusable hence the enable pins, inputs and outputs all have a connector. So I can choose to use each part alone if I want. I ordered 10 of these so they should be useful for later projects as well.

 

I did NOT tent vias where vias are covered by the solder mask because I usually use these as test points to save unnecessary vias. The rev number is compulsory and I prefer rounded edges. Mounting holes I again avoid for small boards and instead I add single pin connectors(1 pin burg strips) at the corners or use a hot glue gun to make standoffs.

 

One more trick is to upload these to OSHpark.com to see the result. I cannot use OSHPark because the shipping plus making is too much.

 

Thats about it. Once I get these manufactured, I will do a separate post for the pcb and parts.

 

Hope this helps.

 

Cheers

IP

Previous Posts

It looks as if I have been maintaining blog silence for this challenge but actually I have been plagued by personal issues. In addition to that, despite the simple appearance of this project, the research that has gone into making this project is really huge. As  consequence I have a dozen half finished blog posts that are going to come in as work on each module finishes.

This post is a dedicated progress report for work done.

 

The design simplified

The objective is to measure air quality indoor and outdoor. This means two modules and each module to work on battery.

Each of the two modules will have TI and Wurth parts. The table below shows the activities and their progress.

 

Outdoor Module

outdoor.png

Indoor Module

indoor.png

Gateway

gateway.png

There is a lot to be done but the PCB part is done and I am finishing up the parts for purchases before the holidays.

More on this later...

I got one of these (The LCD!The LCD!) LCDs from the budget and the motive is to use them to display air quality. Low and behold I got them and these things are tiny... I mean more than I thought. BUT they should get the job done. This post is a little one where I try and get it to work and experiment with I2C. Lets go!

midas.jpg

 

The LCD itself

To be honest the features of this LCD are great but the cost is a little higher than I would like. The special thing about these is that they work at 3.3V which means they can be directly connected to my Launchpads. Great! Now how do I get em to work. The datasheet is available as with all element14 parts and you can download it for use. I will take out the parts that we need and discuss.

 

Shabaz sir used it in his posts about the CC3200 and he did it effortlessly. I had to mess with somethings hence I am posting a bit of my experience.

 

First things first...

The pin configuration. Before we start with the software lets ready the hardware and for that we need to know about the pin config. Its in the datasheet and the useful parts are:

 

a.png

b.png

 

 

 

Brilliant now this means that  I can work with only 4 Pins. I need the VDD, VSS(GND), SDA and SCL. I can tie the reset and everything around. I am not going to make footprints or PCBs for this thing so I will directly solder everything in place. The pins are connected as:

1 - VOUT , 4 - VDD and 8 - RST to the 5V output from the CC3200 Launchpad. Why 5V? Because if you want to run it off the 3.3V then you need to add two caps. I will save those caps and use the 5V available on the LP.

5- VSS to Ground

6 - SDA to the I2C SDA Pin

7- SCL to the I2C SCL Pin

 

Done!

4 pins is all I need. If I need to reset it I can do it in software OR power the thing OFF and ON. Great!

The results of my soldering is shown below. In my deficen I would like to say that I do not have the finer tips for the soldering station so this will have to do.

 

LCD1.jpg

 

 

The bus pirate.

I would like to run the LP directly with the LCD but there is a problem. I don't want to mess with code then find out that my soldering was dry. So I chose to use the Bus Pirate.

For thos who dont know, the bus pirate is a small tool that can be used with most serial bus protocols to debug and analyse them. Here I will be using it for I2C. Hooking it up is easy. The above four pins to the pins on the pirate and done! Well one more thing. The I2C bus needs pull-ups and the voltage of these pull ups matters for the controllers being used. I want the bus to go 3V3 so I can solder some external pullups. The simpler solution is that there is a Pull up connection on the BP which can be enabled or disabled in Software. Any voltage 3V3 or 5V can be selected externally using the provided pin and so I connected the Pullup wire to the 3V3 generated by the BP itself. Neat!

 

c.png

d.png

e.png

 

On to the bus!

There are a gazillion tutorials for the I2C bus on the net so I wont bother. The signaling is not important here but what is important is the protocol itself.

In order to talk to a device, the bus is pinged with a start signal.(For signalling details, google it! or PM me.) Next the address of the device to be hailed is sent. The addersses are 7 bit with the last bit signifiying read or write operation. Next data or commands are sent post which the device sends an ACK or acknowledge for each byte successfully received. This makes sure you are talking to something. Lets go by example here.

 

The first thing here is the address. The buspirate is used via a serial terminal program. After bringing it into I2C mode and enabeling the power and pullups, we try to talk to the LCD. Its address is 0b01111100 where the last bit is 0 for write operations. Hence for a read operation, we would use 0x7d. That simple. A quick look at the datasheet...

 

f.png

 

Easy right.. OK moving on.

 

We need to send it something that tells it that I want to send commands to initialize it. These commands also include resetting the LCD and moving the cursor around. So how do we do that?

The next byte we send will be 0x00 if we want to send a single command.

I made the string in notepad and pasted it into the realterm console as:

 

s.png

press enter and...

1.png

 

The ACKs means the LCD is present and responding. Good. Now to print something. Now the Datasheet has a table that you can decode but I have a trick. All the characters are assigned their ascii code and you can go to asciitable.com and get the hex values directly.

 

Copy and paste the string into the console and...

2.png

 

The Hello pops up on the LCD.

lcd2.jpg

 

Conclusion

A lot of work just to get a hello but it is worth it in the long run. I hope this helps people thinking about adding an LCD to their project. Graphical LCDs are also possible but this is just smaller and quicker.

Cheers,

IP

Its been a hectic couple of weeks and progress has been slow. I will be posting a series of smaller posts to cover work done and my "evil plans". One of the factors that contributed to my slow progress was sensor selection and I am still a bit stuck on that- the reasons I will explain. I also received the basic kits from E14 so thanks for the support. Lets jump in to the progress part direcly.

 

 

The Sensor Problem

I had planned on building a sensor system for open air and in order to do so I started contacting vendors like I usually do. I asked about the sensors they provide as well as their suitability for my application. Turns out that sensors such as the ones provided by SGX Sensortech (IS) Ltd like the MICS series is really not suitable for outdoor use. At least that what their sales manager says. Most of these sensors are made for indoor use and not sensitive enough for ambient air measurements. So what next?

 

 

Moving On

The objective here is to monitor air quality and that is why I had divided the system into two segments. There is an indoor as well as outdoor unit but there are many ready made solutions in the market so what can I do different? Well most of these work on measuring air quality and alerting when a level is exceeded so we can add a display as well as connecting it to the Internet. I already experimented with connecting the CC3200 with OpenHAB using MQTT for the Forget Me Not Challenge. That works! One change will be that we will be posting to the Sierrra Wireless Cloud instead of OpenHAB.

 

 

Since we have a 50USD budget for the PCBs I started work on the circuits. Not having selected the sensors still meant that I can work with power circuit. For the charger, I am using the BQ25504 so I used eagle to make the schematic.

 

1.png

 

 

Had to jump through a few hoops to make the footprint and that thing is smaller than small. Next was the boost converter for the 5V. This is getting to be very similar to the Fuel Booster Pack but it has its differences. The boost converter selected is  the TPS61200. Again a few hoops and I made the footprints to match the devices.

 

2.png

 

 

Next is the buck converter which is the tps62740. The footprint of this one is still a bit fuzzy and if anyone has it please send it across.

 

Image.png

As of this writing, that part is under construction and I will blog about it in the next post.

 

 

I was thinking about doing a post on using eagle but there seems to be too many already and to be honest everyone has a systemm of doing things. I typically make the schematic in parts and keep committing to git. Once I am done with a part of the circuit, I jump into layout and just place the parts in a suitable arrangement. This makes sure that the part groups don't get mixed up and there is less confusion while doing the final placement and routing.

Anyway I will do a video when I route the board which I think I will have to dedicate some time for since there are layout considerations for the used devices and fitting them all on the PCB will be a challenge on its own.

 

Thanks to Micheal W for inputs on the post on inductors. It was useful.

 

Baby Steps:

I am going to finish the schematic this weekend and move onto the software part. More progress will be updated in separate posts.

I had already proposed a design but it was a bit rough and after talking to some sensor vendors, I found that not only are gas sensors expensive but most of them might not be suitable for outdoor use at all. Hence I have cut down on the sensors and added expansion connectors in my design for later use. The current design is shown in the figure below.

diag1.jpg

It has been a slow week due to personal reasons but I have come up with the above diagram and there are a few pieces still missing which I will add once information comes together.

 

Description

 

The system has three main parts. The first is the Field Sensor Node which is where a lot of the work is focused. It uses the 'compulsory parts' and I have received samples via Dr. Defeo. They are SMALL! The objective here is to create a booster pack for power management and an expansion board for the sensors. I will spend the next week working on board layout and will try and send that to manufacturing ASAP. This node talks to my second module which is the Beagle Bone Black over the CC110L which is a 433MHz based module and I am hoping to test out its range and performance. The BBB will have the CC1101 module which is a bit more feature rich and will itself talk to the Sierra Wireless Cloud. I have successfully tested the Sierra Air Vantage platform and will try to do a writeup next week.

 

The third module is the CC3200 based Table Top Sensor. I have used a Fuel Booster Pack from a previous roadtest and it seems with a little modification I can charge it up using a solar panel directly! More details will come soon. A small addon board here again for the sensors and the data is directly logged to Sierra Wireless. I have tested connectivity from the CC3200 to the Sierra Wireless platform and works like a breeze. The documentation is a bit slow on my part because I was unclear as to the usefulness of some things.

 

I am running some experiments on the CC3200 boards and will start writing more detailed posts when I am done.

 

More later.

 

Cheers,

IP