# Adafruit Flora Bluefruit LE

## Overview

https://www.youtube.com/watch?v=vKRa42ZugG0

![](https://cdn-learn.adafruit.com/assets/assets/000/025/363/medium800/adafruit_products_2487_hand_demo_ORIG.jpg?1431372712)

Would you like to add powerful and easy-to-use Bluetooth Low Energy to your wearable FLORA project? Heck yeah! With BLE now included in modern smart phones and tablets, its fun to add wireless connectivity. So what you really need is the new Adafruit Flora Bluefruit LE!

The Flora Bluefruit LE makes it easy to add Bluetooth Low Energy connectivity to your Flora. Sew 4 traces (or solder 4 wires) and BooM! Bluetooth Low Energy!

![](https://cdn-learn.adafruit.com/assets/assets/000/025/368/medium800/adafruit_products_2487_demo_01A_ORIG.jpg?1431373176)

## Get started fast with the Bluefruit App

Using our Bluefruit [iOS App](../../../bluefruit-le-connect-for-ios) or [Android App](https://play.google.com/store/apps/details?id=com.adafruit.bluefruit.le.connect&hl=en), you can quickly get your interactive project prototyped by using your iOS or Android phone/tablet as a controller. We have a [color picker](../../../bluefruit-le-connect-for-ios/controller#color-picker), [quaternion/accelerometer/gyro/magnetometer or location (GPS)](../../../bluefruit-le-connect-for-ios/controller#sensors), and an 8-button [control game pad](../../../bluefruit-le-connect-for-ios/controller#control-pad). After you connect to the Bluefruit, you can send commands wirelessly in under 10 minutes

![](https://cdn-learn.adafruit.com/assets/assets/000/025/362/medium800thumb/adafruit_products_2487_DEMOgif.jpg?1448318102)

For advanced hackers, they'll be very happy to use the standard Nordic UART RX/TX connection profile. In this profile, the Bluefruit acts as a data pipe, that can 'transparently' transmit back and forth from your iOS or Android device. You can use our [iOS App](../../../bluefruit-le-connect-for-ios) or [Android App](https://play.google.com/store/apps/details?id=com.adafruit.bluefruit.le.connect&hl=en), or [write your own to communicate with the UART service](../../../introducing-the-adafruit-bluefruit-le-uart-friend/uart-service).

## You can do a lot more too!&nbsp;

- [The Bluefruit can also act like an HID Keyboard](../../../introducing-the-adafruit-bluefruit-le-uart-friend/hidkeyboard) (for devices that support BLE HID)
- [Can become a BLE Heart Rate Monitor](../../../introducing-the-adafruit-bluefruit-le-uart-friend/heartratemonitor)&nbsp;(a standard profile for BLE) - you just need to add the pulse-detection circuitry
- [Turn it into a UriBeacon](../../../introducing-the-adafruit-bluefruit-le-uart-friend/uribeacon), the Google standard for Bluetooth LE beacons. Just power it and the 'Friend will bleep out a URL to any nearby devices with the UriBeacon app installed.
- [Built in over-the-air bootloading capability so we can keep you updated with the hottest new firmware.](../../../introducing-the-adafruit-bluefruit-le-uart-friend/dfu-updates)&nbsp;Use any Android or iOS device to get updates and install them!

![](https://cdn-learn.adafruit.com/assets/assets/000/025/365/medium800/adafruit_products_2487_quarter_ORIG.jpg?1431372796)

[This is the same module and firmware as our BLE UART Friend](https://www.adafruit.com/products/2479)&nbsp;but in a nice rounded shape, so you can switch between the two and have the same working code. This Bluefruit LE does not have the hardware flow control pins so it is best used with a microcontroller with hardware serial support (like, y'know, the Flora!)

# Adafruit Flora Bluefruit LE

## Pinouts

![](https://cdn-learn.adafruit.com/assets/assets/000/025/366/medium800/adafruit_products_2487_front_standing_ORIG.jpg?1431372908)

# Power Pads

- **3.3V** : This is the power supply for the module, supply with 3.3V power supply input. You can dip down to maybe 2.7V and up to 3.6V or so, but regulated 3.3V is ideal
- **GND** : The common/GND pad for power and logic

# Data Pads

- **TX** - This is the UART Transmit pin&nbsp;_out_ of the breakout (Bluefruit LE --\> Flora RX), it's at 3.3V logic level.
- **RX** - This is the UART Receive pin _into_ the breakout (Flora TX --\> Bluefruit LE) it requires 3.3V logic level.

These 4 pads are in perfect order to connect directly to your Flora!

![](https://cdn-learn.adafruit.com/assets/assets/000/025/369/medium800/adafruit_products_2487_demo_01A_ORIG.jpg?1431373229)

# Other Pads

- **MODE** : Mode Selection. The Bluefruit has two modes, Command and Data. You can keep this pin disconnected, and use the slide switch to select the mode. Or, you can control the mode by setting this pin voltage, it will override the switch setting!&nbsp; High = Command Mode, Low = UART/DATA mode. This pin requires 3.3V logic

![](https://cdn-learn.adafruit.com/assets/assets/000/025/367/medium800/adafruit_products_2487_back_standing_ORIG_01.jpg?1431373077)

# Reverse Side

On the back we also have a few breakouts!

**Opt. 32 KHz:** If you're doing some funky low power work, [we wanted to give you the option of solderin in a 32khz oscillator.](https://www.adafruit.com/product/2211)Our firmware doesn't support it _yet_ but its there!

**SWDCLK** : This is the SWD clock pin, 3v logic - for advanced hackers!

**SWDIO** : This is the SWD data pin, 3v logic - for advanced hackers!

**F.RST:** This is the factory reset pin. When all else fails and you did something to really weird out your module, tie this pad to ground while powering up the module and it will factory reset. You should try the DFU reset method first tho (see that tutorial page)

# Adafruit Flora Bluefruit LE

## Sewing

![](https://cdn-learn.adafruit.com/assets/assets/000/025/432/medium800/adafruit_products_2487_demo_01A_ORIG.jpg?1431444043)

Sewing the Flora BLE to a Flora is very straight-forward: the four required pads line up so just sew those in short straight lines from one module to another. the **MODE** pad is not required for most uses so you can leave that unconnected.

When you power it on, you should see the red LED on the BLE blink a few times and then pause & repeat, so you know that it has power!

# Adafruit Flora Bluefruit LE

## Factory Reset

There are several methods that you can use to perform a factory reset on your Bluefruit LE module if something gets misconfigured, or to delete persistent changes like UriBeacon or advertising payload changes, etc.

# Factory Reset via DFU Button

Once the module is powered up, if you hold the DFU button down for&nbsp; **\>5 seconds** , the blue LED on the module will start&nbsp; blinking and the device will perform a factory reset as soon as you release the DFU button.

![](https://cdn-learn.adafruit.com/assets/assets/000/025/370/medium800thumb/adafruit_products_2487_bluelightactivateGIF.jpg?1448318111)

# FactoryReset Sample Sketch

There is a FactoryReset sample sketch in the Adafruit Bluefruit LE library, which can be access in the&nbsp; **File \> Examples \> Adafruit\_BluefruitLE\_nRF51** folder:

![](https://cdn-learn.adafruit.com/assets/assets/000/025/371/medium800/adafruit_products_BluefruitLE_nrf51_menu.png?1431373421)

Upload this sketch and open the Serial Monitor and it should perform a factory reset for you:

![](https://cdn-learn.adafruit.com/assets/assets/000/025/372/medium800/adafruit_products_Screen_Shot_2015-05-01_at_16.56.17.png?1431373443)

# AT+FACTORYRESET

You can also perform a factory reset by&nbsp;sending the&nbsp; **AT+FACTORYRESET** command to your Bluefruit LE module in your favorite terminal emulator or using the&nbsp;[ATCommand](../../../../introducing-the-adafruit-bluefruit-le-uart-friend/atcommand)&nbsp;example sketch. Make sure its in command mode first, then type in:

```
AT+FACTORYRESET
OK
```

This command will also cause the device to reset.

# Factory Reset via F.RST Test Pad

On the back of the Bluefruit LE UART Friend board there is a test pad that exposes the Factory Reset pin on the modules (marked **F.RST** ). Setting this pad low when the device is powered up will cause a factory reset at startup.

![](https://cdn-learn.adafruit.com/assets/assets/000/025/374/medium800/adafruit_products_2487_back_standing_ORIG_01.jpg?1431373499)

# Adafruit Flora Bluefruit LE

## Firmware Updates

We're constantly working on the Bluefruit LE firmware to add new features, and keep up to date with what customers need and want.

To make sure you stay up to date with those changes, we've included an easy to use over the air updater on all of our nRF51 based Bluefruit LE modules.

# Adafruit Bluefruit LE Connect

Updating your Bluefruit LE device to the latest firmware is as easy as installing [Adafruit's Bluefruit LE Connect application](https://play.google.com/store/apps/details?id=com.adafruit.bluefruit.le.connect)&nbsp;from the Google Play Store. &nbsp;(An updated iOS version with DFU support will be available shortly!)

Any time a firmware update is available, the application will propose to download the latest binaries and take care of all the details of transferring them to your Bluefruit device, as shown in the video below:

https://youtu.be/tLmqMWC7pWY

# Adafruit Flora Bluefruit LE

## Installing Software

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,](https://github.com/adafruit/Adafruit_BluefruitLE_nRF51)&nbsp;but its likely easier to just download by clicking:

[Download Adafruit_BluefruitLE_nRF51](https://github.com/adafruit/Adafruit_BluefruitLE_nRF51/archive/master.zip)
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](http://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use "Link: http://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use")

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

![](https://cdn-learn.adafruit.com/assets/assets/000/025/376/medium800/adafruit_products_libraryinstalled.png?1431373671)

# Adafruit Flora Bluefruit LE

## Example Code

We have tons of examples that will get you going with the Bluefruit, and its really easy! Since we have one library for both wearable and non-wearable Bluefruit's, the example code is the same but may require some minor tweaks to adjust for Flora.

Most importantly, **the flora bluefruit is for use with Hardware Serial only** and does not have flow control pins. Also, **we expect you will not use the mode pad** so you can keep the switch set to CMD and then change into Data mode by sending **+++**.

# Configuring for Flora

For all of the examples, look near the top for a line like this:

```
//#define BLUEFRUIT_HWSERIAL_NAME           Serial1

```

and remove the **//** comment marks. Do the same for:

```
//Adafruit_BluefruitLE_UART ble(BLUEFRUIT_HWSERIAL_NAME, BLUEFRUIT_UART_MODE_PIN);
```

Next, remove the code for the SoftwareSerial type, find these lines and delete them:

```
/* Create the bluefruit object, either software serial... */

SoftwareSerial bluefruitSS = SoftwareSerial(BLUEFRUIT_SWUART_TXD_PIN, BLUEFRUIT_SWUART_RXD_PIN);

Adafruit_BluefruitLE_UART ble(bluefruitSS, BLUEFRUIT_UART_MODE_PIN,
                      BLUEFRUIT_UART_CTS_PIN, BLUEFRUIT_UART_RTS_PIN);
```

Finally, unless you happen to be using the MODE pad, make sure **BLUEFRUIT\_UART\_MODE\_PIN** is set to -1

```
#define BLUEFRUIT_UART_MODE_PIN         -1   // Not used with FLORA
```

Same with RTS and CTS, find these lines and set both to -1

```
#define BLUEFRUIT_UART_CTS_PIN          -1   // Not used with FLORA
#define BLUEFRUIT_UART_RTS_PIN          -1   // Not used with FLORA
```

# Adafruit Flora Bluefruit LE

## ATCommand

The&nbsp; **ATCommand** example allows you to execute AT commands from your sketch, and see the results in the Serial Monitor. &nbsp;This can be useful for debugging, or just testing different commands out to see how they work in the real world. It's a good one to start with!

# Opening the Sketch

To open the ATCommand sketch, click on the&nbsp; **File \> Examples \> Adafruit\_BluefruitLE\_nRF51** folder in the Arduino IDE and select&nbsp; **atcommand** :

![](https://cdn-learn.adafruit.com/assets/assets/000/025/091/medium800/adafruit_products_Screen_Shot_2015-04-30_at_23.10.01.png?1430428297)

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

![](https://cdn-learn.adafruit.com/assets/assets/000/025/475/medium800/adafruit_products_atcomm.png?1431541699)

# Configuration

Check the **Configuration!** page earlier to set up the sketch for Software/Hardware UART or Software/Hardware SPI. The default is hardware SPI

If using software or hardware Serial UART:

- This tutorial does not need to use the MODE pin, **make sure you have the mode switch in CMD mode** if you do not configure & connect a MODE pin
- Don't forget to also **connect the CTS pin on the Bluefruit to ground if you are not using it!** (The Flora has this already done)

# Running the Sketch

Once you upload the sketch to your board (via the arrow-shaped upload icon), and the upload process has finished, open up the Serial Monitor via&nbsp; **Tools \> Serial Monitor** , and make sure that the baud rate in the lower right-hand corner is set to&nbsp; **115200** :

![](https://cdn-learn.adafruit.com/assets/assets/000/025/477/medium800/adafruit_products_atcomman.png?1431542525)

To send an AT command to the Bluefruit LE module, enter the command in the textbox at the top of the Serial Monitor and click the&nbsp; **Send** button:

![](https://cdn-learn.adafruit.com/assets/assets/000/025/096/medium800/adafruit_products_Screen_Shot_2015-04-30_at_23.20.46.png?1430428897)

The response to the AT command will be displayed in the main part of the Serial Monitor.&nbsp;The response from ' **ATI**' is shown below:

![](https://cdn-learn.adafruit.com/assets/assets/000/025/097/medium800/adafruit_products_Screen_Shot_2015-04-30_at_23.22.33.png?1430428968)

You can do pretty much anything at this prompt, with the AT command set. Try **AT+HELP** to get a list of all commands, and try out ones like **AT+HWGETDIETEMP** (get temperature at the nRF51822 die) and **AT+HWRANDOM** (generate a random number)

![](https://cdn-learn.adafruit.com/assets/assets/000/025/478/medium800/adafruit_products_othercomm.png?1431542699)

# Adafruit Flora Bluefruit LE

## BLEUart

The&nbsp; **BLEUart** example sketch allows you to send and receive text data between the Arduino and a connected Bluetooth Low Energy Central device on the other end (such as you mobile phone using the **Adafruit Bluefruit LE Connect** application for [Android](https://play.google.com/store/apps/details?id=com.adafruit.bluefruit.le.connect)&nbsp;or [iOS](https://itunes.apple.com/app/adafruit-bluefruit-le-connect/id830125974?mt=8)&nbsp;in UART mode).

# Opening the Sketch

To open the ATCommand sketch, click on the&nbsp; **File \> Examples \> Adafruit\_BluefruitLE\_nRF51** folder in the Arduino IDE and select **bleuart\_cmdmode** :

![](https://cdn-learn.adafruit.com/assets/assets/000/025/099/medium800/adafruit_products_BluefruitLE_nrf51_menu.png?1430429200)

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

![](https://cdn-learn.adafruit.com/assets/assets/000/025/479/medium800/adafruit_products_uartcmdsketch.png?1431543315)

# Configuration

Check the **Configuration!** page earlier to set up the sketch for Software/Hardware UART or Software/Hardware SPI. The default is hardware SPI

If using software or hardware Serial UART:

- This tutorial does not need to use the MODE pin, **make sure you have the mode switch in CMD mode** if you do not configure & connect a MODE pin
- Don't forget to also **connect the CTS pin on the Bluefruit to ground if you are not using it!** (The Flora has this already done)

# Running the Sketch

Once you upload the sketch to your board (via the arrow-shaped upload icon), and the upload process has finished, open up the Serial Monitor via&nbsp; **Tools \> Serial Monitor** , and make sure that the baud rate in the lower right-hand corner is set to&nbsp; **9600** (if an issue, try 115200):

![](https://cdn-learn.adafruit.com/assets/assets/000/025/480/medium800/adafruit_products_uartconn.png?1431543645)

Once you see the request, use the App to connect to the Bluefruit LE module in **UART** mode so you get the text box on your phone

Any text that you type in the box at the top of the Serial Monitor will be sent to the connected phone, and any data sent from the phone will be displayed in the serial monitor:

![](https://cdn-learn.adafruit.com/assets/assets/000/025/481/medium800/adafruit_products_conn.png?1431543828)

You can see the incoming string here in the Adafruit Bluefruit LE Connect app below (iOS in this case):

![](https://cdn-learn.adafruit.com/assets/assets/000/025/103/medium800/adafruit_products_IMG_0061.png?1430430143)

The response text ('Why hello, Arduino!') can be seen below:

![](https://cdn-learn.adafruit.com/assets/assets/000/025/482/medium800/adafruit_products_rply.png?1431543860)

# Adafruit Flora Bluefruit LE

## Controller

The **Controller** &nbsp;sketch allows you to turn your BLE-enabled iOS or Android device in a hand-held controller or an external data source, taking advantage of the wealth of sensors on your phone or tablet.

You can take accelerometer or quaternion data from your phone, and push it out to your Arduino via BLE, or get the latest GPS co-ordinates for your device without having to purchase (or power!) any external HW.

# Opening the Sketch

To open the Controller&nbsp;sketch, click on the&nbsp; **File \> Examples \> Adafruit\_BluefruitLE\_nRF51** folder in the Arduino IDE and select **controller** :

![](https://cdn-learn.adafruit.com/assets/assets/000/025/487/medium800/adafruit_products_ControllerMenu.jpg?1431547644)

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

![](https://cdn-learn.adafruit.com/assets/assets/000/025/488/medium800/adafruit_products_Screen_Shot_2015-05-13_at_22.07.56.png?1431547696)

# Configuration

Check the Configuration! page earlier to set up the sketch for Software/Hardware UART or Software/Hardware SPI. The default is hardware SPI

**If using software or hardware Serial UART:**

- This tutorial will also be easier to use if you wire up the MODE pin, you can use any pin but our tutorial has pin 12 by default. You can change this to any pin. If you do not set the MODE pin then **make sure you have the mode switch in CMD** mode
- If you are using a Flora or otherwise don't want to wire up the Mode pin, set the BLUEFRUIT\_UART\_MODE\_PIN to -1 in the configuration tab so that the sketch will use the +++ method to switch between Command and Data mode!
- Don't forget to also **connect the CTS pin on the Bluefruit to ground if you are not using it!** (The Flora has this already done)

# Running the Sketch

Once you upload the sketch to your board (via the arrow-shaped upload icon), and the upload process has finished, open up the Serial Monitor via&nbsp; **Tools \> Serial Monitor** , and make sure that the baud rate in the lower right-hand corner is set to&nbsp; **115200** :

![](https://cdn-learn.adafruit.com/assets/assets/000/025/490/medium800/adafruit_products_Screen_Shot_2015-05-13_at_22.20.12.png?1431548426)

# Using Bluefruit LE Connect in Controller Mode

Once the sketch is running you can open Adafruit's Bluefruit LE Connect application (available for [Android](https://play.google.com/store/apps/details?id=com.adafruit.bluefruit.le.connect)&nbsp;or [iOS](https://itunes.apple.com/app/adafruit-bluefruit-le-connect/id830125974?mt=8)) and use the&nbsp; **Controller** application to interact with the sketch. &nbsp;(If you're new to Bluefruit LE Connect, have a look at our [dedicated Bluefruit LE Connect learning guide](../../../../bluefruit-le-connect-for-ios/settings).)

On the welcome screen, select the&nbsp; **Adafruit Bluefruit LE** device from the list of BLE devices in range:

![](https://cdn-learn.adafruit.com/assets/assets/000/025/492/medium800/adafruit_products_BluefruitLEIcon.jpg?1431548912)

Then from the activity list select&nbsp; **Controller** :

![](https://cdn-learn.adafruit.com/assets/assets/000/025/493/medium800/adafruit_products_Activities.jpg?1431548962)

This will bring up a list of data points you can send from your phone or tablet to your Bluefruit LE module, by enabling or disabling the appropriate sensor(s).

# Streaming Sensor Data

You can take Quaternion (absolute orientation), Accelerometer, Gyroscope, Magnetometer or GPS Location data from your phone and send it directly to your Arduino from the Controller activity.

By enabling the&nbsp; **Accelerometer** field, for example, you should see accelerometer data update in the app:

![](https://cdn-learn.adafruit.com/assets/assets/000/025/494/medium800/adafruit_products_Accelerometer.jpg?1431549087)

The data is parsed in the example sketch and output to the Serial Monitor as follows:

```
Accel	0.20	-0.51	-0.76
Accel	0.22	-0.50	-0.83
Accel	0.25	-0.51	-0.83
Accel	0.21	-0.47	-0.76
Accel	0.27	-0.48	-0.82
```

![](https://cdn-learn.adafruit.com/assets/assets/000/025/495/medium800/adafruit_products_Screen_Shot_2015-05-13_at_22.21.17.png?1431549146)

Note that even though we only print 2 decimal points, the values are received from the App as a full 4-byte floating point.

# Control Pad Module

You can also use the **Control Pad Module** to capture button presses and releases by selecting the appropriate menu item:

![](https://cdn-learn.adafruit.com/assets/assets/000/025/496/medium800/adafruit_products_ControlPad.jpg?1431549378)

This will bring up the Control Pad panel, shown below:

![](https://cdn-learn.adafruit.com/assets/assets/000/025/497/medium800/adafruit_products_IMG_0080.png?1431549452)

Button presses and releases will all be logged to the Serial Monitor with the ID of the button used:

```
Button 8 pressed
Button 8 released
Button 3 pressed
Button 3 released
```

# Color Picker Module

You can also send RGB color data via the&nbsp; **Color Picker** module, which presents the following color selection dialogue:

![](https://cdn-learn.adafruit.com/assets/assets/000/025/499/medium800/adafruit_products_ColorPicker.jpg?1431549751)

This will give you Hexadecimal color data in the following format:

```
RGB #A42FFF
```

https://youtu.be/Kym6crZF1Pg

You can combine the color picker and controller sample sketches to make color-configurable animations triggered by buttons in the mobile app-- very handy for wearables! Download this combined sample code (configured for Feather but easy to adapt to FLORA, BLE Micro, etc.) to get started:

[feather_bluefruit_neopixel_animation_controller.zip](https://learn.adafruit.com/system/assets/assets/000/029/260/original/feather_bluefruit_neopixel_animation_controller.zip?1450791688)
# Adafruit Flora Bluefruit LE

## HIDKeyboard

The **HIDKeyboard** &nbsp;example&nbsp;shows you how you can use the built-in HID keyboard AT commands to send keyboard data to any BLE-enabled Android or iOS phone, or other device that supports BLE HID peripherals.

# Opening the Sketch

To open the ATCommand sketch, click on the&nbsp; **File \> Examples \> Adafruit\_BluefruitLE\_nRF51** folder in the Arduino IDE and select **hidkeyboard** :

![](https://cdn-learn.adafruit.com/assets/assets/000/025/107/medium800/adafruit_products_BluefruitLE_nrf51_menu.png?1430441050)

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

![](https://cdn-learn.adafruit.com/assets/assets/000/025/142/medium800/adafruit_products_hidkey.png?1430506317)

# Configuration

Check the **Configuration!** page earlier to set up the sketch for Software/Hardware UART or Software/Hardware SPI. The default is hardware SPI

If using software or hardware Serial UART:

- This tutorial does not need to use the MODE pin, **make sure you have the mode switch in CMD mode!**
- Don't forget to also **connect the CTS pin on the Bluefruit to ground if you are not using it!** (The Flora has this already done)

# Running the Sketch

Once you upload the sketch to your board (via the arrow-shaped upload icon), and the upload process has finished, open up the Serial Monitor via&nbsp; **Tools \> Serial Monitor** , and make sure that the baud rate in the lower right-hand corner is set to&nbsp; **115200** :

![](https://cdn-learn.adafruit.com/assets/assets/000/025/485/medium800/adafruit_products_hidkey.png?1431545669)

To send keyboard data, type anything into the textbox at the top of the Serial Monitor and click the&nbsp; **Send** button.

# Bonding the HID Keyboard

Before you can use the HID keyboard, you will need to 'bond' it to your phone or PC. &nbsp;The bonding process establishes a permanent connection between the two devices, meaning that as soon as your phone or PC sees the Bluefruit LE module again it will automatically connect.

The exact procedures for bonding the keyboard will varying from one platform to another.

Danger: 

# Android

To bond the keyboard on a Bluetooth Low Energy enabled Android device, go to the&nbsp; **Settings** application and click the&nbsp; **Bluetooth** icon.

Info: 

![](https://cdn-learn.adafruit.com/assets/assets/000/025/119/medium800/adafruit_products_Android_BLEBond_1.jpg?1430486303)

Inside the Bluetooth setting panel you should see the Bluefruit LE module advertising itself as&nbsp; **Bluefruit Keyboard** under the 'Available devices' list:

![](https://cdn-learn.adafruit.com/assets/assets/000/025/120/medium800/adafruit_products_Android_BLEBond_2.jpg?1430486364)

Tapping the device will start the bonding process, which should end with the Bluefruit Keyboard device being moved to a new 'Paired devices' list with 'Connected' written underneath the device name:

![](https://cdn-learn.adafruit.com/assets/assets/000/025/121/medium800/adafruit_products_Android_BLEBond_3.jpg?1430486502)

To delete the bonding information, click the gear icon to the right of the device name and the click the&nbsp; **Forget** button:

![](https://cdn-learn.adafruit.com/assets/assets/000/025/122/medium800/adafruit_products_Android_BLEBond_4.jpg?1430486641)

# iOS

To bond the keyboard on an iOS device, go to the&nbsp; **Settings** application on your phone, and click the&nbsp; **Bluetooth** menu item.

The keyboard should appear under the&nbsp; **OTHER DEVICES** list:

![](https://cdn-learn.adafruit.com/assets/assets/000/025/123/medium800/adafruit_products_iOS_Bluetooth_1.jpg?1430488149)

Once the bonding process is complete the device will be moved to the&nbsp; **MY DEVICES** category, and you can start to use the Bluefruit LE module as a keyboard:

![](https://cdn-learn.adafruit.com/assets/assets/000/025/124/medium800/adafruit_products_iOS_Bluetooth_2.jpg?1430488310)

To unbond the device, click the 'info' icon and then select the&nbsp; **Forget this Device** option in the menu:

![](https://cdn-learn.adafruit.com/assets/assets/000/025/125/medium800/adafruit_products_iOS_Bluetooth_3.jpg?1430488401)

# OS X

To bond the keyboard on an OS X device, go to the&nbsp; **Bluetooth Preferences** window and click the&nbsp; **Pair** button beside the&nbsp; **Bluefruit Keyboard** device generated by this example sketch:

![](https://cdn-learn.adafruit.com/assets/assets/000/025/118/medium800/adafruit_products_Screen_Shot_2015-05-01_at_15.07.13.png?1430485675)

To unbond the device once it has been paired, click the small 'x' icon beside&nbsp; **Bluefruit Keyboard** :

![](https://cdn-learn.adafruit.com/assets/assets/000/025/126/medium800/adafruit_products_Screen_Shot_2015-05-01_at_15.55.06.png?1430488573)

... and then click the&nbsp; **Remove** button when the confirmation dialogue box pops up:

![](https://cdn-learn.adafruit.com/assets/assets/000/025/127/medium800/adafruit_products_Screen_Shot_2015-05-01_at_15.55.13.png?1430488633)

# Adafruit Flora Bluefruit LE

## UriBeacon

The&nbsp; **UriBeacon** &nbsp;example&nbsp;shows you how to use the built-in UriBeacon AT commands to configure the Bluefruit LE module as a UriBeacon advertiser, following Google's Physical Web [UriBeacon](https://github.com/google/uribeacon)&nbsp;specification.

# Opening the Sketch

To open the ATCommand sketch, click on the&nbsp; **File \> Examples \> Adafruit\_BluefruitLE\_nRF51** folder in the Arduino IDE and select **uribeacon** :

![](https://cdn-learn.adafruit.com/assets/assets/000/025/109/medium800/adafruit_products_BluefruitLE_nrf51_menu.png?1430441108)

This will open up a new instance of the example in the IDE, as shown below. You can edit the URL that the beacon will point to, from the default **http://www.adafruit.com** or just upload as is to test

![](https://cdn-learn.adafruit.com/assets/assets/000/025/141/medium800/adafruit_products_uribeacon.png?1430506173)

# Configuration

Check the **Configuration!** page earlier to set up the sketch for Software/Hardware UART or Software/Hardware SPI. The default is hardware SPI

If using software or hardware Serial UART:

- This tutorial does not need to use the MODE pin, **make sure you have the mode switch in CMD mode** if you do not configure & connect a MODE pin
- Don't forget to also **connect the CTS pin on the Bluefruit to ground if you are not using it!** (The Flora has this already done)

# Running the Sketch

Once you upload the sketch to your board (via the arrow-shaped upload icon), and the upload process has finished, open up the Serial Monitor via&nbsp; **Tools \> Serial Monitor** , and make sure that the baud rate in the lower right-hand corner is set to&nbsp; **115200** :

![](https://cdn-learn.adafruit.com/assets/assets/000/025/486/medium800/adafruit_products_urib.png?1431546147)

At this point you can open the Physical Web Application for [Android](https://play.google.com/store/apps/details?id=physical_web.org.physicalweb)&nbsp;or for [iOS](https://itunes.apple.com/us/app/physical-web/id927653608?mt=8), and you should see a link advertising Adafruit's website:&nbsp;

![](https://cdn-learn.adafruit.com/assets/assets/000/025/131/medium800/adafruit_products_UriBeacon.jpg?1430491397)

# Adafruit Flora Bluefruit LE

## HeartRateMonitor

The **HeartRateMonitor** &nbsp;example allows you to define&nbsp;a new&nbsp;GATT Service and associated GATT Characteristics, and update the characteristic values using standard AT commands.

# Opening the Sketch

To open the ATCommand sketch, click on the&nbsp; **File \> Examples \> Adafruit\_BluefruitLE\_nRF51** folder in the Arduino IDE and select **heartratemonitor** :

![](https://cdn-learn.adafruit.com/assets/assets/000/025/106/medium800/adafruit_products_BluefruitLE_nrf51_menu.png?1430441010)

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

![](https://cdn-learn.adafruit.com/assets/assets/000/025/143/medium800/adafruit_products_hrm.png?1430506404)

# Configuration

Check the **Configuration!** page earlier to set up the sketch for Software/Hardware UART or Software/Hardware SPI. The default is hardware SPI

## If Using Hardware or Software UART

This tutorial does not need to use the MODE pin, **make sure you have the mode switch in CMD mode** if you do not configure & connect a MODE pin

This demo uses some long data transfer strings, so we recommend defining and connecting both CTS and RTS to pins, even if you are using hardware serial.

If you are using a Flora or just dont want to connect CTS or RTS, set the pin #define's to -1 and **Don't forget to also connect the CTS pin on the Bluefruit to ground!** (The Flora has this already done)

If you are using RTS and CTS, you can remove this line below, which will slow down the data transmission

```
// this line is particularly required for Flora, but is a good idea 
  // anyways for the super long lines ahead!
  ble.setInterCharWriteDelay(5); // 5 ms
```

# Running the Sketch

Once you upload the sketch to your board (via the arrow-shaped upload icon), and the upload process has finished, open up the Serial Monitor via&nbsp; **Tools \> Serial Monitor** , and make sure that the baud rate in the lower right-hand corner is set to&nbsp; **115200** :

![](https://cdn-learn.adafruit.com/assets/assets/000/025/483/medium800/adafruit_products_hrm1.png?1431545409)

![](https://cdn-learn.adafruit.com/assets/assets/000/025/484/medium800/adafruit_products_hrm2.png?1431545456)

If you open up an application on your mobile device or laptop that support the standard [Heart Rate Monitor Service](https://developer.bluetooth.org/TechnologyOverview/Pages/HRS.aspx), you should be able to see the heart rate being updated in sync with the changes seen in the Serial Monitor:

# nRF Toolbox HRM Example

The image below is a screenshot from the free [nRF Toolbox](https://play.google.com/store/apps/details?id=no.nordicsemi.android.nrftoolbox&hl=en)&nbsp;application from Nordic on Android (also available on [iOS](https://itunes.apple.com/app/nrf-toolbox/id820906058?mt=8)), showing the incoming Heart Rate Monitor data:

![](https://cdn-learn.adafruit.com/assets/assets/000/025/116/medium800/adafruit_products_Screenshot_2015-05-01-03-12-18.png?1430443100)

# CoreBluetooth HRM Example

The image below is from a freely available [CoreBluetooth sample application](https://developer.apple.com/library/mac/samplecode/HeartRateMonitor/Introduction/Intro.html)&nbsp;from Apple showing how to work with Bluetooth Low Energy services and characteristics:

![](https://cdn-learn.adafruit.com/assets/assets/000/025/115/medium800/adafruit_products_Screen_Shot_2015-05-01_at_03.04.36.png?1430442438)

# Adafruit Flora Bluefruit LE

## HALP!

### When using the Bluefruit Micro or a Bluefruit LE with Flora/Due/Leonardo/Micro the examples don't run?

We add a special line to **setup()** to make it so the Arduino will halt until it sees you've connected over the Serial console. This makes debugging great but makes it so you cannot run the program disconnected from a computer.

Solution? Once you are done debugging, remove these two lines from setup()

```
  while (!Serial);
  delay(500);
```

### I can't seem to "Find" the Bluefruit LE!

Getting something like this?

![](https://cdn-learn.adafruit.com/assets/assets/000/025/476/medium800/adafruit_products_couldntfind.png?1431542393)

For UART/Serial Bluefruits:

- Check you have the **MODE** switch in CMD and the MODE pin not wired to anything if it isnt used!
- If you are trying to control the **MODE** from your micro, make sure you set the MODE pin in the sketch
- Make sure you have **RXI** and **TXO** wired right! They are often swapped by accident
- Make sure **CTS** is tied to GND if you are using hardware serial and not using CTS
- Check the MODE red LED, is it blinking? If its blinking continuously, you might be in DFU mode, power cycle the module!
- If you are using Hardware Serial/Software Serial make sure you know which one and have that set up

If using SPI Bluefruit:

- Make sure you have all 5 (or 6) wires connected properly.
- If using hardware SPI, you need to make sure you're connected to the hardware SPI port, which differs depending on the main chipset.

If using Bluefruit Micro:

- Make sure you change the **RESET** pin to #4 in any Config file. Also be sure you are using hardware SPI to connect!

# Adafruit Flora Bluefruit LE

## Data Mode

By placing the Flora BLEFriend module in 'UART Data' mode (set the mode selection switch to **DATA** or setting the MODE pin to gound) you can use the module as a 'tranparent UART connection' to the Bluefruit app. This makes data transfer super simple. Data is sent to the app when any 9600 baud data is received on the **RX** pin and any data from the app is automatically transmitted via the **TX** pin to your Flora

You can determine if you are in Data Mode by looking at the mode LED. &nbsp;It should blink two times followed by a three second pause, as shown below:

![](https://cdn-learn.adafruit.com/assets/assets/000/025/430/medium800thumb/adafruit_products_2487_2blinksGIF.jpg?1448318130)

You can then connect the the app in **UART** mode and send/receive data transparently

![](https://cdn-learn.adafruit.com/assets/assets/000/025/379/medium800/adafruit_products_IMG_0061.png?1431373941)

# Switching Command/Data Mode via +++

On either side of the connection (via the Flora or in your mobile app), you can dynamically switch between command and data mode by sending the " **+++\n**" string, as detailed in the [+++ command summary](../../../../introducing-the-adafruit-bluefruit-le-uart-friend/standard-at#plus-plus-plus).

If you start in data mode, you can send text for example, with "+++\nATI\n+++\n", which will cause the Bluefruit LE module to switch to command mode, execute the ATI command, and then switch back to data mode.

Info: 

```
# Start in Data Mode
&gt; Hello, World! Data mode!
  
# Send command to switch modes
&gt; +++
  
# Bluefruit LE module switches to CMD mode
# Send ATI command and wait for the response
&gt; ATI
&lt; BLEFRIEND
&lt; nRF51822 QFAAG00
&lt; B122AAC33F3D2296
&lt; 0.6.2
&lt; 0.6.2
&lt; May 01 2015
&lt; OK
  
# Switch back to DATA mode
&gt; +++
&lt; OK
  
# We're back in data mode now
Welcome back!
```

# Adafruit Flora Bluefruit LE

## Command Mode

By placing the Bluefruit LE module in 'Command' mode (set the mode selection switch to&nbsp; **CMD** or setting the MODE pin to a high voltage) you can enter a variety of Hayes AT style commands to configure the device or retrieve basic information about the module of BLE connection.

You can determine if you are in Command Mode by looking at the mode LED. &nbsp;It should blink three times followed by a three second pause, as shown below:

![](https://cdn-learn.adafruit.com/assets/assets/000/025/426/medium800thumb/adafruit_products_2487_3blinksGIF.jpg?1448318122)

# Hayes/AT Commands

When operating in command mode, the Bluefruit LE Pro modules use a [Hayes AT-style command set](http://en.wikipedia.org/wiki/Hayes_command_set)to configure the device.

The advantage of an AT style command set is that it's easy to use in machine to machine communication, while still being somewhat user friendly for humans.

[We have a huge amount of commands and details on how to use them, so please do check out our list of possible commands over on the Bluefruit LE page](../../../../introducing-the-adafruit-bluefruit-le-uart-friend/command-mode-1) (no need to duplicate all of the content here!)

# Adafruit Flora Bluefruit LE

## UART Service

 **Base UUID:** &nbsp;6E40 **0001** -B5A3-F393-­E0A9-­E50E24DCCA9E

This service simulates a basic UART connection over two lines, TXD and RXD.

It is based on&nbsp;a proprietary UART service specification by&nbsp;Nordic Semiconductors. Data sent to and from this service can be viewed using the nRFUART apps from Nordic Semiconductors for Android and iOS.

Danger: 

# Characteristics

Nordic’s UART Service includes the following characteristics:

R = Read; W = Write; N = Notify; I = Indicate

Info: 

## TX (0x0002)

This characteristic is used to send data back to the sensor node, and can be written to by the connected Central device (the mobile phone, tablet, etc.).

## RX (0x0003)

This characteristic is used to send data out to the connected Central device. Notify can be enabled by the connected device so that an alert is raised every time the TX channel is updated.

# Adafruit Flora Bluefruit LE

## Downloads

- [MDBT Datasheet](https://cdn-shop.adafruit.com/product-files/2267/MDBT40-P256R.pdf)
- [GitHub PCB files](https://github.com/adafruit/Adafruit-Flora-Bluefruit-LE-PCB)
- [Fritzing object in the Adafruit Fritzing Library](https://github.com/adafruit/Fritzing-Library)

# Schematic

Click to embiggen

![](https://cdn-learn.adafruit.com/assets/assets/000/025/434/medium800/adafruit_products_schem.png?1431444297)

# Fabrication print

Dimensions in inches

![](https://cdn-learn.adafruit.com/assets/assets/000/025/435/medium800/adafruit_products_bleprint.png?1431444316)


## Featured Products

### Flora Wearable Bluefruit LE Module

[Flora Wearable Bluefruit LE Module](https://www.adafruit.com/product/2487)
Would you like to add powerful and easy-to-use Bluetooth Low Energy to your wearable FLORA project? Heck yeah! With BLE now included in modern smart phones and tablets, its fun to add wireless connectivity. So what you really need is the new Adafruit Flora Bluefruit LE!

The Flora...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/2487)
[Related Guides to the Product](https://learn.adafruit.com/products/2487/guides)
### FLORA - Wearable electronic platform: Arduino-compatible

[FLORA - Wearable electronic platform: Arduino-compatible](https://www.adafruit.com/product/659)
FLORA is Adafruit's fully-featured wearable electronics platform. It's a round, sewable, Arduino-compatible microcontroller designed to empower amazing wearables projects.FLORA comes with Adafruit's support, [tutorials and...](http://learn.adafruit.com/category/flora)

In Stock
[Buy Now](https://www.adafruit.com/product/659)
[Related Guides to the Product](https://learn.adafruit.com/products/659/guides)
### Short Wire Alligator Clip Test Lead (set of 12)

[Short Wire Alligator Clip Test Lead (set of 12)](https://www.adafruit.com/product/1592)
Connect this to that without soldering using these handy mini alligator clip test leads. Approximately 4.5" overall cables with alligator clip on each end, color coded. You get 12 pieces in 6 colors. Strong and grippy, these always come in handy! We often use these in conjunction with a...

In Stock
[Buy Now](https://www.adafruit.com/product/1592)
[Related Guides to the Product](https://learn.adafruit.com/products/1592/guides)
### Getting Started with Adafruit FLORA Book Pack

[Getting Started with Adafruit FLORA Book Pack](https://www.adafruit.com/product/2404)
Pickup a copy of&nbsp;[Getting Started with Adafruit FLORA](https://www.adafruit.com/products/1839)&nbsp;and then hit the ground running with everything that you need to become an [Adafruit FLORA](https://www.adafruit.com/products/659) supreme being!

This pack is...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/2404)
[Related Guides to the Product](https://learn.adafruit.com/products/2404/guides)
### Getting Started with Adafruit FLORA

[Getting Started with Adafruit FLORA](https://www.adafruit.com/product/1839)
 **Making Wearables with an Arduino-Compatible Electronics Platform**  
  
This book introduces readers to building wearable electronics projects using Adafruit's tiny FLORA board: at 4.4 grams, and only 1.75 inches in diameter, and featuring Arduino compatibility, it's the...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/1839)
[Related Guides to the Product](https://learn.adafruit.com/products/1839/guides)
### FLORA Budget Pack

[FLORA Budget Pack](https://www.adafruit.com/product/1405)
Get started with the fabulous Adafruit Flora platform with this lovely budget kit, just enough to get you started with this fun wearable computer. Included are enough parts to make your first wearable electronic project. There's a Flora motherboard, four ultra-bright chainable RGB pixels,...

In Stock
[Buy Now](https://www.adafruit.com/product/1405)
[Related Guides to the Product](https://learn.adafruit.com/products/1405/guides)
### FLORA GPS Starter Pack

[FLORA GPS Starter Pack](https://www.adafruit.com/product/1090)
Get started with the fabulous Adafruit Flora platform with this lovely starter kit. Included are plenty of parts to make a few different fun projects! There's a Flora motherboard, a GPS module that can also perform location datalogging, eight ultra-bright chainable RGB pixels, a battery...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/1090)
[Related Guides to the Product](https://learn.adafruit.com/products/1090/guides)
### FLORA Sensor Pack

[FLORA Sensor Pack](https://www.adafruit.com/product/1458)
Sense the world around you! The FLORA Sensor Pack includes many types of sensors for your wearable enjoyment. Sense motion, direction, color, light levels, touch, and connections with FLORA sensor breakouts and conductive materials, and a few NeoPixels for experimenting with displaying your...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/1458)
[Related Guides to the Product](https://learn.adafruit.com/products/1458/guides)

## Related Guides

- [Glowing WhoVille Hat](https://learn.adafruit.com/glowing-whoville-hat.md)
- [3D Printed Wireless MIDI Controller Guitar](https://learn.adafruit.com/ez-key-wireless-midi-controller-guitar.md)
- [Flora MIDI Drum Glove](https://learn.adafruit.com/midi-drum-glove.md)
- [Sparkle Skirt](https://learn.adafruit.com/sparkle-skirt.md)
- [Getting Started with FLORA](https://learn.adafruit.com/getting-started-with-flora.md)
- [Flora Brake Light Backpack](https://learn.adafruit.com/flora-brakelight-backpack.md)
- [Firewalker LED Sneakers](https://learn.adafruit.com/firewalker-led-sneakers.md)
- [Flora TSL2561 Lux Sensor](https://learn.adafruit.com/flora-lux-sensor.md)
- [FLORAbrella](https://learn.adafruit.com/florabrella.md)
- [Ursula's Seashell Necklace](https://learn.adafruit.com/ursulas-seashell-necklace.md)
- [LED Stego Flex Spike Hoodie](https://learn.adafruit.com/led-stego-flex-spike-hoodie.md)
- [Sewable NeoPixels](https://learn.adafruit.com/flora-rgb-smart-pixels.md)
- [Sunscreen Reminder Hat](https://learn.adafruit.com/sunscreen-reminder-hat.md)
- [NeoPixel Matrix Snowflake Sweater](https://learn.adafruit.com/neopixel-matrix-snowflake-sweater.md)
- [STEAM-Punk Goggles](https://learn.adafruit.com/steam-punk-goggles.md)
