Proximity Spotter
Demonstrates how to scan for nearby beacons and get information about spotted devices
Overview
The proximity spotter example scans for surrounding Bluetooth LE beacons. If any are detected, the application controlls the brightness of an LED on the device based on the RSSI of the received advertising packet.
Since scanning operations and the LED can consume significant amounts of power, the application uses the device's on-board accelerometer to detect when it is in motion. Scanning only occurs during a window of time after movement is detected. At other times, the device enters a low-power idle mode.
The proximity spotter application
Source Code
The source code for this app is provided in the proximity-spotter
directory of the blecon-oem-device-firmware
repository: https://github.com/blecon/blecon-oem-device-firmware/tree/main/apps/proximity-spotter
Supported Devices
This code supports the following Zephyr board types:
mkbnl02sn/nrf54l15/cpuapp
- MOKO SMART L02S-BCN Smart Beacon
Configuration Options
Configurations for each board type is found in the configuration
sub-directory.
Proximity Thresholds
PROXIMITY_RSSI_THRESHOLD
- Sets the minimum RSSI value for a device to register as a scan result. This setting allows the device to ignore weak signals from distant devices.PROXIMITY_RSSI_MIN_BRIGHTNESS
,PROXIMITY_RSSI_MAX_BRIGHTNESS
- Sets the mapping of RSSI value to minimum (off) and maximum LED brightness levels. RSSI values that lie outside of this range map to the minimum and maximum brightness levels. RSSI levels between these values are interpolated using an exponential function so that small changes in RSSI when the devices are nearby produce perceivable changes in brightness.
Motion Sensitivity
The MOTION_ACC_THRESHOLD
constant in src/main.c
can be adjusted to set the threshold for the device to detect motion (and activate scanning). Units are in m/s^2.
LED mapping
LED mappings are configured in the app.overlay
file for the selected board under the chosen
node. The blecon-led-proximity
property must point to a PWM-capable LED node to display proximity to a nearby beacon.
The blecon-led-status
property can be assigned to an LED device to configure the LED used to show Blecon status like whether the device is announcing its ID and connected to Blecon.
Blecon LED Status Library
To display Blecon connection status on LEDs, the BLECON_LED_LIB
option must be enabled. For devices with limited memory, this library can be disabled to reduce the application's memory footprint.
Last updated