Bluetooth
Bluetooth is a short-range wireless communication technology used to exchange data between electronic devices. It is widely used in smartphones, computers, headphones, speakers, automotive systems, microcontrollers, sensors and Internet-connected devices.
What Is Bluetooth?
Bluetooth is a wireless communication technology designed for short-range communication between electronic devices.
Unlike a wired serial connection, Bluetooth allows two or more compatible devices to exchange information using radio signals.
Typical Bluetooth applications include:
- Wireless headphones
- Bluetooth speakers
- Wireless keyboards and mice
- Smartphones
- Automotive systems
- IoT devices
- Microcontroller projects
- Wireless sensors
How Bluetooth Works
Bluetooth devices communicate using radio signals in the 2.4 GHz frequency range.
Bluetooth Device A
│
│ Radio
│
▼
~~~~~~~~~~~~~
│
│
▼
Bluetooth Device B
The Bluetooth radio transmits and receives packets of digital data. Communication is controlled by Bluetooth protocols that define how devices discover each other, establish connections and exchange data.
Bluetooth Frequency
Bluetooth operates in the 2.4 GHz ISM radio band.
This band is shared with other wireless technologies, including Wi-Fi and some other radio devices.
Bluetooth uses techniques designed to reduce the effects of interference and allow multiple wireless devices to operate in the same general frequency range.
Bluetooth Classic
Bluetooth Classic is commonly used for continuous wireless data streams and traditional Bluetooth applications.
It is widely associated with applications such as:
- Wireless audio
- Computer peripherals
- Serial communication
- Automotive connectivity
Bluetooth Low Energy
Bluetooth Low Energy, commonly called BLE, is designed for low-power wireless communication.
BLE is particularly useful for:
- Battery-powered sensors
- Wearable devices
- IoT devices
- Smart-home devices
- Health and fitness equipment
- Low-power controllers
BLE uses a different communication architecture from traditional Bluetooth Classic applications.
Bluetooth Classic vs BLE
| Feature | Bluetooth Classic | Bluetooth Low Energy |
|---|---|---|
| Main purpose | Continuous communication and streaming | Low-power data exchange |
| Typical application | Audio and peripherals | Sensors and IoT |
| Power consumption | Generally higher | Designed for low power |
| Data model | Depends on profile | GATT services and characteristics are commonly used |
Bluetooth Device Roles
Bluetooth communication involves different device roles depending on the Bluetooth technology and connection.
In BLE, commonly encountered roles include:
- Central
- Peripheral
A central device can discover and connect to peripherals. A smartphone is often used as a central device while a sensor or microcontroller may operate as a peripheral.
Bluetooth Pairing
Pairing is the process by which Bluetooth devices establish a trusted relationship for communication.
Device A │ │ Discovery ▼ Device B │ │ Pairing ▼ Authentication │ ▼ Connection
The exact pairing procedure depends on the Bluetooth version, device roles and security configuration.
Bluetooth Discovery
Before establishing a connection, a device may need to discover nearby Bluetooth devices.
Discovery allows a device to identify available Bluetooth devices and obtain information needed to establish communication.
Bluetooth Connection
After discovery and any required pairing or authentication, compatible devices can establish a connection.
Discovery
│
▼
Pairing / Authentication
│
▼
Connection
│
▼
Data Exchange
Bluetooth Profiles
Bluetooth profiles define how Bluetooth technology is used for particular applications.
Examples include profiles associated with:
- Wireless audio
- Hands-free communication
- Human interface devices
- Serial-style communication
- Health-related devices
A Bluetooth device may support one or more profiles depending on its design.
Bluetooth GATT
BLE commonly uses the Generic Attribute Profile, or GATT, to organize application data.
GATT organizes data into services and characteristics.
GATT
│
├── Service
│ ├── Characteristic
│ └── Characteristic
│
└── Service
├── Characteristic
└── Characteristic
Bluetooth Services
A BLE service is a logical collection of related characteristics.
For example, a temperature-sensor device could provide a service containing a characteristic representing the current temperature.
Bluetooth Characteristics
A BLE characteristic contains a particular piece of data or provides an operation through which data can be exchanged.
Characteristics can support operations such as:
- Read
- Write
- Notify
- Indicate
Bluetooth Notifications
BLE notifications allow a peripheral to send updated characteristic values to a connected central without requiring the central to continuously poll the sensor.
Sensor │ ▼ BLE Characteristic │ │ Notification ▼ Smartphone / Controller
This is useful for continuously changing sensor data.
Bluetooth Modules
Bluetooth modules integrate the radio and supporting electronics into a module that can be incorporated into another electronic system.
Common module categories include:
- Bluetooth Classic modules
- BLE modules
- Dual-mode Bluetooth modules
- Bluetooth audio modules
- Bluetooth development boards
HC-05 Bluetooth Module
The HC-05 is a commonly encountered Bluetooth Classic module in microcontroller projects.
It is commonly used to provide wireless serial communication between a microcontroller and another Bluetooth device.
Typical connections include:
HC-05 ├── VCC ├── GND ├── TXD └── RXD
The exact electrical requirements depend on the particular module and board implementation.
HC-06 Bluetooth Module
The HC-06 is another commonly encountered Bluetooth Classic serial module.
It is commonly used for simple wireless serial communication.
The module's exact behavior and configuration depend on the particular hardware version.
ESP32 Bluetooth
Many ESP32 devices include Bluetooth functionality in addition to Wi-Fi.
Depending on the ESP32 variant and software framework, Bluetooth functionality can include Bluetooth Classic, BLE, or both.
This makes the ESP32 useful for projects involving:
- Wireless sensors
- Smartphones
- Wireless control
- Bluetooth audio
- IoT devices
- Remote configuration
Bluetooth Serial Communication
Bluetooth Classic modules can be used to create a wireless link that behaves similarly to a serial connection from the microcontroller's perspective.
Microcontroller
│
UART
│
▼
Bluetooth Module
│
│ Wireless
▼
Bluetooth Device
The Bluetooth module handles the radio communication while the microcontroller communicates with the module through its serial interface.
UART and Bluetooth
Many Bluetooth modules communicate with a microcontroller using UART.
UART is a serial communication interface using signals such as:
- TX — transmit
- RX — receive
- GND — common reference
MCU TX ─────────► Bluetooth RX MCU RX ◄───────── Bluetooth TX MCU GND ───────── Bluetooth GND
TX and RX must normally be crossed between the two devices.
Bluetooth Wiring
Before connecting a Bluetooth module, check:
- Supply voltage
- Logic voltage
- UART voltage levels
- TX and RX connections
- Ground connection
- Baud rate
- Module configuration
Never assume that a module's supply voltage and UART logic voltage are identical. Check the module documentation.
Bluetooth Baud Rate
Bluetooth serial modules may communicate with a microcontroller using a configurable UART baud rate.
The microcontroller UART configuration must match the module's current serial configuration.
If the baud rates do not match, communication may produce corrupted or unreadable data.
Bluetooth AT Commands
Some Bluetooth modules provide AT commands for configuration.
Depending on the module, AT commands may be used to configure parameters such as:
- Device name
- Baud rate
- Pairing PIN
- Operating mode
- Bluetooth address
The available commands vary between module manufacturers and firmware versions.
Bluetooth Data Transfer
Bluetooth transmits data as packets rather than as a simple electrical signal between the two devices.
Application data
│
▼
Bluetooth protocol stack
│
▼
Radio packets
│
▼
Wireless transmission
│
▼
Receiver
│
▼
Application data
Bluetooth Range
Bluetooth range depends on the radio power, antenna, Bluetooth device class, environment, obstacles and interference.
Walls, metal structures and other radio devices can reduce the practical range.
The advertised range of a module should therefore not automatically be treated as its guaranteed indoor operating range.
Bluetooth Antenna
The antenna is an important part of a Bluetooth system.
A module may use:
- PCB antenna
- Chip antenna
- External antenna
The antenna should be installed according to the module manufacturer's recommendations.
Bluetooth Interference
Because Bluetooth operates in the 2.4 GHz band, it can encounter interference from other radio systems operating in the same band.
Possible interference sources include:
- Wi-Fi networks
- Other Bluetooth devices
- Wireless peripherals
- Other 2.4 GHz equipment
Bluetooth Security
Bluetooth provides mechanisms for authentication, pairing and encrypted communication.
The actual security level depends on the Bluetooth version, device capabilities and configuration.
Sensitive applications should use appropriate modern security mechanisms rather than relying on simple legacy pairing methods.
Bluetooth with a Smartphone
A smartphone can communicate with a Bluetooth-enabled electronic device for control, configuration or data collection.
Smartphone
│
│ Bluetooth
▼
Bluetooth Module
│
▼
Microcontroller
│
├── Sensor
├── Relay
├── Display
└── Motor
Bluetooth Sensor System
A Bluetooth sensor can transmit measurements wirelessly to a smartphone or another controller.
Sensor │ ▼ Microcontroller │ ▼ Bluetooth │ ▼ Smartphone │ ▼ Display / Storage
Bluetooth Audio
Bluetooth can be used to transmit audio wirelessly between compatible devices.
Bluetooth audio systems use appropriate Bluetooth profiles and audio codecs to transport the audio stream.
Examples include:
- Wireless headphones
- Bluetooth speakers
- Car audio systems
- Wireless audio receivers
Bluetooth Speaker
A typical Bluetooth speaker contains:
Bluetooth Receiver
│
▼
Audio Decoder / DAC
│
▼
Audio Amplifier
│
▼
Speaker
The exact architecture depends on the Bluetooth audio chipset.
Bluetooth Audio Modules
Bluetooth audio modules are designed specifically for wireless audio applications.
Depending on the module, features may include:
- Bluetooth audio reception
- Audio decoding
- Analog audio output
- Digital audio interfaces
- Microphone support
- Button control
Bluetooth Troubleshooting
If two Bluetooth devices cannot communicate, check:
- Power supply
- Bluetooth mode
- Device visibility
- Pairing status
- PIN or authentication
- Distance
- Interference
- Software configuration
Bluetooth Module Not Detected
If a Bluetooth module does not appear to operate:
- Check the supply voltage.
- Check the ground connection.
- Check status LEDs if present.
- Verify the module's operating mode.
- Check antenna and physical installation.
- Check whether the device is discoverable.
- Test with another compatible Bluetooth device.
Bluetooth UART Not Working
If a Bluetooth serial module connects but no data is received, check:
- TX/RX wiring
- UART baud rate
- Logic voltage
- Ground connection
- Module operating mode
- Serial settings
- Application software
MCU TX → Module RX MCU RX ← Module TX GND → GND
Bluetooth Connection Drops
Unexpected disconnections can be caused by:
- Weak signal
- Excessive distance
- Obstacles
- Radio interference
- Power-supply problems
- Firmware problems
- Incorrect connection parameters
Testing a Bluetooth Module
A Bluetooth module can be tested systematically.
- Check its supply voltage.
- Check its status indicator.
- Search for it using a compatible device.
- Pair with the module.
- Test communication.
- Verify data transmission in both directions where applicable.
Bluetooth Module Replacement
When replacing a Bluetooth module, check:
- Bluetooth version
- Bluetooth Classic or BLE support
- Profiles
- Supply voltage
- Logic voltage
- UART or other interface
- Baud rate
- Audio support if required
- Antenna configuration
- Firmware features
- Physical dimensions
- Pinout
How to Select a Bluetooth Module
- Determine whether Bluetooth Classic or BLE is required.
- Determine the required profile or data protocol.
- Determine whether audio is required.
- Check supply voltage.
- Check logic voltage.
- Check the host interface.
- Determine the required range.
- Check antenna configuration.
- Check power consumption.
- Check operating temperature.
- Check firmware and development support.
- Check certification requirements for the final product.
Bluetooth Applications
- Wireless headphones
- Bluetooth speakers
- Smartphones
- Computers
- Wireless keyboards
- Wireless mice
- Automotive systems
- Industrial equipment
- IoT devices
- Wireless sensors
- Home automation
- Robotics
- Microcontroller projects
Advantages of Bluetooth
- Wireless communication
- Low-cost modules are widely available
- Low power is possible with BLE
- Smartphones commonly support Bluetooth
- Suitable for short-range communication
- Available for data and audio applications
- Microcontrollers can easily integrate Bluetooth functionality
Limitations of Bluetooth
- Range is limited compared with many long-range wireless technologies.
- 2.4 GHz interference can affect communication.
- Different Bluetooth profiles are not interchangeable.
- Classic Bluetooth and BLE use different communication models.
- Some applications require careful power management.
- Wireless communication can introduce latency.
Common Bluetooth Design Mistakes
- Using Bluetooth Classic when BLE is required
- Using BLE when a Classic Bluetooth profile is required
- Ignoring logic-voltage compatibility
- Incorrect TX/RX wiring
- Incorrect UART baud rate
- Ignoring antenna placement
- Placing the antenna next to large metal objects
- Ignoring power-supply requirements
- Assuming every Bluetooth module supports audio
- Ignoring Bluetooth profile compatibility
Key Points
- Bluetooth provides short-range wireless communication.
- Bluetooth operates in the 2.4 GHz ISM band.
- Bluetooth Classic is commonly used for traditional Bluetooth applications and audio.
- Bluetooth Low Energy is designed for low-power applications.
- BLE commonly organizes application data using GATT services and characteristics.
- Bluetooth modules can provide wireless communication to microcontrollers.
- Many Bluetooth modules communicate with microcontrollers through UART.
- ESP32 devices can provide Bluetooth functionality without a separate Bluetooth module in supported variants.
- Bluetooth range depends on radio power, antenna, environment and interference.
- Bluetooth profiles determine how the technology is used for particular applications.
- Always check voltage levels, profiles, interfaces and Bluetooth type when selecting a module.