Bluetooth

Bluetooth

https://cdn.sparkfun.com/assets/4/b/e/e/9/5213ccb1757b7f4c568b4568.jpg

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!

https://cdn.sparkfun.com/assets/4/b/e/e/9/5213ccb1757b7f4c568b4568.jpg

  • 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
    • Runic letter ior.svg (Hagall) and Runic letter berkanan.svg (Bjarkan)

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 Argon

Example: Device Roles

  1. Single mobile phone triggers LEDs or motor connected to Argon
    • Phone is central and Argon is peripheral
    • Phone can connect to multiple peripherals
    • This is how we will use BLE

central_peripheral

Example: Device Roles

  1. Broadcast messages to many phones when people enter a concert
    • Many phone are central and Argon is peripheral

peripheral

Example: Device Roles

  1. Using Argon to read signal from Bluetooth heartrate sensor
    • Argon is central and sensor is peripheral
  2. Using Argon to communicate with another Argon over Bluetooth

    • Argon is designated central and the other is peripheral
    • This is how mesh networking works

Advertising

image description

  • 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

  • Argon
    • Use as central device to connect to sensors and other Argons
    • Use as peripheral device to receive connections from mobile devices

argon-top

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

ember iosbluetooth

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 Adafruit Bluefruit
Receive and graph sensor data

Send pre-defined commands over UART (button press and release)

Color picker

Nordic nRF Toolbox

   
nRFToolbox 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

Credits

Updated: