Introducing the Adafruit Bluefruit LE UART Friend Created by Kevin Townsend Last updated on 2017-04-24 08:30:30 PM UTC
Guide Contents Guide Contents Introduction So it's a Fancy Pants Wireless UART Adapter? Download our free Android/iOS app and you're ready to rock! You can do a lot more too! Why Use Adafruit's Module? Technical Specifications Pinouts Power Pins UART Pins Other Pins Reverse Side Breakouts Assembly Prepare the header strip: Add the breakout board: And Solder! Wiring Wiring for Arduino Uno Wiring for an Arduino Micro or Leonardo Wiring for an FTDI Cable Factory Reset Factory Reset via DFU Pin FactoryReset S
Software Configuration! Which board do you have? Bluefruit Micro or Feather 32u4 Bluefruit Feather M0 Bluefruit LE Bluefruit LE SPI Friend Bluefruit LE UART Friend or Flora BLE Configure the Pins Used Common settings: Software UART Hardware UART Mode Pin SPI Pins Software SPI Pins Select the Serial Bus UART Based Boards (Bluefruit LE UART Friend & Flora BLE) SPI Based Boards (Bluefruit LE SPI Friend) ATCommand Opening the Sketch Configuration Running the Sketch BLEUart Opening the Sketch Configuration Ru
Opening the Sketch Configuration Running the Sketch Using Bluefruit LE Connect in Controller Mode Streaming Sensor Data Control Pad Module Color Picker Module HeartRateMonitor Opening the Sketch Configuration If Using Hardware or Software UART Running the Sketch nRF Toolbox HRM Example CoreBluetooth HRM Example UriBeacon Opening the Sketch Configuration Running the Sketch HALP! Data Mode Switching Command/Data Mode via +++ Command Mode Hayes/AT Commands Test Command Mode '=?' Write Command Mode '=xxx' Exec
ATE +++ General Purpose AT+FACTORYRESET AT+DFU AT+HELP AT+NVMWRITE AT+NVMREAD AT+MODESWITCHEN Hardware AT+BAUDRATE AT+HWADC AT+HWGETDIETEMP AT+HWGPIO AT+HWGPIOMODE AT+HWI2CSCAN AT+HWVBAT AT+HWRANDOM AT+HWMODELED AT+UARTFLOW Beacon AT+BLEBEACON AT+BLEURIBEACON Deprecated: AT+EDDYSTONEENABLE AT+EDDYSTONEURL AT+EDDYSTONECONFIGEN AT+EDDYSTONESERVICEEN AT+EDDYSTONEBROADCAST BLE Generic AT+BLEPOWERLEVEL AT+BLEGETADDRTYPE AT+BLEGETADDR © Adafruit Industries https://learn.adafruit.
AT+BLEGETPEERADDR AT+BLEGETRSSI BLE Services AT+BLEUARTTX TX FIFO Buffer Handling AT+BLEUARTTXF AT+BLEUARTRX AT+BLEUARTFIFO AT+BLEKEYBOARDEN AT+BLEKEYBOARD AT+BLEKEYBOARDCODE Modifier Values 76 77 77 78 78 78 79 79 AT+BLEHIDEN AT+BLEHIDMOUSEMOVE AT+BLEHIDMOUSEBUTTON AT+BLEHIDCONTROLKEY AT+BLEHIDGAMEPADEN AT+BLEHIDGAMEPAD AT+BLEMIDIEN AT+BLEMIDIRX AT+BLEMIDITX AT+BLEBATTEN AT+BLEBATTVAL BLE GAP AT+GAPCONNECTABLE AT+GAPGETCONN AT+GAPDISCONNECT AT+GAPDEVNAME AT+GAPDELBONDS AT+GAPINTERVALS AT+GAPSTARTADV AT
BLE GATT GATT Limitations AT+GATTCLEAR AT+GATTADDSERVICE AT+GATTADDCHAR AT+GATTCHAR AT+GATTLIST AT+GATTCHARRAW Debug AT+DBGMEMRD AT+DBGNVMRD AT+DBGSTACKSIZE AT+DBGSTACKDUMP History Version 0.7.7 Version 0.7.0 Version 0.6.7 Version 0.6.6 Version 0.6.5 Version 0.6.2 Version 0.5.0 Version 0.4.7 Version 0.3.
Bluefruit LE Connect for OS X (http://adafru.it/o9F) (Swift) 102 Bluefruit LE Command Line Updater for OS X (http://adafru.it/pLF) (Swift) 103 Deprecated: Bluefruit Buddy (http://adafru.it/mCn) (OS X) ABLE (http://adafru.it/ijB) (Cross Platform/Node+Electron) Bluefruit LE Python Wrapper (http://adafru.it/fQF) Debug Tools 105 AdaLink (http://adafru.it/fPq) (Python) Adafruit nRF51822 Flasher (http://adafru.
Introduction Would you like to add powerful and easy-to-use Bluetooth Low Energy to your robot, art or other electronics 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 Bluefruit LE UART Friend! The Bluefruit LE UART Friend makes it easy to add Bluetooth Low Energy connectivity to anything with a hardware or software serial port.
The board is capable of much more than just sending strings over the air! Thanks to an easy to learnAT command set (http://adafru.it/iCG), you have full control over how the device behaves, including the ability to define and manipulate your own GATT Services and Characteristics (http://adafru.it/iCH), or change the way that the device advertises itself for other Bluetooth Low Energy devices to see.
© Adafruit Industries https://learn.adafruit.
Pinouts HW flow control (CTS+RTS) should always be used with the nRF51822. The UART peripheral block is designed in a way that more or less requires HW flow control for reliable UART communication, with a very small internal buffer and tight timing limitations due to the SoftDevice architecture (Nordic's proprietary Bluetooth Low Energy stack). Power Pins VIN: This is the power supply for the module, supply with 3.3-16V power supply input. This will be regulated down to 3.
Reverse Side Breakouts On the back we also have a few breakouts! Opt VBat: If you fancy, you can solder on a JST 2-PH connector (http://adafru.it/1769), this will let you easily plug in a Lithium Ion or other battery pack. This connector pad is diode protected so you can use both Vin and VBat and the regulator will automatically switch to the higher voltage 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. (http://adafru.
Assembly Prepare the header strip: Cut the strip to length if necessary. It will be easier to solder if you insert it into a breadboard - long pins down Add the breakout board: Place the breakout board over the pins so that the short pins poke through the breakout pads © Adafruit Industries https://learn.adafruit.
And Solder! Be sure to solder all pins for reliable electrical contact. Solder the longer power/data strip first (For tips on soldering, be sure to check out ourGuide to Excellent Soldering (http://adafru.it/aTk)). You're done! Check your solder joints visually and continue onto the next steps © Adafruit Industries https://learn.adafruit.
Wiring You can use the Bluefruit LE UART friend with any microcontroller with 3 or 5V logic, but we'll be demoing it with an Arduino UNO.
Since the UART Friend is, well, a serial port, you can use an FTDI Friend or cable to quickly connect using any serial console. You won't get MODE or DFU connections, so don't forget to flick the mode switch as necessary if you want to be in a particular mode.
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.
Upload this sketch and open the Serial Monitor and it should perform a factory reset for you: AT+FACTORYRESET You can also perform a factory reset by sending the AT+FACTORYRESET command to your Bluefruit LE module in your favorite terminal emulator or using the ATCommand (http://adafru.it/iCk) example sketch. AT+FACTORYRESET OK This command will also cause the device to reset.
© Adafruit Industries https://learn.adafruit.
DFU 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 installingAdafruit's Bluefruit LE Connect application (http://adafru.
Current Measurements The following tables give you an idea of the average current draw in three different operating modes with the Bluefruit LE UART Friend: Fast Advertising Mode (the first 30 seconds after power up) Slow Advertising Mode (>30s since power up) Connected Mode (using the UART profile in this case) Test Conditions The board was powered from a fully charged 1200mAh 4.2V LIPO (http://adafru.it/dyW) cell running at 4.2V.
Connected Mode (UART) The following measurements illustrate the average current draw in connected mode (with the connected LED enabled). UART mode was used as a test case. Average Current: 1.86mA Peak Current: 15.2mA Expected Battery Life: 645 hours (~26.8 days) © Adafruit Industries https://learn.adafruit.
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, (http://adafru.it/f4V) but its likely easier to just download by clicking: Download Adafruit_BluefruitLE_nRF51 http://adafru.it/f4W Rename the uncompressed folder Adafruit_BluefruitLE_nRF51 and check that the Adafruit_BluefruitLE_nRF51 folder contains Adafruit_BLE.cpp and Adafruit_BLE.
Configuration! Before you start uploading any of the example sketches, you'll need to CONFIGURE the Bluefruit interface - there's a lot of options so pay close attention! Which board do you have? There's a few products under the Bluefruit name: If you are using the Bluefruit LE Shield then you have anSPI-connected NRF51822 module. You can use this with Atmega328 (Arduino UNO or compatible), ATmega32u4 (Arduino Leonardo, compatible) or ATSAMD21 (Arduino Zero, compatible) and possibly others.
Bluefruit LE SPI Friend If you have a stand-alone module, you have a bit of flexibility with wiring however we strongly recommend Hardware SPI, CS = 8, IRQ = 7, RST = 4 You can use this with just about any microcontroller with 5 or 6 pins Bluefruit LE UART Friend or Flora BLE If you have a stand-alone UART module you have some flexibility with wiring. However we suggest hardware UART if possible. You will likely need to use the flow controlCTS pin if you are not using hardware UART.
Common settings: You can set up how much RAM to set aside for a communication buffer and whether you want to have full debug output.
control and we do have that available at the cost of a single GPIO pin. For software serial (Arduino Uno, Adafruit Metro) you should uncomment the software serial contructor below, and make sure the other three options (hardware serial & SPI) are commented out. // Create the bluefruit object, either software serial...
ATCommand The ATCommand example allows you to execute AT commands from your sketch, and see the results in the Serial Monitor. This can be useful for debugging, or just testing different commands out to see how they work in the real world.
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 Tools > Serial Monitor, and make sure that the baud rate in the lower right-hand corner is set to115200: To send an AT command to the Bluefruit LE module, enter the command in the textbox at the top of the Seria
You can do pretty much anything at this prompt, with the AT command set. TryAT+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) © Adafruit Industries https://learn.adafruit.
BLEUart The 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 (http://adafru.it/f4G) or iOS (http://adafru.it/f4H) in UART mode).
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 modeif 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 Tools > Serial Monitor, and make sure t
You can see the incoming string here in the Adafruit Bluefruit LE Connect app below (iOS in this case): © Adafruit Industries https://learn.adafruit.
The response text ('Why hello, Arduino!') can be seen below: © Adafruit Industries https://learn.adafruit.
© Adafruit Industries https://learn.adafruit.
HIDKeyboard The HIDKeyboard example 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.
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 Tools > Serial Monitor, and make sure that the baud rate in the lower right-hand corner is set to115200: To send keyboard da
Android To bond the keyboard on a Bluetooth Low Energy enabled Android device, go to the Settings application and click the Bluetooth icon. These screenshots are based on Android 5.0 running on a Nexus 7 2013. The exact appearance may vary depending on your device and OS version.
iOS To bond the keyboard on an iOS device, go to the Settings application on your phone, and click the Bluetooth menu item. The keyboard should appear under the OTHER DEVICES list: © Adafruit Industries https://learn.adafruit.
Once the bonding process is complete the device will be moved to theMY DEVICES category, and you can start to use the Bluefruit LE module as a keyboard: To unbond the device, click the 'info' icon and then select theForget this Device option in the menu: OS X To bond the keyboard on an OS X device, go to the Bluetooth Preferences window and click the Pair button beside the Bluefruit Keyboard device generated by this example sketch: © Adafruit Industries https://learn.adafruit.
To unbond the device once it has been paired, click the small 'x' icon besideBluefruit Keyboard: ... and then click the Remove button when the confirmation dialogue box pops up: © Adafruit Industries https://learn.adafruit.
Controller The Controller 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.
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.
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.
Accel 0.25 -0.51 -0.83 Accel 0.21 -0.47 -0.76 Accel 0.27 -0.48 -0.82 Note that even though we only print 2 decimal points, the values are received from the App as a full 4-byte floating point.
Color Picker Module You can also send RGB color data via the Color Picker module, which presents the following color selection dialogue: This will give you Hexadecimal color data in the following format: RGB #A42FFF 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.
feather_bluefruit_neopixel_animation_controller.zip http://adafru.it/kzF © Adafruit Industries https://learn.adafruit.
HeartRateMonitor The HeartRateMonitor example allows you to define a new 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 File > Examples > Adafruit_BluefruitLE_nRF51 folder in the Arduino IDE and select heartratemonitor: This will open up a new instance of the example in the IDE, as shown below: Configuration © Adafruit Industries https://learn.adafruit.
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 modeif 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 open up an application on your mobile device or laptop that support the standardHeart Rate Monitor Service (http://adafru.it/f4I), 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 (http://adafru.it/e9M) application from Nordic on Android (also available on iOS (http://adafru.
CoreBluetooth HRM Example The image below is from a freely available CoreBluetooth sample application (http://adafru.it/f4K) from Apple showing how to work with Bluetooth Low Energy services and characteristics: © Adafruit Industries https://learn.adafruit.
© Adafruit Industries https://learn.adafruit.
UriBeacon The UriBeacon example 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 (http://adafru.it/edk) specification. Opening the Sketch To open the ATCommand sketch, click on the File > Examples > Adafruit_BluefruitLE_nRF51 folder in the Arduino IDE and select uribeacon: This will open up a new instance of the example in the IDE, as shown below.
This tutorial does not need to use the MODE pin,make sure you have the mode switch in CMD modeif 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 Tools > Serial Monitor, and make sure that the baud rate in the lower right-hand c
HALP! When using the Bluefruit Micro or a Bluefruit LE with Flora/Due/Leonardo/Micro the examples dont 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.
Data Mode By placing the BLEFriend module in 'UART Data' mode (set the mode selection switch toUART 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 RXI pin and any data from the app is automatically transmitted via theTXO pin In order to keep from overloading your microcontroller, you can use the flow control pins.
Switching Command/Data Mode via +++ On either side of the connection (via the Arduino Uno 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 (http://adafru.it/iCN). 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.
> Hello, World! Data mode! # Send command to switch modes > +++ # Bluefruit LE module switches to CMD mode # Send ATI command and wait for the response > ATI < BLEFRIEND < nRF51822 QFAAG00 < B122AAC33F3D2296 < 0.6.2 < 0.6.2 < May 01 2015 < OK # Switch back to DATA mode > +++ < OK # We're back in data mode now Welcome back! © Adafruit Industries https://learn.adafruit.
Command Mode By placing the BLEFriend module in 'Command' mode (set the mode selection switch toCMD 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. In order to keep from overloading your microcontroller, you can use the flow control pins.
succeed since these are all valid values for this command. Execute Mode 'Execute' mode will cause the specific command to 'run', if possible, and will be used when the command name is entered with no additional parameters. AT+FACTORYRESET You might use execute mode to perform a factory reset, for example, by executing the AT+FACTORYRESET command as follows: AT+FACTORYRESET OK\r\n NOTE: Many commands that are means to be read will perform the same action whether they are sent to the command parser in 'exe
Standard AT The following standard Hayes/AT commands are available on Bluefruit LE modules: AT Acts as a ping to check if we are in command mode. If we are in command mode, we should receive the 'OK' response. Codebase Revision: 0.3.0 Parameters: None Output: None AT OK ATI Displays basic information about the Bluefruit module. Codebase Revision: 0.3.
Enables or disables echo of input characters with the AT parser Codebase Revision: 0.3.0 Parameters: '1' = enable echo, '0' = disable echo Output: None # Disable echo support ATE=0 OK #Enable echo support ATE=1 OK +++ Dynamically switches between DATA and COMMAND mode without changing the physical CMD/UART select switch. When you are in COMMAND mode, entering '+++\n' or '+++\r\n' will cause the module to switch to DATA mode, and anything typed into the console will go direct to the BLUE UART service.
General Purpose The following general purpose commands are available on all Bluefruit LE modules: AT+FACTORYRESET Clears any user config data from non-volatile memory and performs a factory reset before resetting the Bluefruit module. Codebase Revision: 0.3.0 Parameters: None Output: None AT+FACTORYRESET OK As of version 0.5.0+ of the firmware, you can perform a factory reset by holding the DFU button down for 10s until the blue CONNECTED LED lights up, and then releasing the button.
AT+NVMWRITE=16,INTEGER,32768 OK AT+NVMREAD Reads data from the 256 byte user non-volatile memory (NVM) region. Codebase Version: 0.7.0 Parameters: offset: The numeric offset for the first byte from the starting position in the user NVM size: The number of bytes to read datatype: The type used for the data being read, which is required to properly parse the data and display it as a response.
Hardware The following commands allow you to interact with the low level HW on the Bluefruit LE module, such as reading or toggling the GPIO pins, performing an ADC conversion ,etc.: AT+BAUDRATE Changes the baud rate used by the HW UART peripheral on the nRF51822. Codebase Revision: 0.7.
AT+HWGETDIETEMP 32.25 OK AT+HWGPIO Gets or sets the value of the specified GPIO pin (depending on the pin's mode). Codebase Revision: 0.3.0 Parameters: The parameters for this command change depending on the pin mode.
OK # Get the current mode for pin 14 AT+HWPGIOMODE=14 0 OK AT+HWI2CSCAN Scans the I2C bus to try to detect any connected I2C devices, and returns the address of devices that were found during the scan process. Codebase Revision: 0.3.0 Parameters: None Output: A comma-separated list of any I2C address that were found while scanning the valid address range on the I2C bus, or nothing is no devices were found.
Output: If run with no parameters, returns an upper-case string representing the current MODE LED operating mode from the fields above # Get the curent MODE LED setting AT+HWMODELED MODE OK # Change the MODE LED to indicate BLE UART activity AT+HWMODELED=BLEUART OK # Manually toggle the MODE LED AT+HWMODELED=MANUAL,TOGGLE OK AT+UARTFLOW Enables or disable hardware flow control (CTS + RTS) on the UART peripheral block of the nRF51822. Codebase Revision: 0.7.
Beacon Adafruit's Bluefruit LE modules currently support the following 'Beacon' technologies: Beacon (Apple) via AT+BLEBEACON UriBeacon (Google) via AT+BLEURIBEACON (deprecated) Eddystone (Google) via AT+EDDYSTONE* Modules can be configured to act as 'Beacons' using the following commands: AT+BLEBEACON Codebase Revision: 0.3.
AT+BLEURIBEACON Converts the specified URI into a UriBeacon (http://adafru.it/edk) advertising packet, and configures the module to advertise as a UriBeacon (part of Google's Physical Web (http://adafru.it/ehZ) project). To view the UriBeacon URIs you can use one of the following mobile applications: Android 4.3+: Physical Web (http://adafru.it/edi) on the Google Play Store iOS: Physical Web (http://adafru.it/edj) in Apple's App Store Codebase Revision: 0.4.7 Parameters: The URI to encode (ex. http://www.
AT+BLEURIBEACON=http://www.adafruit.com/blog OK # Reset to change the advertising data ATZ OK If the supplied URI is too long you will get the following output: AT+BLEURIBEACON=http://www.adafruit.com/this/uri/is/too/long URL is too long ERROR If the URI that you are trying to encode is too long, try using a shortening service like bit.ly, and encode the shortened URI. UriBeacon should be considered deprecated as a standard, and EddyStone should be used for any future development.
Parameters: The number of seconds to advertised the config service UUID Output: None # Start advertising the Eddystone config service for 5 minutes (300s) AT+EDDYSTONECONFIGEN=300 OK AT+EDDYSTONESERVICEEN Adds or removes the Eddystone service from the GATT table (requires a reset to take effect). Codebase Revision: 0.7.
BLE Generic The following general purpose BLE commands are available on Bluefruit LE modules: AT+BLEPOWERLEVEL Gets or sets the current transmit power level for the module's radio (higher transmit power equals better range, lower transmit power equals better battery life). Codebase Revision: 0.3.
Gets the 48-bit BLE device address. Codebase Revision: 0.3.0 Parameters: None Output: The 48-bit BLE device address in the following format: 'AA:BB:CC:DD:EE:FF' AT+BLEGETADDR E4:C6:C7:31:95:11 OK AT+BLEGETPEERADDR Gets the 48-bit address of the peer (central) device we are connected to. Codebase Revision: 0.6.5 Parameters: None Output: The 48-bit address of the connected central device in hex format. The command will returnERROR if we are not connected to a central device.
BLE Services The following commands allow you to interact with various GATT services present on Bluefruit LE modules when running in Command Mode. AT+BLEUARTTX This command will transmit the specified text message out via theUART Service (http://adafru.it/iCn) while you are running in Command Mode. Codebase Revision: 0.3.0 Parameters: The message payload to transmit. The payload can be up to 240 characters (since AT command strings are limited to a maximum of 256 bytes total).
Note: The TX FIFO full check will happen for each GATT transaction (of up to 20 bytes of data each), so large data transfers may have multiple 200ms wait states. You can use the AT+BLEUARTFIFO=TX (http://adafru.it/id3) command to check the size of the TX FIFO before sending data to ensure that you have enough free space available in the buffer. The TX FIFO has the following size, depending on the firmware version used: Firmware <=0.6.6: 160 characters wide Firmware >=0.6.
# Command results when data is available AT+BLEUARTRX Sent from Android OK # Command results when no data is available AT+BLEUARTRX OK AT+BLEUARTFIFO This command will return the free space available in the BLE UART TX and RX FIFOs. If you are transmitting large chunks of data, you may want to check if you have enough free space in the TX FIFO before sending, keeping in mind that individual GATT packets can contain up to 20 user bytes each. Codebase Revision: 0.6.
\n - Line Feed \b - Backspace \t - Tab \\ - Backslash As of version 0.6.7 you can also use the following escape code when sending a single character ('AT+BLEKEYBOARD=?' has another meaning for the AT parser): \? - Question mark Codebase Revision: 0.5.0 Parameters: The text string (optionally including escape characters) to transmit Output: None # Send a URI with a new line ending to execute in Chrome, etc. AT+BLEKEYBOARD=http://www.adafruit.com\r\n OK # Send a single question mark (special use case, 0.6.
Android, OSX and Windows 10 devices. By default HID support is disabled, so you need to set BLEHIDEN to 1 and then perform a system reset before the HID devices will be enumerated and appear in on your central device. Codebase Revision: 0.6.6 Parameters: 1 or 0 (1 = enable, 0 = disable) Output: None You normally need to 'bond' the Bluefruit LE peripheral to use the HID commands, and the exact bonding process will change from one operating system to another.
OK # Hold the backward mouse button for 200 milliseconds (OS dependent) AT+BLEHIDMOUSEBUTTON=B,hold,200 OK AT+BLEHIDCONTROLKEY Sends HID media control commands for the bonded device (adjust volume, screen brightness, song selection, etc.). Codebase Revision: 0.6.
Enables HID gamepad support in the HID service. By default the gamepad is disabled as of version 0.7.6 of the firmware since it causes problems on iOS and OS X and should only be used on Android and Windows based devices. Codebase Revision: 0.7.6 Parameters: Whether the gamepad service should be enabled via one of the following values: on off 1 0 Output: If executed with no parameters, a numeric value will be returned indicating whether the battery service is enabled (1) or disabled (0).
Parameters: None Output: The midi event in byte array format AT+BLEMIDIRX 90-3C-7F OK AT+BLEMIDITX Sends a MIDI event to host. Codebase Revision: 0.7.
BLE GAP GAP (http://adafru.it/iCo), which stands for the Generic Access Profile, governs advertising and connections with Bluetooth Low Energy devices. The following commands can be used to configure the GAP settings on the BLE module. You can use these commands to modify the advertising data (for ex.
Gets or sets the device name, which is included in the advertising payload for the Bluefruit LE module Codebase Revision: 0.3.0 Parameters: None to read the current device name The new device name if you want to change the value Output: The device name if the command is executed in read mode Updating the device name will persist the new value to non-volatile memory, and the updated name will be used when the device is reset.
Output: If reading the current GAP interval settings, the following comma-separated information will be displayed: Minimum connection interval (in milliseconds) Maximum connection interval (in milliseconds) Advertising interval (in milliseconds) Advertising timeout (in milliseconds) Updating the GAP intervals will persist the new values to non-volatile memory, and the updated values will be used when the device is reset.
WARNING: This command will override the normal advertising payload and may prevent some services from acting as expected. To restore the advertising data to the normal default values use the AT+FACTORYRESET command.
BLE GATT GATT (http://adafru.it/iCp), which standards for the Generic ATTribute Profile, governs data organization and data exchanges between connected devices. One device (the peripheral) acts as a GATT Server, which stores data in Attribute records, and the second device in the connection (the central) acts as a GATT Client, requesting data from the server whenever necessary.
1 OK # Add a battery measurement characteristic (UUID = 0x2A19), notify enabled AT+GATTADDCHAR=UUID=0x2A19,PROPERTIES=0x10,MIN_LEN=1,VALUE=100 1 OK # Clear any previous custom services/characteristics AT+GATTCLEAR OK # Add a custom service to the peripheral AT+GATTADDSERVICE=UUID128=00-11-00-11-44-55-66-77-88-99-AA-BB-CC-DD-EE-FF 1 OK # Add a custom characteristic to the above service (making sure that there # is no conflict between the 16-bit UUID and bytes 3+4 of the 128-bit service UUID) AT+GATTADDCHAR=U
# Add a battery measurement characteristic (UUID = 0x2A19), notify enabled AT+GATTADDCHAR=UUID=0x2A19,PROPERTIES=0x10,MIN_LEN=1,VALUE=100 1 OK # Clear any previous custom services/characteristics AT+GATTCLEAR OK # Add a custom service to the peripheral AT+GATTADDSERVICE=UUID128=00-11-00-11-44-55-66-77-88-99-AA-BB-CC-DD-EE-FF 1 OK # Add a custom characteristic to the above service (making sure that there # is no conflict between the 16-bit UUID and bytes 3+4 of the 128-bit service UUID) AT+GATTADDCHAR=UUID=0
Gets or sets the value of the specified custom GATT characteristic (based on the index ID returned when the characteristic was added to the system via AT+GATTADDCHAR). Codebase Revision: 0.3.0 Parameters: This function takes one or two comma-separated functions (one parameter = read, two parameters = write). The first parameter is the characteristic index value, as returned from the AT+GATTADDCHAR function.
# Get a list of all custom GATT services and characteristics on the device AT+GATTLIST ID=01,UUID=0x180F ID=01,UUID=0x2A19,PROPERTIES=0x10,MIN_LEN=1,MAX_LEN=1,VALUE=0x64 ID=02,UUID=0x11, UUID128=00-11-00-11-44-55-66-77-88-99-AA-BB-CC-DD-EE-FF ID=02,UUID=0x02,PROPERTIES=0x02,MIN_LEN=1,MAX_LEN=1,VALUE=0x64 OK AT+GATTCHARRAW This read only command reads binary (instead of ASCII) data from a characteristic. It is non-printable but has less overhead and is easier when writing libraries in Arduino.
Debug The following debug commands are available on Bluefruit LE modules: Use these commands with care since they can easily lead to a HardFault error on the ARM core, which will cause the device to stop responding. AT+DBGMEMRD Displays the raw memory contents at the specified address. Codebase Revision: 0.3.
Dumps the current stack contents. Unused sections of stack memory are filled with '0xCAFEFOOD' to help determine where stack usage stops. This command is purely for debug and development purposes. Codebase Revision: 0.4.
0x20003C70: 20001D38 00000005 20001D38 00000000 0x20003C80: 00000001 00012083 200018C8 000013D3 0x20003C90: 00550000 00000001 80E80000 4FC40000 0x20003CA0: 000080E8 00000009 60900000 000080E8 0x20003CB0: 60140000 20002764 0009608F 000080E8 0x20003CC0: 80000000 000080E8 00000000 00129F5F 0x20003CD0: 00000000 0001E4D9 80E80000 200018C8 0x20003CE0: 200018D4 00000000 80E80000 000000FF 0x20003CF0: 0000011C 0001BCE1 0000203A 0001BC1D 0x20003D00: 00000000 0001BC1D 80E80000 0001BCE1 0x20003D10: 0000011C 0001BDA9 80
History This page tracks additions or changes to the AT command set based on the firmware version number (which you can obtain via the 'ATI' command): Version 0.7.7 The following AT commands and features were added in the 0.7.7 release: Added AT+BLEUARTTXF (F for force) to immediately send the specified data out in an BLE UART packet (max 20 bytes), bypassing any FIFO delays and avoiding packets potentially being transmitted in two transactions.
The following commands were changed in the 0.7.0 release: AT+GATTADDCHAR Added a DATATYPE option to indicate the data type for the GATT characteristic's payload. Valid option are: AUTO (0, default), STRING (1), BYTEARRAY (2), INTEGER (3) Added characteristic user description option via the DESCRIPTION flag Added characteristic presentation format support via the PRESENTATION flag AT+GAPINTERVALS Added a new 'adv_lowpower_interval' parameter, default value is 417.5 ms.
AT+EDDYSTONEURL Update the URL for the beacon and switch to beacon mode AT+EDDYSTONEENABLE Enable/disable beacon mode using the configured url AT+EDDYSTONECONFIGEN Enable advertising for the the Eddystone configuration service for the specified number of seconds AT+HWMODELED Allows the user to override the default MODE LED behaviour with one of the following options: DISABLE, MODE, HWUART, BLEUART, SPI, MANUAL AT+BLECONTROLKEY Allows HID media control values to be sent to a bonded central device (volume, sc
The following AT commands were changed in the 0.5.0 release: ATI (http://adafru.it/iCs) The SoftDevice, SoftDevice version and bootloader version were added as a new (7th) record. For Ex: "S110 7.1.0, 0.0" indicates version 7.1.0 of the S110 softdevice is used with the 0.0 bootloader (future boards will use a newer 0.1 bootloader). Other notes concerning 0.5.0: Starting with version 0.5.
GATT Service Details Data in Bluetooth Low Energy is organized around units called G ' ATT Services (http://adafru.it/iCp)' and 'GATT Characteristics'. To expose data to another device, you must instantiate at least one service on your device. Adafruit's Bluefruit LE Pro modules support some 'standard' services, described below (more may be added in the future).
UART Service Base UUID: 6E400001-B5A3-F393-E0A9-E50E24DCCA9E This service simulates a basic UART connection over two lines, TXD and RXD. It is based on a proprietary UART service specification by Nordic Semiconductors. Data sent to and from this service can be viewed using the nRFUART apps from Nordic Semiconductors for Android and iOS. This service is available on every Bluefruit LE module and is automatically started during the power-up sequence.
Software Resources To help you get your Bluefruit LE module talking to other Central devices, we've put together a number of open source tools for most of the major platforms supporting Bluetooth Low Energy. Bluefruit LE Client Apps and Libraries Adafruit has put together the following mobile or desktop apps and libraries to make it as easy as possible to get your Bluefruit LE module talking to your mobile device or laptop, with full source available where possible: Bluefruit LE Connect (http://adafru.
Bluefruit LE Command Line Updater for OS X (http://adafru.it/pLF) (Swift) This experimental command line tool is unsupported and provided purely as a proof of concept, but can be used to allow firmware updates for Bluefruit devices from the command line.
ABLE (http://adafru.it/ijB) (Cross Platform/Node+Electron) ABLE (http://adafru.it/ijB) (Adafruit Bluefruit LE Desktop) is a cross-platform desktop application based on Sandeep Misty's noble library (http://adafru.it/ijC) and the Electron (http://adafru.it/ijD) project from Github (used by Atom). It runs on OS X, Windows 7+ and select flavours of Linux (Ubuntu tested locally).
This isn't an actively support project and was more of an experiment, but if you have a recent Macbook or a Raspberry Pi and know Python, you might want to look at Adafruit_Python_BluefruitLE (http://adafru.it/fQF) in our github account. Debug Tools If your sense of adventure gets the better of you, and your Bluefruit LE module goes off into the weeds, the following tools might be useful to get it back from unknown lands.
BLE FAQ Can I talk to Classic Bluetooth devices with a Bluefruit LE modules? No. Bluetooth Low Energy and 'Classic' Bluetooth are both part of the same Bluetooth Core Specification -- defined and maintained by the Bluetooth SIG -- but they are completely different protocols operating with different physical constraints and requirements. The two protocols can't talk to each other directly.
perform a factory reset. If this doesn't work, you may need to reflash your firmware starting from DFU mode, which can be done in one of the following ways: Bluefruit LE Connect (Android) Place the module in DFU mode (constant LED blinky) Open Bluefruit LE Connect Connect to the 'DfuTarg' device Once connected, you will see a screen with some basic device information. Click the '...' in the top-right corner and selectFirmware Updates Click the Use Custom Firmware button Select the appropriate .hex and .
Transitioning between the two board types (sniffer and Bluefruit LE module) is unfortunately not a risk-free operation, and requires external hardware, software and know-how to get right, which is why it isn't covered by our support team. That said ... if you're determined to go down that lonely road, and you have aSegger J-Link (http://adafru.
iPhone 5/6 + IOS 8.x with nRF8001 1 packet * 20 bytes * 1/0.030 s = 0.67 kB/s = 5.3 kbps Nexus 4 4 packets * 20 bytes * 1/0.0075 s = 10.6 kB/s = 84 kbps Nordic Master Emulator Firmware (MEFW) with nRF51822 0.9.0 1 packet * 20 bytes * 1/0.0075 = 2.67 kB/s = 21.33 kbps Nordic Master Emulator Firmware (MEFW) with nRF51822 0.11.0 6 packets * 20 bytes * 1/0.
# Start gatttool, pointing to the UART device found above $ sudo gatttool -b D6:4E:06:4F:72:86 -I -t random --sec-level=high [D6:4E:06:4F:72:86][LE]> connect Attempting to connect to D6:4E:06:4F:72:86 Connection successful # Scan for primary GATT Services [D6:4E:06:4F:72:86][LE]> primary attr handle: 0x0001, end grp handle: 0x0007 uuid: 00001800-0000-1000-8000-00805f9b34fb attr handle: 0x0008, end grp handle: 0x0008 uuid: 00001801-0000-1000-8000-00805f9b34fb attr handle: 0x0009, end grp handle: 0x000e uuid:
Can I use the IRQ pin to wake my MCU up from sleep when BLE UART data is available? No, on SPI-based boards the IRQ pin is used to indicate that an SDEP response is available to an SDEP command. For example, when you sent the `AT+BLEUARTRX` command as an SDEP message, the Bluefruit firmware running on the nRF51822 will parse the message, prepare an SDEP response, and trigger the IRQ pin to tell the MCU that the response is ready.
Device Recovery Sometimes, bad things unfortunately happen. Thankfully, 99% of the time it's purely a SW issue and the Bluefruit devices have a robust bootloader with some fail safes that can almost always recover your device. How to Recover a Bluefruit Board 1. Force DFU Mode at Startup The first step is to force your board into a special bootloader mode, which will prevent any faulty user sketches or corrupted config data from causing problems.
Leave the pin set to GND (or hold the DFU button down) for >5 seconds until the BLUE status LED starts to blink Remove the DFU jumper cable or release the DFU button This will cause a factory reset which will wipe all config data, and should restore your board, getting you back to a normal state in most situations! Still Having Problems? Hop on over to our support forums (http://adafru.
Downloads Files MDBT Datasheet (http://adafru.it/oYE) EagleCAD PCB files on GitHub (http://adafru.it/rDV) Fritzing object in the Adafruit Fritzing Library (http://adafru.it/aP3) Schematic Board Layout All measurements are in inches. © Adafruit Industries https://learn.adafruit.
© Adafruit Industries Last Updated: 2017-04-24 08:30:29 PM UTC Page 115 of 115