clockwise icon indicating copy to clipboard operation
clockwise copied to clipboard

BLE implementation

Open chihebdev opened this issue 2 months ago • 8 comments

Any plans to have bluetooth connectivity instead of wifi? i'm looking to build a mobile app that design and push GIF's through bluetooth something similar to this app:

https://play.google.com/store/apps/details?id=com.led.iledcolor

chihebdev avatar Sep 27 '25 05:09 chihebdev

I believe the ESP32 already have bluetooth capabilities

chihebdev avatar Sep 27 '25 05:09 chihebdev

That would be great! ESP32 does have builtin BT. Let me know what do you need from the Clockwise firmware side, I can help.

jnthas avatar Sep 28 '25 22:09 jnthas

Would be nice if the firmware expose a simple communication protocol over BT that mirrors the existing Clockwise API plus a function to push JSON updates directly over Bluetooth.

Maybe a flag to skip embedding the hosted webpage in flash, to save memory.

I'd appreciate any guidance on where you think the best entry point in the firmware would be for this.

chihebdev avatar Sep 28 '25 22:09 chihebdev

@chihebdev Let's start providing the configuration first. We could use BLE with GATT, each parameter is a characteristic, can you create an app that could read and write those characteristics?

These are all parameters available -> https://github.com/jnthas/clockwise/blob/main/firmware/lib/cw-commons/CWWebServer.h

jnthas avatar Oct 14 '25 23:10 jnthas

Sure! I can put something together for that.

chihebdev avatar Oct 15 '25 00:10 chihebdev

Hi @jnthas,

I’ve drafted an Android app that scans for the ESP32 over BLE and mirrors all parameters from CWWebServer.h as readable and writable GATT characteristics.

Once the firmware exposes these configs over BLE, the app should work with real values immediately. Let me know if you’d like me to adjust the UUID structure or parameter layout.

You can find the repo here

chihebdev avatar Nov 04 '25 04:11 chihebdev

Hello @chihebdev, thank you for that! I will take a look this weekend and let you know

jnthas avatar Nov 05 '25 11:11 jnthas

Hello @chihebdev! I have implemented BLE support in Clockwise but I'm having some problems to set the values. The app can discover the device and connect, when I try to set a value I see it was disconnected. Not sure exactly where is the problem.

Here is the branch with the changes if you can take a look. I've created 1 file called CWBLEServer that hold all the logic and changed the ´main´ to start advertising when it boots.

This is the ESP32 log you should see when it starts and connects: ´´´ Starting BLE Server... BLE: Initializing BLE Server... BLE: Device initialized as 'Clockwise' BLE: Server created BLE: Services created BLE: Device config characteristics set up BLE: Network characteristics set up BLE: Display characteristics set up BLE: Device info characteristics set up BLE: All services started BLE: Advertising started with service UUID BLE: Server initialized and advertising BLE: Advertising UUID: 11111111-0000-1000-8000-00805F9B34FB BLE: Client connected BLE: Client disconnected - restarting advertising ´´´

This is the screenshot when it connects:

Image

When I try to set a parameter

Image

When it disconnects

Image

jnthas avatar Nov 10 '25 00:11 jnthas