Wednesday, March 30, 2016

Programming RedBearLab's BLE Nano using Arduino IDE

I received an opportunity to put my hands on a Bluetooth Low Energy (BLE) chip. The exact setup was a BLE Nano V1.5 module with a MK20 USB V1.0 programmer module (link: http://redbearlab.com/blenano/). With this setup, we can program it an try some sample applications. Since the modules are shipped with the header pins unsoldered, we have to first solder the header pins properly. Then we get the setup as can be seen from the figure shown. There we have the BLE Nano module and the MK20 programmer module plugged in together and connected to the computer using a USB cable.

Following are the steps I followed to program the module using an Arduino IDE. The exact Arduino version I had was 1.6.5 on Ubuntu Linux 14.04.

(1) First of all, we need to put some bootloader hex file into the board in order to make it programmable using Arduino IDE. For this purpose, plug-in the setup to the USB port so that you can access the flash storage of the board which comes up with the name MBED. Download the bootloader.hex file from this link and copy it into this MBED directory.

(2) Open the Arduino IDE and goto the Preferences from the File menu. In the field where you have to enter Additional Boards Manager URLs, add the following line.

https://redbearlab.github.io/arduino/package_redbearlab_index.json

Then click OK on the correct places and get back.

(3) Now go to the menu Tools->Board:->Boards Manager... and there you get a window with a text field as a search bar. Search for the RedBearLabs nRF51822 Boards library and install it.

(4) Now, from the Tools menu again, select the correct board "BLE Nano (v1.5 32KB)".

(5) Plug in the BLE Nano module with the programmer board to the USB port and check the name of the device as it was mounted to /dev. In my case, it was detected as /dev/ttyACM0. So, provide permission for the device as follows from the terminal.

sudo chmod 777 /dev/ttyACM0

(6) Time to run a sample program. Open the blink program from the Examples menu and upload it to the board. We should be able to see the LED on the BLE Nano board blinking.

There are many other examples provided related to BLE which I'm hoping to try later.

References:

[1] https://www.youtube.com/watch?v=d75strWav5k&feature=youtu.be
[2] https://github.com/RedBearLab/nRF51822-Arduino

No comments:

Post a Comment