Recently I got myself a treat: a Bangle.js Watch! โ๏ธ
Itโs a pretty awesome, open-source watch based on Espruino and Node.js, and much more! ๐ค
Read about my experiments here especially for creating a mouse-watch app with Node.js and Bluetooth Low Energy!
First of all, what is Bluetooth Low Energy?!
With Bluetooth 4.0+ you get BLE, which provides considerably reduced power consumption and lower cost Bluetooth connectivity.
Range is about the same as โclassicโ Bluetooth.
Read more about BLE ๐
https://en.wikipedia.org/wiki/Bluetooth_Low_Energy
https://www.samsung.com/in/support/mobile-devices/what-is-bluetooth-low-energy-ble-technology/
Smart Watch
Bangle.js, aka Nodewatch is "The Worldโs first Open Source
Hackable Smart Watch"
Bangle.js is waterproof and AI enabled and comes with bluetooth low energy, GPS, a heart rate monitor, accelerometer and more! ๐ธ
Read more about the features, specs and ecosystem on https://banglejs.com/
For documentation refer to https://www.espruino.com/Bangle.js
With the espruino
npm package, I am able to discover BLE devices.
Here for example my Bangle.js Watch is discovered
To develop apps for it, I found a nifty npm package called create-bangle-app
.
It worked, after a few adjustments.
Nevertheless, I used it to continually broadcast the Accell values over BLE.
So the watch sends x, y, z accel values over Bluetooth!
Connect to Bangle with Node.js
Then on the Node.js side, I have a script that discovers BLE devices and connects to the Bangle Watch.
To read the BLE message payload, I simply check if the contents look correct (an array of 3 numbers for x, y, z accel)
Once the new mouse position is calculated, I can use robotjs
to move the mouse to the correct position: