Install Bluefruit Micro board support

Chances are you want to jump right in and start programming the Bluefruit Micro! The fastest/easiest way to do that is to use the Arduino IDE. You'll need v1.6.4 or greater, which has a Board Manager support.

Check out that guide first, to add Adafruit Boards support!

OK now that you are back, launch the IDE and select Bluefruit Micro from the Boards menu

Ubuntu & Linux Issue Fix

Note if you're using Ubuntu 15.04 (or perhaps other more recent Linux distributions) there is an issue with the modem manager service which causes the Bluefruit LE micro to be difficult to program.  If you run into errors like "device or resource busy", "bad file descriptor", or "port is busy" when attempting to program then you are hitting this issue.

The fix for this issue is to make sure Adafruit's custom udev rules are applied to your system.  One of these rules is made to configure modem manager not to touch the Bluefruit Micro board and will fix the programming difficulty issue.  Follow the steps for installing Adafruit's udev rules on this page.

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:
http://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use

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

// SHARED SPI SETTINGS
// ----------------------------------------------------------------------------------------------
// 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 the last line to:

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

(The Bluefruit Micro 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 */
Adafruit_BluefruitLE_SPI ble(BLUEFRUIT_SPI_CS, BLUEFRUIT_SPI_IRQ, BLUEFRUIT_SPI_RST);

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

OK now you can upload to the Bluefruit Micro!
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 section above.

Uploading to the Bluefruit Micro

It's pretty easy to upload, first up make sure you have Bluefruit Micro selected on the boards dropdown as above. 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

Uploading to a brand new board/Upload failures

If you are uploading for the first time to a new board, or if upload fails, pres the RESET mini button on the Bluefruit Micro when you see the Yellow Arrow lit and the Uploading... text in the status bar. When you see the red LED pulsing on and off, you know the bootloader is running.

Don't click the reset button before uploading, unlike other bootloaders you want this one to run at the time Arduino is trying to 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 Bluefruit Micro. 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 that

/* ...hardware SPI, using SCK/MOSI/MISO hardware SPI pins and then user selected CS/IRQ/RST */
Adafruit_BluefruitLE_SPI ble(BLUEFRUIT_SPI_CS, BLUEFRUIT_SPI_IRQ, BLUEFRUIT_SPI_RST);

Is uncommented

This guide was first published on Aug 07, 2015. It was last updated on Nov 10, 2014.

This page (Using with Arduino IDE) was last updated on Aug 07, 2015.

Text editor powered by tinymce.