Thursday, March 6, 2014

Wireless Sensor Data Collection with BTLE

Bluetooth Low Energy protocol, also known as Bluetooth 4.0 or Bluetooth Smart, is a hot topic right now. At Ixonos, we have been working with it for a while and one of the examples is the addition of Texas Instruments SensorTag support to our libsensact library.

TI SensorTag is a small Bluetooth Low Energy device, which has 6 different sensors and runs on a coin cell battery with very small current consumption.

The applications, which use libsensact, are able to set TI SensorTag as one of the sensors where to connect and read the sensor data from it.

The code for connection to TI SensorTag is similar to the code needed for USB sensors in the earlier example. The difference is that you need to define the BTLE addresses of the devices instead of USB ids:


/* List of supported sensor/actuator devices */

struct ble_sensortag_config_t ble_sensortag0_config =
{
      .ble_address = "BC:6A:29:C3:3C:79",
};

struct ble_sensortag_config_t ble_sensortag1_config =
{
      .ble_address = "BC:6A:29:AB:41:36",
};

struct sa_device_t devices[] =
{
   {  .name = "ble_sensortag0",
      .description = "TI sensortag 0",
      .backend = "ble_sensortag",
      .config = &ble_sensortag0_config },

   {  .name = "ble_sensortag1",
      .description = "TI sensortag 1",
      .backend = "ble_sensortag",
      .config = &ble_sensortag1_config },

   { }
};

int main(void)
{
    int sensortag0;
    /* … */
    sensortag0 = sa_connect("ble_sensortag0");
    /* … */
}
 
The video shows the code and TI SensorTag in action on our HTML5 demonstrator prototype.



Now that the basic BTLE -support is in place we have an easy solution for bringing wireless sensors within our sensor framework. Adding support for new BTLE sensors is pretty straightforward with our scalable architecture.

Stay tuned for further updates as we are combining this and other components into the Ixonos Human Machine Interface -solution to be launched in near future!

Tero Koskinen, Senior SW Designer - Ixonos
Petteri Tikander, Senior SW Designer - Ixonos
 

No comments:

Post a Comment