HowTo: change service UUIDs using BlendMicro

HowTo: change service UUIDs using BlendMicro

For the Body Sensor project, I needed to change the default service UUID that a BlendMicro board was advertising. If you are here, it probably means you also want to get this done. I hope you will find this tutorial useful.

The Bluetooth Low Energy(BLE) connection will be established between an Intel Edison board  (central device) and a BlendMicro peripheral. 

  1. First things first! Install the required software:

    On the BlendMicro side you will need :

               Install the Arduino IDE.

               Extract your downloads and copy the Hardware folder from the Add-On package in                    your Arduino folder.

               Copy the BLE folder from the nRF8001 SDK in the Libraries folder.

               Do the same for the nRF8001 Library.

               In the end your folders should look like this:

               hw

                libs

           For programming the Intel Edison I am using:

            Make sure you have Bluetooth working on your Edison. You may find the new Bluetooth Guide from Intel useful.

     2. Edison code

         Now that we have all the tools, we can proceed with writing the code for the Edison.Our aim is to discover the BlendMicro and to printout the advertising service UUID.  

  

var noble = require('noble');
var devices = new Array();

noble.startScanning();
console.log('Try to find BLE devices...');

noble.on('discover', function (peripheral) {
    peripheral.connect(function (error) {
        if (error) {
            console.log(error);
        } else {
            devices.push(peripheral);
        }
    });
    console.log(peripheral.advertisement.localName);
    console.log(peripheral.address);

});

setTimeout(function () {
    console.log("Stop discovery \n");
    noble.stopScanning();
    reportDevices(devices);
}, 10000);

var reportDevices = function (listOfDevices) {
    for (var idx in listOfDevices) {
        console.log(' ' + idx + ' uuid: ' + listOfDevices[idx].advertisement.localName);
        console.log("\tLE: " + listOfDevices[idx]);
        console.log('\tConnected to peripheral: ' + listOfDevices[idx].uuid);
                }
}   
 

         Next, we load the "SimpleChat" example from the RBL_nRF8001 library on the BlendMicro.

         simplechat

         When running the code on the Edison, we can see that by default the BlendMicro advertises service 180b.

UUID1

     3. Using nRFgo Studio

  • Load your RBL_nRF8001.xml file (under C:\Users\uc-office\Documents\Arduino\libraries\RBL_nRF8001) into the nRFgo. 

      nrfgo1 

         Check what service is being advertised. You will find this information in the GAP Settings tab, under Service Solicitation and Local Services.

        nrfgo3          

    • Change UUID base from 180b to 180a,  click OK and go to File -> Save

           nrfgo4

                                     Now your .xml file is updated.

    • Generate the files used by RBL_nRF8001 library. Select the same destination folder where RBL_nRF8001.xml file is found.

             nRfgo6

         The following files will be generated:

            nrfgogenerated

 

 

    • Rename services.h to RBL_services.h and save the old one under a different name

            nrfgorename2

    • Upload the SimpleChat example again and when finished, RESET the BlendMicro board (!!! Don’t forget this step)

          Now the service UUID should be updated to 180a:

UUID2

           Thanks for reading!

Continue reading
Rate this blog entry:
1
7888 Hits 0 Comments