IoT: Intel Edison as Bluetooth Low Energy (BLE) peripheral

Intel Edison is one of the best IoT hardware suitable for rapid prototyping. If you are new to IoT world, you can easily setup a simple demo app by using Intel® Edison Kit for Arduino* Box (shown in the picture below).

This setup is specifically to create Bluetooth Low Energy (BLE) peripheral with the Intel Edison board.

1. Intel Edison Setup

For a new board set up you can follow the step by step instructions given here: https://software.intel.com/en-us/assembling-intel-edison-board-with-arduino-expansion-board

One of the issue I faced with this set up is that, when used the board with USB power mode I had trouble connecting to the box. So its advisable to use a standalone power adapter to avoid intermittent connectivity issues.

Some times the Windows 7 will not let you manual/auto install a new build through the USB interface. So you could switch to MAC OS in order to complete the installation process, and then switch to windows if you prefer to. Make sure that the PC is updated with recommended device drivers. If there are still connectivity issues through USB interface, try connecting using a serial terminal: https://software.intel.com/en-us/setting-up-serial-terminal-on-system-with-windows.

If you have trouble connecting through the USB interface, you must enable the wifi on the board in order to SSH to the box for code deployment - https://software.intel.com/en-us/connecting-your-intel-edison-board-using-wifi.

2. Enable BLE

Within an SSH or serial terminal connection, type the following commands:
    rfkill unblock bluetooth
    hciconfig hci0 up
Enter the following command to open the base-feeds.conf file in the vi text editor:
    vi /etc/opkg/base-feeds.conf 
Insert the following lines into base-feeds.conf:
    src/gz all http://repo.opkg.net/edison/repo/all
    src/gz edison http://repo.opkg.net/edison/repo/edison
    src/gz core2-32 http://repo.opkg.net/edison/repo/core2-32
     
Save your changes and exit the editor. For more information on the vi editor, visit http://www.cs.colostate.edu/helpdocs/vi.html.
To get the bleno Node.js package to work successfully, enter  the following commands:
    rfkill unblock bluetooth
    killall bluetoothd
    hciconfig hci0 up 

For more info: https://software.intel.com/en-us/creating-a-bluetooth-low-energy-app

3. Create IoT BLE Perfipheral App

Now you are ready to create your own BLE app on the board. I prefer to use the Intel XDK editor on the box. Note that this did NOT work great for me when creating BLE app for the mobiles.

Once you have the editor available, follow the step by step process to create a NodeJS based BLE peripheral app and deploy this to the board using the IDE.

4. Create Mobile BLE app to communicate

You could either create the cordova/phonegap based BLE apps for the mobile apps to communicate with the peripheral app, or create native apps. The simulator/viewer comes with XDK or Evothings studio doesn't work great on the mobile devices yet. So I prefer to use swift for iOS to create my mobile app.

I've uploaded a swift version of  the code that scans the BLE devices and logs the Services and Characteristics info here: https://github.com/hmanikkothu/BLE-Test. You may extend this to build your own as necessary.



Comments

Popular posts from this blog

SCTE35 Parser

Dijkstra's Algorithm in JavaScript