Where to add UUIDs in Arduino BLE example

Ask, and ye shall receive.
artlover5781
Posts: 9
Joined: 22:19, 28 Jan 2015

Where to add UUIDs in Arduino BLE example

Postby artlover5781 » 17:53, 03 Mar 2015

Hello All,

I am trying to use my peripheral with the arduino ble example. I am using a tinyduino microcontroller with the BLE shield.

I have changed the example to my peripheral name like so in the app.js:

Code: Select all

startScan: function()
   {
      console.log('Scanning...');
      evothings.ble.startScan(
         function(deviceInfo)
         {
            if (app.knownDevices[deviceInfo.address])
            {
               return;
            }
            console.log('found device: ' + deviceInfo.name);
            app.knownDevices[deviceInfo.address] = deviceInfo;
            if (deviceInfo.name == 'BGLib U1A1P 38.4NF' && !app.connectee)
            {
               console.log('Found arduinoble');
               connectee = deviceInfo;
               app.connect(deviceInfo.address);
            }
         },
         function(errorCode)
         {
            console.log('startScan error: ' + errorCode);
         });
   },



after doing so i attempted to connect to the peripheral using the evothing ide and the log outputs:


Scanning...
LOG: found device: BGLib U1A1P 38.4NF
LOG: Found arduinoble
LOG: Connecting...
LOG: Connected
LOG: Reading services...
LOG: ERROR: RX/TX services not found!


I do not know why the rx/tx services are not working.

My uuids are as follows:


BLUEGIGA_SERVICE_UUID "195A*********************************************"
BLUEGIGA_CHAR_TX_UUID "2181*********************************************""
BLUEGIGA_CHAR_RX_UUID "5FC5*********************************************""

in the app.js I am unaware of where to put these UUIDS after reading i did it this way but i have had not luck getting it to work:



Code: Select all

getServices: function(deviceHandle)
   {
      console.log('Reading services...');

      evothings.ble.readAllServiceData(deviceHandle, function(services)
      {
         // Find handles for characteristics and descriptor needed.
         for (var si in services)
         {
            var service = services[si];

            for (var ci in service.characteristics)
            {
               var characteristic = service.characteristics[ci];

               if (characteristic.uuid == '2181****************************')
               {
                  app.characteristicRead = characteristic.handle;
               }
               else if (characteristic.uuid == '5FC5****************************')
               {
                  app.characteristicWrite = characteristic.handle;
               }

               for (var di in characteristic.descriptors)
               {
                  var descriptor = characteristic.descriptors[di];

                  if (characteristic.uuid == '2181****************************' &&
                     descriptor.uuid == '5FC5****************************')
                  {
                     app.descriptorNotification = descriptor.handle;
                  }
               }
            }
         }

         if (app.characteristicRead && app.characteristicWrite && app.descriptorNotification)
         {
            console.log('RX/TX services found.');
            app.startReading(deviceHandle);
         }
         else
         {
            console.log('ERROR: RX/TX services not found!');
         }
      },







I am not sure where to retrieve the descriptor UUID
I would really appreciate the help.


Anyone?

User avatar
micke
Posts: 256
Joined: 20:49, 18 Nov 2013

Re: Where to add UUIDs in Arduino BLE example

Postby micke » 15:29, 15 Mar 2015

Hi, sorry for slow reply.

I think the upper/lower case of the letters in hex numbers are important for the UUIDs. Of perhaps this case been fixed in the library, I am not sure.

You can check the actual UUIDs sent from the device by for example logging them in the Tools window of the Workbench. Here is an example you can test:

https://github.com/divineprog/evo-demos ... syble-demo

Could some of the other Arduino BLE examples be of any help?

Here is an experimental example that might be of help:

https://github.com/divineprog/evo-demos ... ptable-ble

Regards, Mikael

artlover5781
Posts: 9
Joined: 22:19, 28 Jan 2015

Re: Where to add UUIDs in Arduino BLE example

Postby artlover5781 » 17:40, 15 Mar 2015

Hello Micke,


Thank you for your reply, I used the Easyble Demo this is how i did it:

- Downloaded the example via github
- added it to examples folder in evothings app folder
- dragged the index.html file into the evothings workbench
- open index.html and add myDeviceName
- run application

The app is displaying on my mobile while i am connected to the workbench tools but how would i retrieve the descriptor UUID?

artlover5781
Posts: 9
Joined: 22:19, 28 Jan 2015

Re: Where to add UUIDs in Arduino BLE example

Postby artlover5781 » 14:47, 18 Mar 2015

Does anyone know how I would retrieve the descriptor UUID?

User avatar
micke
Posts: 256
Joined: 20:49, 18 Nov 2013

Re: Where to add UUIDs in Arduino BLE example

Postby micke » 22:08, 18 Mar 2015

Hi, did it work for you to run this example?

https://github.com/divineprog/evo-demos ... syble-demo

It lists all services, characteristics and descriptors in the Workbench Tools window. You need to add the BLE name of your devices for it to be picked up by editing the code. There are some instructions displayed on the screen when you run the app and in the code in index.html.

It is also helpful if you have documentation available. Which BLE shield are you using?

Not sure about which descriptor you wish to access?

Best, Micke

artlover5781
Posts: 9
Joined: 22:19, 28 Jan 2015

Re: Where to add UUIDs in Arduino BLE example

Postby artlover5781 » 15:51, 19 Mar 2015

Hello Micke,


I am looking to transmit sensor data over ble using a tinyduino and a tinyduino ble shield which uses a bluegiga112 chip. I have formatted the tinyduino using this example https://tunjid.wordpress.com/2014/09/05/a-simple-gatt-server-part-2/

I have used the easy ble demo, in the tools section it gives me this information:

LOG: Device found: BGLib U1A1P 38.4NF rssi: -41

I am looking for the descriptor UUID found in the arduino ble example. I would like to edited so it shows the information from an accelerometer on my tinyduino with a Bluegiga 112 shield found https://tiny-circuits.com/tiny-shield-bluetooth-low-energy.html

here is the section of code which asks for my UUIDs in the arduio ble example:


Code: Select all

getServices: function(deviceHandle)
   {
      console.log('Reading services...');

      evothings.ble.readAllServiceData(deviceHandle, function(services)
      {
         // Find handles for characteristics and descriptor needed.
         for (var si in services)
         {
            var service = services[si];

            for (var ci in service.characteristics)
            {
               var characteristic = service.characteristics[ci];

               if (characteristic.uuid == '2181****************************')
               {
                  app.characteristicRead = characteristic.handle;
               }
               else if (characteristic.uuid == '5FC5****************************')
               {
                  app.characteristicWrite = characteristic.handle;
               }

               for (var di in characteristic.descriptors)
               {
                  var descriptor = characteristic.descriptors[di];

                  if (characteristic.uuid == '2181****************************' &&
                    [color=#FF0000] descriptor.uuid == '5FC5****************************')[/color]
                  {
                     app.descriptorNotification = descriptor.handle;
                  }
               }
            }
         }

         if (app.characteristicRead && app.characteristicWrite && app.descriptorNotification)
         {
            console.log('RX/TX services found.');
            app.startReading(deviceHandle);
         }
         else
         {
            console.log('ERROR: RX/TX services not found!');
         }
      },


I have highlighted the text red where is says descriptor.uuid this is what i would like to retrieve some how. I do not know which UUIDs go into their respective place.

artlover5781
Posts: 9
Joined: 22:19, 28 Jan 2015

Re: Where to add UUIDs in Arduino BLE example

Postby artlover5781 » 17:52, 24 Mar 2015

Any idea Micke?

User avatar
micke
Posts: 256
Joined: 20:49, 18 Nov 2013

Re: Where to add UUIDs in Arduino BLE example

Postby micke » 12:19, 08 Apr 2015

Hi, I have not used the tinyduino/bluegiga and I am not of much help as it seems.

Anyone else on the forum who knows this and can help?

Regards, Micke

Thea
Posts: 3
Joined: 10:19, 17 May 2015

Re: Where to add UUIDs in Arduino BLE example

Postby Thea » 11:25, 23 Jun 2015

I have a similar Problem.
I m also using the Bluegiga BLE (TinyDuino) and I found out some UUIDS (with the nRFmaster (Android) App).
But i m not sure which UUIDs I should use.
In the Arduino BLE example there is the characteristic.uuid (read) in line 229, the characteristic.uuid (write) in 233 and the descriptor.uuid in 244.

The available UUIDs are shown in the attached picture. Which UUID should i use for which of the 3 cases above?

I guessed that the 1, 2 and 3 are the right ones. But i m also only coming up to "ERROR: RX/TX services not found!" in the evothings log!

Thank you!
Attachments
nRFBLE-App.png
nRFBLE-App.png (93.92 KiB) Viewed 20161 times


Return to “Questions and answers”

Who is online

Users browsing this forum: No registered users and 4 guests