BLE Interface
NeuroFocus V4 supports Bluetooth Low Energy for wireless data streaming.Overview
BLE mode lets you:- Stream EEG data wirelessly
- Control the device remotely
- Build mobile or web apps
- Monitor from a distance
BLE Service Details
Device Name: NEUROFOCUS_V4 Service UUID:0338ff7c-6251-4029-a5d5-24e4fa856c8d
Characteristics
Data Characteristic- UUID:
ad615f2b-cc93-4155-9e4d-f5f32cb9a2d7 - Properties: READ, NOTIFY
- Use: Receive EEG data stream
- Format: 8-byte ASCII string
- UUID:
b5e3d1c9-8a2f-4e7b-9c6d-1a3f5e7b9c2d - Properties: WRITE, WRITE_NO_RESPONSE
- Use: Send commands to device
- Format: Single ASCII character
Connecting
From Linux
From Python
From Web Browser
Commands
Send these via the Command Characteristic:| Command | Byte | Action |
|---|---|---|
| Start | b | Begin streaming |
| Stop | s | Stop streaming |
| Reset | v | Reset ADC |
Data Format
Data arrives as 8-byte ASCII strings:Auto-Start Behavior
When BLE is enabled in firmware, streaming starts automatically on connection and stops on disconnection. To disable auto-start: Editsrc/main.cpp and remove this code:
Troubleshooting
Can’t Find Device
Check:- BLE enabled in config.h
- Firmware uploaded successfully
- Device powered on
- Bluetooth enabled on your computer/phone
- Power cycle the device
- Restart Bluetooth on your computer
- Move closer to the device
Connection Drops
Causes:- Out of range (>10m)
- Interference from other devices
- Low battery
- Stay within 5m
- Reduce WiFi/BLE interference
- Check battery voltage
No Data Received
Check:- Subscribed to notifications on Data Characteristic
- Streaming started (sent ‘b’ command or auto-started)
- Device is streaming (check Serial output)
Invalid Data
Check:- Reading correct characteristic UUID
- Decoding as ASCII string
- Converting string to integer
Performance
Data Rate
At 660 SPS:- 660 readings per second
- ~5280 bytes per second
- Well within BLE bandwidth
Latency
Typical latency:- BLE connection: ~30-50ms
- Notification interval: ~7.5ms (connection interval)
- Total: ~40-60ms end-to-end
Range
Typical BLE range:- Indoor: 10-20 meters
- Outdoor: 30-50 meters
- With obstacles: 5-10 meters
Building Apps
Mobile Apps
Android (Java/Kotlin):- Use Android BLE API
- BluetoothGatt for connection
- GattCallback for notifications
- Use CoreBluetooth framework
- CBCentralManager for scanning
- CBPeripheral for connection
Desktop Apps
Python:- Use
bleaklibrary (cross-platform) - Simple async API
- Works on Windows, Mac, Linux
- Use
noblelibrary - Event-based API
- Cross-platform
Web Apps
Requirements:- HTTPS connection (or localhost)
- Chrome/Edge browser (Web Bluetooth support)
- User gesture to trigger connection
- No installation needed
- Works on desktop and mobile
- Easy to share
Security
Pairing
NeuroFocus doesn’t require pairing. It uses “Just Works” pairing mode. Implications:- Anyone can connect
- No encryption by default
- Not suitable for sensitive data
- Implement application-level encryption
- Use pairing with PIN
- Require authentication
Data Privacy
BLE data is visible to nearby devices that know the service UUIDs. Best practices:- Use in private locations
- Don’t transmit personally identifiable information
- Encrypt sensitive data at application level
Advanced Usage
Multiple Clients
The firmware supports only one BLE connection at a time. Connecting multiple clients:- Add BLE relay server
- Use Serial-to-BLE bridge
- Implement BLE mesh (advanced)
Custom Characteristics
To add custom characteristics:- Edit
src/ble_manager.cpp - Create new characteristic
- Add read/write handlers
- Update UUIDs in documentation
OTA Updates
To add over-the-air firmware updates:- Add OTA characteristic
- Implement update protocol
- Handle firmware chunks
- Verify and flash new firmware