Skip to content

Hardware_BLE Nano

Elias Issa edited this page Jun 8, 2018 · 1 revision

The RedBearLab BLE Nano's strength is its small size and relative ease of programming using the ARM mbed API. However, working with the Nano can be a little more involved than an arduino for example. Here are a few tips to help get off the ground quickly.

-You'll want to get the MK20 USB dongle which can be used to program the Nano.

-The mbed API is web-based and is a relatively easy way to program for the Nano. Browse their code library to see some examples. https://developer.mbed.org/ & https://developer.mbed.org/compiler

-The nano board doesn't break out all of the pins on the Nordic nRF51822 chip (see the Nordic nRF52 development kit for a larger board with more options). This leaves you with a few digital lines to work with on the standard board. Although D2,D1,D0,D3 appear to be available in the schematic, these are reserved for serial communication in the mbed pin specification. All that is left to use are D4,D5,D6,D7, and you'll see that these are flat gold contacts making them harder to attach to than regular headers. You'll probably just want to solder on your own row of header pins to thes 5 contacts.

-Serial port monitoring is your best way to test your code. On a mac, for example, open up terminal, search your ports, and open up a screen monitoring the appropriate one:
ls /dev/tty.*
will return something like --> /dev/tty.Bluetooth-Incoming-Port
/dev/tty.usbmodem1412

then type:
screen /dev/tty.usbmodem1412

-The Arduino serial monitor is an even easier way to observe the serial output on your ble nano

-Another handy tool for debugging is an app for communicating with the ble device using your phone or other device. The Light Blue Explorer LE works on iOS and lets you view the services and characteristics as well as read and write values.

-Finally, a bit of a quirk is that P0_19 (D13) which connects to the status LED operates in reverse logic (1 is low, 0 is high) whereas other pins P0_28 (D4) have the opposite logic.

-Once your nano is programmed, you can interact with it from the browser using Chrome 52+. Enable web bluetooth in chrome://flags, and you should be ready to go. See these examples or check out mkturkble.js in this repository for example javascript code using the chrome bluetooth api.