Install the Adafruit nRF51 BLE Library

In order to try out our demos, you'll need to download the Adafruit BLE library for the nRF51 based modules such as this one (a.k.a. Adafruit_BluefruitLE_nRF51)

You can check out the code here at github, but its likely easier to just download by clicking:

Rename the uncompressed folder Adafruit_BluefruitLE_nRF51 and check that the Adafruit_BluefruitLE_nRF51 folder contains Adafruit_BLE.cpp and Adafruit_BLE.h (as well as a bunch of other files)

Place the Adafruit_BluefruitLE_nRF51 library folder your arduinosketchfolder/libraries/ folder.
You may need to create the libraries subfolder if its your first library. Restart the IDE.

We also have a great tutorial on Arduino library installation at:

After restarting, check that you see the library folder with examples:

Run first example

Lets begin with the beginner project, which we can use to do basic tests. To open the ATCommand sketch, click on the File > Examples > Adafruit_BluefruitLE_nRF51 folder in the Arduino IDE and select atcommand:

This will open up a new instance of the example in the IDE, as shown below:

Don't upload the sketch yet! You will have to begin by changing the configuration.

Go to the second tab labeled BluefruitConfig.h and find these lines

// ----------------------------------------------------------------------------------------------
// The following macros declare the pins to use for HW and SW SPI communication.
// SCK, MISO and MOSI should be connected to the HW SPI pins on the Uno when
// using HW SPI.  This should be used with nRF51822 based Bluefruit LE modules
// that use SPI (Bluefruit LE SPI Friend).
// ----------------------------------------------------------------------------------------------
#define BLUEFRUIT_SPI_CS               8
#define BLUEFRUIT_SPI_IRQ              7
#define BLUEFRUIT_SPI_RST              6    // Optional but recommended, set to -1 if unused

And change (if it isnt already) the last line to:

#define BLUEFRUIT_SPI_RST              4   // Optional but recommended, set to -1 if unused

(The Bluefruit Feather has the reset on digital #4 not #6)

Now go back to the main tab atcommand and look for this line of code

    /* ...hardware SPI, using SCK/MOSI/MISO hardware SPI pins and then user selected CS/IRQ/RST */

Make sure that the second line is uncommented (it should be)

OK now you can upload to the Bluefruit Feather!
If you're using Ubuntu 15.04 or other Linux distributions and run into errors attempting to upload a program to the board, scroll up to the Ubuntu and Linux issue fix in the previous section

Uploading to the Feather Bluefruit LE

It's pretty easy to upload, first up make sure you have Adafruit Feather M0 selected on the boards dropdown

Also, in the Ports menu, look for the port labeled as such:

Now click the upload button on the Arduino IDE (or File Menu -> Upload)

If all is good you will see Done Uploading in the status bar

Compilation Issues

If you get an alert that looks like

Cannot run program "{}\bin\arm-non-eabi-g++"

Make sure you have installed the Arduino SAMD boards package, you need both Arduino & Adafruit SAMD board packages

Manually bootloading

If you ever get in a 'weird' spot with the bootloader, or you have uploaded code that crashes and doesn't auto-reboot into the bootloader, click the RST button twice (like a double-click)to get back into the bootloader.

The red LED will pulse, so you know that its in bootloader mode.

Once it is in bootloader mode, you can select the newly created COM/Serial port and re-try uploading.

You may need to go back and reselect the 'normal' USB serial port next time you want to use the normal upload.

Run the sketch

OK check again that the correct port is selected

Then open up the Serial console. You will see the following:

This sketch starts by doing a factory reset, then querying the BLE radio for details. These details will be useful if you are debugging the radio. If you see the information as above, you're working! (Note that the dates and version numbers may vary)

AT command testing

Now you can try out some AT commands - check the rest of the learn guide for a full list. We'll just start with AT+HWGETDIETEMP which will return the approximate ambient temperature of the BLE chipset

OK now you know how to upload/test/communicate with your Feather M0 Bluefruit. Next up we have a bunch of tutorials who can follow for checking out the bluetooth le radio and apps.

For all the following examples, we share the same code between various modules so don't forget to make sure you have the RESET pin set to 4 in BluefruitConfig.h for each sketch before uploading, and that Hardware SPI mode is selected by checking for

/* ...hardware SPI, using SCK/MOSI/MISO hardware SPI pins and then user selected CS/IRQ/RST */

This guide was first published on Jan 13, 2016. It was last updated on Nov 27, 2015.

This page (Installing BLE Library) was last updated on Jan 13, 2016.

Text editor powered by tinymce.