Bluetooth
Bluetooth
What is Bluetooth?
Review: Communication
- WiFi and Cellular
- Bluetooth Low Energy (BLE)
- Ex: Communication between smart watch and phone; wireless headphones
- Range: ~1200+ ft
- Near-Field Communication (NFC)
- Ex: Contact-less payment like Apple Pay
- Range: 4 inches
Bluetooth
- Set of protocols / standards for communicating wirelessly on 2.4 GHz frequency (same as WiFi)
- Ubiquitous: uses include headphones, game controller, stylus, keyboard / mouse, speakers, mobile phones
- We will focus on Bluetooth Low Energy (BLE)
- Subset of Bluetooth that is low-cost, low power
- Also called “Bluetooth 4.0” or “Bluetooth Smart”
Fun Fact!
- Bluetooth is named for Harald Bluetooth, a 10th Scandanavian king who unified parts of Denmark and Norway
- Bluetooth logo is a combination of his initials
Device Roles
- Each device has a General Access Profile (GAP) which defines how it operates in relation to other devices
- Central devices typically have more computing power and battery life such as phones and computers
- Peripheral devices are lower cost and lower power such as a heart rate sensor or microcontroller like Photon 2
Example: Device Roles
- Single mobile phone triggers LEDs or motor connected to Photon 2
- Phone is central and Photon 2 is peripheral
- Phone can connect to multiple peripherals
- This is how we will use BLE
Example: Device Roles
- Broadcast messages to many phones when people enter a concert
- Many phone are central and Photon 2 is peripheral
Example: Device Roles
- Using Photon 2 to read signal from Bluetooth heartrate sensor
- Photon 2 is central and sensor is peripheral
-
Using Photon 2 to communicate with another Photon 2 over Bluetooth
- Photon 2 is designated central and the other is peripheral
- This is how mesh networking works
Advertising
- Peripheral devices broadcast messages announcing their presence and what services they support
- Intervals are 20 ms to 10 s
Connecting to Peripherals
- Connection between central and peripheral devices is managed through a General Attribute Profile (GATT)
- Devices advertise Services and Characteristics
- Services are collections of related objects called characteristics that describe a device functionality
- Characteristics are specific values for data from the device
- Each is identified by either a 16 bit or 128 bit UUID (unique ID)
Sample Services
- Glucose monitoring
- Health thermometer
- Heart rate
- Pulse oximter
- Weight scale
Sample Characteristics
- Last name
- Longitude
- Rainfall
- Resting heart rate
- Glucose measurement
Specific Example
- Service: Health thermometer (ID: 6153 or 0x1809)
- Used for communication of temperature value from sensor
- Characteristics: Temperature measurement (ID:10870 or 0x2A1C)
- Temperature (actual temperature)
- Temperature type (e.g. mouth, armpit, ear, etc.)
- Interval (time between reading)
Making the Connection
- Photon 2
- Use as central device to connect to sensors and other Photon 2s
- Use as peripheral device to receive connections from mobile devices
Connecting with Mobile Apps
-
There are many great resources and tools online to create iOS and Androids to communicate over BLE
-
This is definitely the best option for a commercial product
Making the Connection: Custom Mobile Apps
Connecting with Mobile Apps
- Building a mobile app is beyond the scope of this class, but we can use free testing apps to explore BLE functionality
Adafruit Bluefruit
![]() |
Adafruit Bluefruit Receive and graph sensor data Send pre-defined commands over UART (button press and release) Color picker |
Nordic nRF Toolbox
![]() |
Nordic nRF Toolbox Test specific BLE services such as temperature and glucose monitor Send arbitrary string commands over UART (button press only; not press and release) |
References
- Adafruit Bluefruit Guide
- List of Official Bluetooth Services
- List of Official Bluetooth Characteristics