The Adafruit Bluefruit LE SPI Friend is a versatile Bluetooth Low Energy (BLE) module that provides wireless communication capabilities to your projects. It is designed to interface with microcontrollers via the Serial Peripheral Interface (SPI) and is capable of acting as either a peripheral or a central BLE device. This module is ideal for adding Bluetooth connectivity to a wide range of applications, such as wearable technology, wireless sensor networks, and IoT devices.
Pin Number | Name | Description |
---|---|---|
1 | VIN | Power supply (3.3V to 5V) |
2 | GND | Ground connection |
3 | SCK | SPI Clock |
4 | MISO | Master In Slave Out (SPI Data from Bluefruit to MCU) |
5 | MOSI | Master Out Slave In (SPI Data from MCU to Bluefruit) |
6 | CS | Chip Select (Active Low) |
7 | IRQ | Interrupt Request (Active Low) |
8 | RST | Reset (Active Low) |
#include <SPI.h>
#include "Adafruit_BLE_UART.h"
// Create the bluefruit object, using SPI interface
Adafruit_BLE_UART ble(SPI_CS, SPI_IRQ, SPI_RST);
void setup() {
Serial.begin(9600);
ble.begin();
// Set BLE callbacks
ble.setRxCallback(rxCallback);
ble.setDisconnectCallback(disconnectCallback);
// Start advertising for connections
ble.startAdvertising();
}
void loop() {
// Poll the module to process incoming data
ble.poll();
}
// Callback for when data is received
void rxCallback(uint8_t *buffer, uint8_t len) {
Serial.print(F("Received: "));
for (uint8_t i = 0; i < len; i++) {
Serial.print((char)buffer[i]);
}
Serial.println();
}
// Callback for when a connection is dropped
void disconnectCallback(void) {
Serial.println(F("Disconnected!"));
ble.startAdvertising();
}
Note: Replace SPI_CS
, SPI_IRQ
, and SPI_RST
with the actual pin numbers used for Chip Select, Interrupt Request, and Reset pins, respectively.
Q: Can the Bluefruit LE SPI Friend be used with a 5V microcontroller? A: Yes, but ensure that the logic levels for SPI communication are shifted down to 3.3V to avoid damaging the module.
Q: How many devices can the Bluefruit LE SPI Friend connect to at once? A: The module can maintain a single connection as a peripheral device. As a central device, it can theoretically manage multiple connections, but this is limited by memory and processing constraints.
Q: What is the range of the Bluefruit LE SPI Friend? A: The range is typically up to 30 meters (100 feet) in open space, but this can be reduced by obstacles and interference.
Q: How do I update the firmware on the Bluefruit LE SPI Friend? A: Firmware updates can be performed using the Bluefruit LE Connect app available for iOS and Android devices. Instructions are provided in the Adafruit Learning System guides.