Bluetooth for Internet of Things

Bluetooth (LE) 4.0+ was introduced in 2011 and it is growing day by day. Smart applications can be powered by Bluetooth with its low energy functionality.  Today, many smart devices support Bluetooth LE.  Low energy consumption is mainly advantage of this technology. It comes with Client-Server concept .

CBDevices1_2x

As in picture, Client which may be your smart phone or tablet, wants data from server such as your heart rate controller. So now heart rate controller will generate datas at a certain times every heart beat. In this senario, server(heart beat controller) is advertising when it wants to connent to client and client(phone, tablet, …) is scanning for new devices. “Advertising” may contain data or may not.

Central devices(clients) can connect to many peripherals(smart watch, heartbeat or temperature sensor).

 

Bluetooth terminologies

Services: These functions or capabilities are provided by Bluetooth and non Bluetooth devices, they can be “profiles” or “services” like printing, internet access, etc.

Characteristic: A data value transferred between client and server, for example, the current battery voltage.

Descriptor: Descriptors are optional and each characteristic can have any number of descriptors. Characteristics are defined attribute types that contain a single logical value.

Identifiers: Services, characteristics, and descriptors are collectively referred to as attributes, and identified by UUIDs.
Node.js Libraries

Bleno (Peripheral): https://github.com/sandeepmistry/bleno

Noble (Central): https://github.com/sandeepmistry/noble

 

Intel Edison supports Javascript. Here is link for more detail.

https://software.intel.com/en-us/node-js-templates-for-intel-xdk-iot-edition

 

Sample Javascript Code

var noble = require(‘noble’);

noble.on('stateChange', function(state) {
 if (state === 'poweredOn') {
   noble.startScanning();
 } else {
   noble.stopScanning();
 }
});

noble.on('discover', function(peripheral) {

 peripheral.on('disconnect', function() {
   process.exit(0);
 });

 peripheral.connect(function(error) {
   peripheral.discoverServices([], function(errServices, services) {
     services.forEach(function(service) {
       service.discoverCharacteristics([], function(errCharateristic, characteristics) {
         characteristics.forEach(function(characteristic) {
           characteristic.on("read", function(data, isNotification) {
             console.log(data.toString("utf-8”));
           });
         });
       });
     });
   });
 });

});
 

azmi.cirit.wp

 

6 thoughts on “Bluetooth for Internet of Things

  1. May I simply say what a relief to find someone that genuinely knows what they are talking about
    on the net. You definitely realize how to bring an issue to light
    and make it important. A lot more people must check this out and
    understand this side of the story. I was surprised you’re not more popular since you surely have the gift.

  2. We absolutely love your blog and find most of your post’s
    to be just what I’m looking for. Would you offer guest writers to write content for yourself?
    I wouldn’t mind creating a post or elaborating on many of the
    subjects you write concerning here. Again, awesome website!

  3. I actually have been browsing online more than three hours
    today, yet I never discovered any fascinating article like
    yours. It’s beautiful value sufficient for me personally. Within my
    view, if all website owners and bloggers made excellent content as it is likely you did,
    the net will be a lot more helpful than before.

Comments are closed.