Sub-1 GHz Sensor to Cloud IoT Gateway - Review

Table of contents

RoadTest: Sub-1 GHz Sensor to Cloud IoT Gateway

Author: ss_shrenik

Creation date:

Evaluation Type: Development Boards & Tools

Did you receive all parts the manufacturer stated would be included in the package?: True

What other parts do you consider comparable to this product?: Raspberry Pi with debian as Gateway, due to large community support and most important price.

What were the biggest problems encountered?: Out of Box demo didn't work since Mac Coprocessor Firmware was not responding to Gateway application running on BBB. Also after trying to integrate my own custom button on Gateway side, somehow webserver application broken

Detailed Review:

First of all, using the Kit was very simple, just connect Mac co-processor board to Beaglebone black and then connect Sensor board to 5V supply. As per user guide I started to set up first time, then I thought to first try local gateway example. Here disappointed since I encountered the problem where webpage said

 

"Error starting collector. Please reset Co-Processor and try again."

 

As per message, I tried resetting but no success. This message kept coming. Then I thought to dig in more to find the root cause of this issue. I.e. whether co-processor communication problem or FW is corrupted for co-processor.

 

To do this, I did ssh to beaglebone and found that we have source and pre-built binaries for the sensor to cloud demo. Here I tried to run bbb_collector which is the native app called from web interface.

This app returned me the error “Cannot get VERSION info from CoProcessor”. After several retries, I decided to flash the binary again. You can find the FW binaries in directory “home/root/linux_s2c/firmware/CC13x0_LaunchPad/”, and with the help of TI’s Uniflash tool, which is very easy to use tool to flash the FW binaries. I flashed “coprocessor_cc13xx_lp.hex” to coprocessor module and “Yeh” it could detect and local cloud could set up.

image

 

 

 

With this, I could get the demo up and running and could find the data being displayed.

image

But what I found is there was a significant delay between pressing “Red LED” toggle button and actual action seeing on the board. This could lower down the user's experience.

image

 

I was more interested in evaluating the beagle bone to sub1 GHz communication since beagle bone is powerful SBC, it is not a problem to integrating its service to the cloud. Hence I decided to check how easy it is to use TI end node platform i.e. adding new functionality to the sensor to cloud gateway platform. This led me to Ti’s official wiki page having “Adding a Generic Sensor to the Sensor To Cloud Gateway”. http://processors.wiki.ti.com/index.php/Adding_New_Sensor_Support_To_Sub1GHz_Sensor_To_Cloud_Linux_Gateway#Start_Linux_Collector

 

Here, it has explained in detail how one can add new sensor support in this platform.

The functionality I was planning to add is simple push button. On CC1350 Launchpad we do have two push buttons i.e. DIO13 and DIO14. I wanted to update the status of these on the gateway platform similar to existing temperature and time parameters.

 

 

Below is my sensor side Firmware changes

I used Ti Cloud IDE to develop this application and imported sensor_cc1350lp project into cloud IDE. This was the first time I was using the Cloud IDE. I guess this is the best way to develop applications on the cloud without worrying about development environment setup.

 

I am giving changes in Firmware I had to make below

 

In smsg.h

 

/*! btn message length (over-the-air length) */
#define SMSGS_BTN_MSG_LEN 1

/*!
 Message IDs for Sensor data messages.  When sent over-the-air in a message,
 this field is one byte.
 */

    /*! Button data message, sent from the sensor to the collector */
    Smsgs_cmdIds_btnData = 12

 } Smsgs_cmdIds_t;

Adding btnData field

    Smsgs_dataFields_btnData = 0x0800,
} Smsgs_dataFields_t;


/*!
 btn Data Field
 */
typedef struct _Smsgs_btnfield_t
{
    /*! Raw Sensor Data read out of the OPT2001 light sensor */
    uint8_t btnRawData;
}
Smsgs_btnField_t;

Sensor message sent from sensor node to collector node
    /*!
     Configuration Settings field - valid only if
     Smsgs_dataFields_configSettings is set in frameControl.
     */
    Smsgs_configSettingsField_t configSettings;
    
    /*!btn data */
    Smsgs_btnField_t btnData;
} Smsgs_sensorMsg_t;

 

 

Then in sensor.c added Following things

 

 

extern volatile uint8_t btnData_val;

/*!
 btn Data field - valid only if Smsgs_dataFields_humiditySensor
 is set in frameControl.
 */
STATIC Smsgs_btnField_t btnData =
    { 0 };
    

Add btnData into FieldControl field 

 configSettings.frameControl |= Smsgs_dataFields_btnData;

Then in processSensorMsgEvt()
if(sensor.frameControl & Smsgs_dataFields_btnData)
    {
       memcpy(&sensor.btnData, &btnData,
              sizeof(Smsgs_btnField_t));
    }

Build and send sensor message
sendSensorMessage()
 if(pMsg->frameControl & Smsgs_dataFields_btnData)
    {
        len += SMSGS_BTN_MSG_LEN; 
    }

if(pMsg->frameControl & Smsgs_dataFields_btnData)
        {
            pBuf = pMsg->btnData.btnRawData;
        }

validateFrameControl()
if(frameControl & Smsgs_dataFields_btnData)
    {
       newFrameControl |= Smsgs_dataFields_btnData;
    }

and 
/*!
 * @brief   Manually read the sensors
 */
static void readSensors(void)
{
#if defined(TEMP_SENSOR)
    /* Read the temp sensor values */
    tempSensor.ambienceTemp = Ssf_readTempSensor();
    tempSensor.objectTemp =  tempSensor.ambienceTemp;
#endif
    btnData.btnRawData = btnData_val;
}

 

 

Then in ssf.c we will read the btnData and update it.

 

volatile uint8_t btnData_val = 0;
void Ssf_processEvents(void)
{
    /* Did a key press occur? */
    if(events & KEY_EVENT)
    {
        /* Left key press is a PAN disassociation request, if the device has started. */
       // if((keys & KEY_LEFT) && (started == true))
       if((keys & KEY_LEFT))
        {
            btnData_val ^= btnData_val;
#if 0
#ifdef FEATURE_UBLE
            if (advertisementType != BleAdv_AdertiserMs)
            {
                /* Send disassociation request */
                Jdllc_sendDisassociationRequest();
            }
#else
            /* Send disassociation request */
            Jdllc_sendDisassociationRequest();
#endif /* FEATURE_UBLE */
#endif

        }

 

Now on collector side, I tried adding support for btnData and tried running the server and encountered with below error.

 

ERROR: Rcvd Error on the socket connection with AppServer
{ [Error: connect ECONNREFUSED 127.0.0.1:5001]
  code: 'ECONNREFUSED',
  errno: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 5001 }
ERROR: Rcvd Error on the socket connection with AppServer
{ [Error: connect ECONNREFUSED 127.0.0.1:5001]
  code: 'ECONNREFUSED',
  errno: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 5001 }
ERROR: Rcvd Error on the socket connection with AppServer
{ [Error: connect ECONNREFUSED 127.0.0.1:5001]
  code: 'ECONNREFUSED',
  errno: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 5001 }

 

Some application seems to be was accessing the socket already hence the error. I tried rebooting after which the Sensor to Cloud web application seems to be broken. Hence, right now I am trying to build TI’s collector Sensor To Cloud application on Linux host machine, will update soon on same.

 

 

Conclusion:

  1. The demo is easy to setup, though in my kit mac coprocessor modules Firmware was corrupted.
  2. Since this is based on CC1350, it is best suitable for low power battery operated sensor nodes such as door sensors, window sensors, temperature sensors, etc. enabling truly wireless connectivity.
  3. The use of BBB as gateway enables integration with many cloud services such as AWS, IBM cloud, then home kit services etc. Although I prefer they should have shipped it with Debian operating system.
  4. TI has provided detailed information in README files in project files or on their wiki page which helps a developer to quickly add a new sensor in their framework. Having mqtt out of the box would have been much easier for developers without node js background. It would also enable a whole lot of new application integrations such as open source Home assistant project, which I was planning to.

 

I will be updating the thread still since its work in progress.

 

 

Regards,

Shrenik

Anonymous