Skip to content

Conversation

Joseph-Jacobson
Copy link
Contributor

@Joseph-Jacobson Joseph-Jacobson commented Jul 23, 2025

Description

This PR enables Bluetooth Low Energy (BLE) on the EmotiBit, adding the following functionality:

  • Setup button press to switch the EmotiBit into BLE mode
  • Sending EmotiBit sensor data over UART
  • Receiving Control Packets
  • Wireless Off

ARDUINO NOTE: If you are on Arduino, please set the partition table to Huge App

NOTE: This build does NOT have time syncing enabled so all data received does not account for start time/adjustments due to latency.

This PR allows users to press the side button on start up (same time frame to get into the debug mode) to switch the EmotiBit into bluetooth mode, which is signified by a faster blinking light. A synopsis of each change is outlined in the notes for reviewer. This code was built out with this arduino example here as an example.

Requirements

Issues Referenced

None

Documentation update

None - we are not publicly releasing this PR

Notes for Reviewer

EmotiBitBluetooth.h/.cpp

This is where all the bluetooth specific functions will live and was built with EmotiBitWifi as a blueprint.

  • Begin: facilitates the bluetooth stack creation
  • Callbacks: Handles connection/disconnections/data sent
  • Send data: Handles sending data
  • Read control: Handles received data
  • Reconnect: Reestabilishes advertising

EmotiBit.h/.cpp

  • Set up: Button press during 2 second window switches the EmotiBit into bluetooth mode (same point that we get into debugger)
  • ParseIncomingControlPackets: We use bluetooth's readControl, which functions like WiFi's readControl
  • LED set up: Sets bluetooth lights to blink twice as fast
  • Wireless Off: Added provisions so wireless off works with bluetooth. NOTE: we do not entirely disable bluetooth for this mode due to deinitialization bugs. This results in a decrease in wireless off battery life compared to wifi's wireless off.

EmotiBit_stock_firemware.ino

  • onShortButtonPress edited to handle both bluetooth and wifi's wireless off modes.

board_feather_esp32.ini

  • Added huge_app.csv

Setup Flow

Setup drawio (2)

Connections Flow

Untitled Diagram drawio (2)

LED Speeds

Mode Speed
WiFi a1ux42
Bluetooth a1uxfl

Testing

All tests were run with Bluefruit Connect or nRF Connect which can be downloaded on the app store.

Results

Testing included the following feature tests. I also ensured that record begin/end would work as well.

Feature Tests

Feature Test Result Notes
Mock Data Testing ✔️
Packet Fixed Length Test ✔️
Recording Runtime Bluetooth ✔️ ~4.6 Hours
Wireless Off Recording Runtime Bluetooth ✔️ ~6.4 Hours
Record Begin over UART Bluetooth ✔️
Record End over UART Bluetooth ✔️
Setup EmotiBit in Bluetooth mode ✔️

Shared files

  • Firmware binary: [Link to firmware binary]
  • Other files.

Checklist to allow merge

  • All dependent repositories used were on branch master
  • Firmware
    • Set testingMode to TestingMode::NONE
    • Set const bool DIGITAL_WRITE_DEBUG = false (if set true while testing)
    • Update version in EmotiBit.h
    • Update library.properties to the correct version (should match EmotiBit.h)
  • doxygen style comments included for new code snippets
  • Required documentation updated

Screenshots:

Copy link

coderabbitai bot commented Sep 13, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat-blePrototype-Example

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant