BLE Intercom Example
Source path: example/ble/talkback
Supported Platforms
sf32lb52-lchspi-ulp
sf32lb52-nano series
sf32lb52-lcd series
sf32lb56-lcd series
sf32lb58-lcd series
Overview
This example demonstrates how to implement BLE-based voice intercom functionality on this platform.
It leverages BLE 5.0’s Periodic Advertising and Periodic Advertising Sync features to achieve low-power, low-latency wireless intercom.
Supports multi-device networking, with up to 3 devices simultaneously connected for intercom.
Uses Opus audio codec technology to ensure high-quality voice transmission.
Using the Example
After power-on, this example automatically starts scanning to discover nearby intercom devices and establishes connections.
It also starts advertising so that other devices can discover this device.
Press the KEY1 button on the development board (corresponding to the silkscreen on the board) to start speaking; press KEY1 again to stop speaking.
When other devices are speaking, this device will automatically play their audio.
Supports system status viewing and debugging via Finsh commands.
Hardware Requirements
Before running this example, you need:
A development board supported by this example
At least two development boards for intercom testing
Audio input/output devices (microphone and speaker)
Hardware Connections
Connect the microphone and speaker according to the development board guide. sf32lb52-lcd_n16r8 sf32lb52-nano_n16r16 sf32lb52-lchspi-ulp
Compiling and Flashing
Switch to the example’s project directory and run the scons command to compile:
> scons --board=eh-lb525 -j32
Switch to the example’s project/build_xx directory and run uart_download.bat, then select the port as prompted to download:
$ ./uart_download.bat
Uart Download
please input the serial port num:5
For detailed compilation and download steps, please refer to the Quick Start Guide.
Expected Results
After the example starts:
The system automatically initializes the BLE and audio modules.
Starts scanning for nearby intercom devices and establishing connections.
When the KEY1 button is pressed to start speaking, other devices can hear clear audio; press KEY1 again to stop speaking.
When other devices are speaking, this device will automatically play the audio.
The serial port outputs relevant log information for debugging and system status monitoring.
Troubleshooting
If other devices cannot be found, check:
Ensure all devices are on the same network (using the same DEFAULT_NETWORK_CODE)
Verify that BLE functionality is properly enabled
Confirm that devices are within effective range
If audio quality is poor, check:
Whether the microphone and speaker are correctly connected
Whether audio parameter configurations (sample rate, bit depth, etc.) are appropriate
Whether there is electromagnetic interference
If the button is unresponsive, check:
Whether the button pin configuration is correct
Whether the button driver is properly loaded
Whether the button hardware connection is reliable
Reference Documentation
Opus Audio Codec Technical Documentation
RT-Thread Audio Framework Documentation
Revision History
Version |
Date |
Description |
|---|---|---|
0.0.1 |
12/2025 |
Initial version |