In case you missed it, in a previous article we introduced Systems on a Chip (SoCs), modules and development kits for Bluetooth Low Energy. Today we will focus on a hardware development kits solely, more precisely, on one we have used extensively for the past months.

BLE Nano & MK20 USB Board

Crafted by RedBearLabs, this is a very nice development board for getting your hands dirty and start developing your first Bluetooth Low Energy applications. At a reasonable price tag ($32.90 at SeeedStudio) you will get in fact two boards:

  • A BLE Nano board, based on the Nordic nRF51822 SoC and measuring only 18.5mm x 21.0mm. The nRF51822 SoC sports an ARM Cortex-M0 processor running at 16MHz, with 256KB Flash and 16KB RAM, plus a full Bluetooth Low Energy coprocessor.
  • A small USB dongle, based on a Freescale MK20, which will allow you to power and program the BLE Nano board. It also provides a virtual COM over USB to allow your BLE module communicate with the host computer, very useful for logging debug, info and error messages.

The BLE Nano board breaks out 11 GPIO ports, although you will likely dedicate two/four of them for the UART, to communicate with the virtual serial port over USB. Two pins (RTX/TXD) are used for simple UART communication (without hardware flow control). Four pins if you use RTS/CTS (Ready to Send/Clear to Send). If you are developing with mbed, beware that the default UART library (class Serial) will take up the four pins above.

Pinout of the BLE Nano board:
Pinout of the BLE Nano board

Pinout of the MK20 USB dongle:
Pinout of the MK20 USB dongle

RedBearLab has put considerable effort into this kit, allowing it to be programmed with mbed, GCC, Keil, IAR or Arduino.

RedBearLab did not design from scratch the RF part of the printed circuit board. Instead (as we recommend in this previous post), they mount the MDBT40 Bluetooth Low Energy module from Raytac Corporation. This is a very nice and small, "ready to embed", shielded module. And it is FCC/CE certified!

Raytac MDBT40 BLE module

Libraries provided by Nordic

Due to the complexity of the Bluetooth Low Energy 4.0/4.1 protocol, Nordic provides a Software Development Kit (SDK) with a linkable library named SoftDevice which implements the whole stack. At the time of this writing, the latest SDK available is 8.1.0.

More precisely, you can choose amog three different SoftDevices for developing your BLE application, depending on your exact requirements:

  • S110 (stable), supporting the Peripheral and Broadcaster roles only.
  • S120 (stable), supporting the Central and Observer roles only, up to eigth simultaneous connections.
  • S130, supporting simultaneous multiple links and Peripheral, Broadcaster, Central and Observer roles.

Note that you only need to download the SDK above if you plan to work directly with a "traditional" compiler such as GCC/Keil/IAR. You may not need to know about SoftDevices if working with mbed or Arduino, however, be aware that these are the real implementations of the Bluetooth protocol stack working under the hood.


The mbed platform is a free C/C++ compiler and IDE provided by ARM and suitable for programming most ARM microcontrollers. The IDE is Web based, something which may back some of us down. I was myself skeptical about the practicality of such IDE compilers, however I must say the mbed compiler has proven to be easy to use, fast and (reasonably) friendly, even for a C/C++ compiler.

The many available platform libraries are easy to use and well designed, specially for starters, resembling (vaguely) the simplicity you may have enjoyed when using Arduino libraries. Also, mbed encourages and eases sharing with others your own libraries, or any piece/snippet of code. You have to register a username in the platform from the very beginning, that will allow you to store your projects online, comment, share code and participate in the community forums comfortably. Compiling and programming your projects is really easy. You can literally have the blink test application running in a few minutes.

mbed has a dedicated team which develops and maintains a very nice Bluetooth Low Energy API. You can rest assured that using this API for learning to develop BLE appcessories will be much easier (and faster) than trying to do so by using directly the BLE libraries (SoftDevice) provided by Nordic. The BLE API includes also several application examples.

On the not-so-positive side of mbed pltform, you have zero control over the compiler/linker. This has proven to be a showstopper for our own BLE development. At the time of this writing, within mbed you are only allowed to develop BLE applications for the nRF51822 along with the S110 SoftDevice, which only supports peripheral mode. Hence, you can quickly start to develop applications with mbed which only require the Peripheral Role. But if you want to develop an application requiring the Central Role, you will have to switch to a full-fledged GCC (or Keil or IAR) C/C++ compiler.

GCC or Keil or IAR compiler

If you want to take advantage of the full nRF51822 Nordic BLE SDK, you have to install your favorite command-line compiling tools.

We prefer GNU Tools for ARM Embedded Processors (in short, GCC for ARM), because it is open and free, but also because it is a sofisticated and mature compiler supported by both ARM and Nordic. It is the compiler of choice by many top-notch tech companies. For the beginner, there are many embedded development online communities which can be of great help in case of trouble.

How to install and correctly configure a full-fledged tools chain around GCC is a topic on its own. In fact, our next article will be dedicated to it. For now, let me summarize the inventory of tools we are using:

  • Nordic nRF51 Software Development Kit.
  • GCC for ARM embedded Processors.
  • GNU Make Utility (in case you are running Windows).
  • GnuWin32 Core Utility (in case you are running Windows).
  • Nordic nRF-tools (in case you are running Windows).
  • Segger J-Link Debug Probe and software utilities, for flashing (programming) your BLE module and debugging it with some limitations.
  • Eclipse IDE for C/C++ Developers Kepler version.

Before rushing to purchase your Segger J-Link Debug Probe, note that step-by-step debugging is limited on any real-time application. In our case, the Bluetooth protocol stack is obliged to react to RF events very quickly, within microseconds. What that means is that you cannot simply stop or step-by-step execute a piece of code without "breaking" the BLE stack. However, not everything is lost, you can do a little bit of step-by-step debugging, inspect variables and check if a section of your code is entered (with breakpoints), write logs through UART or J-link... Stay tuned to our next post.

Arduino Library for nRF51822

RedBearLab have developed an Arduino library for nRF51822 which you can install as an add-on to the Arduino IDE. It is based on the SoftDevice S110, so it will only allow you to develop with the Peripheral and Broadcaster roles. They have also created a special bootloader that allows to program BLE Nano from the Arduino IDE as if it was an Arduino board. More information can be found below, under the references section.

The library includes multiple sample projects like a Heart Rate Monitor emulator, an iBeacon, a "wireless" UART connection between the BLE Nano and a central device (which can be an iOS/Android phone) and others. The examples are standard Arduino sketches easy to understand and modify with the well-known setup and loop methods.

Useful links and references

To know more, you can find below a list of related resources:

If you liked this content and don't want to miss future articles, you can subscribe to our mailing list and get notified!

About the Author