The Bangle.js, an Open Sourced JavaScript-Powered Smart Watch

It may be built using off-the shelf hardware, but the firmware of this JavaScript-powered smart watch is entirely open source and hackable.

The Bangle.js smart watch. Yes, I have small wrists! (📷: Alasdair Allan)

The first micro-controller boards running JavaScript came along a bit more than six years ago now, and among them was the original Espruino board. Since then Gordon Williams, the chap behind the Espruino, has produced several other boards. His latest project however is somewhat different, because this time he is building a smart watch.

The smart watch, called Bangle.js, will be built using off the shelf hardware, with the onboard firmware entirely replaced with an open source stack built around JavaScript. So much like the PineTime, from the folks at PINE64, while the watch hardware itself can be found elsewhere, the software that makes it ‘smart’ is new, and open source.

The Bangle.js Kickstarter Video. (📹: Gordon Williams)

The project is currently raising on Kickstarter right now, and hit its funding target just 5 hours after it launched this morning at 8 o’clock British time.

Although if you can’t wait until the watch ships your best option to get your hands on the hardware right now is if you know someone that happened to be at Nodeconf EU in Ireland last weekend, who doesn’t want their new watch.

Because all of the 250+ attendees of Nodeconf EU received a beta model of the Bangle.js smart watch, and the opportunity to attend a workshop on how to use it with Tensorflow Lite for Micro-controllers.

The Hardware

The watch has a round plastic case measuring 5 × 5 × 1.7 cm, with a stainless steel bezel ring. It has an IP68 rated housing, and it claims to be waterproof down to 10 m, but still can be disassembled using just 4 screws.

Internally the hardware is built around a Nordic nRF52832 Arm Cortex-M4 processor running at 64MHz, with 64kB of RAM, 512kB of on-chip flash, and 4MB of external flash. The watch has 40kB of RAM available as program memory, while the internal 350 mAh battery should provide one week of standby time.

The watch has a heart rate monitor, a 3-axis accelerometer, a 3-axis magnetometer, as well as a piezo speaker and vibration motor. There is also a GPS/Glonass receiver, and support for Bluetooth LE with both central and peripheral support along with support for Nordic’s UART service.

The watch face is a 1.3 inch 240 × 240 pixel16-bit LCD display with two zone touch, and despite the shape of the housing, the display itself is square.

The Software

While the hardware is off-the-shelf, the firmware of the smart watch isn’t. It ships pre-programmed with the Espruino Open Source JavaScript interpreter, and can be programmed using a web-based IDE, Node.js-based command line tools, or in a graphical editor based on Blockly.

“You can easily install new apps from the web or develop your own using JavaScript or a graphical programming language (Blockly). All you need is a Web Browser (Chrome, Edge or Opera) and you can upload apps or write code to run on your watch wirelessly!”

Configuring the watch is done much like you’d do with any other micro-controller board, to the extent that the easiest way to set the time is via pushing a quick Javascript snippet to the watch via Web Bluetooth.

In much the same way as a smart phone is a computer you carry in your pocket, rather than a phone, it’s really best to think of this as a micro-controller board you wear on your wrist rather than a watch. Because, as you might expect for an open source smart watch, interacting with it is far more like using a board than using a normal wearable, although basic actions can be done using the watch's buttons, and of course you can write and add apps to give you more control. Because, just like any other smart device these days, there is an app store!

The Espurino interpreter implements the vast majority of JavaScript ES5 features and some ES6 features including; Regular Expressions, Promises, Arrow Functions, and Template Literals.

On-watch Machine Learning?

However perhaps the most interesting thing about the software on the Bangle.js is that there is TensorFlow Lite for Micro-controllers built into the firmware, so you can run machine learning models on your wrist.

Out of the box TensorFlow is used for gesture recognition, although be warned “…the model we have right now works okay for the people it was trained for, but not for anyone else — so you basically have to import your own data.”

Much like the Smart Edge Agile, that means you can build models that detect gestures using the in-built accelerometer. Simply train and test your model on your laptop with TensorFlow, convert your model to TensorFlow Lite and upload it to your watch.

The Interview

In the run up to his Kickstarter campaign going live earlier today we sat down with Williams to talk about his new smart watch, and how he sees it fitting into the embedded and wearable ecosystems.

Why are you building a smart watch?

Commercial smart watches ship with apps for common activities, but there are loads of times when what you want a smart watch to do is so niche that either nobody has done it, or the only options are too expensive. For example you may have a boat and want to know if your Anchor is slipping, or you might fly a paraglider and want to know what your rate of descent is — or to interface it to an air speed indicator.

A smart watch is an amazing collection of sensors, screen, buttons, Bluetooth radio and rechargeable battery in a tiny waterproof case, and at a much lower price than you could buy even a fraction of the component parts for. Usually they’re almost impossible to develop for, and I wanted to find a way to make these cool devices accessible to as many people as possible.

How does this fit with your previous hardware projects?

I started working on Espruino because I found developing for micro-controllers 10 years ago was an amazingly painful process. The first board I produced was pretty low-level — you could blink LEDs without soldering, but that was about it. I moved on to the Espruino Pico, which plugged into breadboard, and then Puck.js which was self-contained, and this seems like the next step — something that is totally usable with no hardware knowledge at all, but that still lets you get properly low level if you want to.

We’re seeing a few open smart watches appearing, why is that do you think?

I think there’s an increasingly large ‘trailing edge’ of smartwatch hardware that is very capable, but also simple enough to be properly ‘hackable’. Something like the Apple Watch at the cutting edge is totally unapproachable, but cheaper watches use less exotic parts like the nRF52 that are well documented and much easier to develop for.

What hardware are you using for the watch? It’s off the shelf?

Yes, it’s an existing watch, but with all the proprietary firmware replaced with our open source JavaScript interpreter. There’s an nRF52 Arm Cortex-M4 processor running at 64 MHz with 64kB RAM, 512kB on-chip flash and 4MB off-chip flash. There’s also GPS, accelerometer, magnetometer, heart rate sensor, vibration motor and piezo buzzer, with a 350 mAh rechargeable battery. It’s even waterproof to 10m.

There are cheaper watches out there that we could have used, but I feel like GPS opens up a whole world of possibilities for Bangle.js to be used on its own, rather than as a dumb terminal for your smartphone.

We’re pretty happy with the watch itself. It’s a bigger than something like an Apple Watch but it’s nice and sturdy, and crucially for those looking to go a bit further it can be opened with just 4 screws and re-assembled while still keeping it waterproof!

How easy was it to get Javascript running on the hardware?

Getting a desktop JS engine like V8 running in 64kB RAM is basically impossible, but we’ve put a lot of effort into the Espruino JavaScript interpreter over the last 7 years to make it work well on these kinds of devices. Getting a solid Bluetooth implementation for nRF52 took a lot of work, but we’d already done that for Puck.js so we’re able to reuse a lot of what we had previously.

The real challenge was creating something reliable and full-featured while having to reverse engineer all the hardware. While with some effort you can find a company making smart watches that will cooperate, the makers of the really good watches are selling so many that they’re just not interested in installing custom firmware or sharing designs, so you have to find a way around it.

Tell us about the software?

We’re running the Espruino JavaScript interpreter as Bangle.js’s firmware. Normally developing for this kind of watch would be pretty painful as you’d need to be physically connected to external hardware to write new software and debug, but having an interpreter means you can upload code and even debug completely wirelessly.

Bangle.js also contains TensorFlow Lite for Microcontrollers, so you can have simple AI running on your watch. Out of the box it’s used to recognise certain gestures with your hands, but you can use it for whatever you want, and can even update the models wirelessly as well.

On the desktop we’re able to use Web Bluetooth, and run the entire IDE in the browser so you’re always up to date and you have nothing to install. Programming Bangle.js is as easy as going to theEspurino IDE and clicking ‘connect’, and our use of Service Workers means that you can even use the IDE while offline!

In terms of what the watch comes with, we’re shipping it with a simple clock and settings app, but there’s a free ‘app store’ website that you can use to upload new applications. There will be a selection of games and utility apps (and we’re open to suggestions!), but we hope that the Espruino community will contribute many more apps as time goes on.

How can others leverage what you’re doing with the watch?

The watch is extremely developer friendly, so anyone can pick it up and develop their own applications for it. You might make something for yourself, make or download something for a friend or relative, or use it to prototype a new product.

All the software is open source so you’ll be able to see what we’ve done, or even port Espruino to run on different watches. The interpreter means that Bangle.js’s JavaScript apps should even be portable to new devices.

Does your work open up running things other than Javascript on the same hardware?

Yes, absolutely. You could just use the huge selection of transpilers to convert your language of choice to JavaScript, however all the source for Espruino on the watch will be available and we’ll be publishing our reverse engineering so you can completely replace the firmware if you want to. If there’s enough interest we’ll publish some example C code for a ‘bare bones’ application too, but there’s a good reason we chose JavaScript for Bangle.js: unless you’re willing to open the watch and solder a debugger to the SWD ports on the watch itself you’re going to find that developing with non-interpreted languages is a very slow process!

The Bangle.js campaign went live earlier today, and is currently fully funded on Kickstarter. An early bird watch costs £40 (approximately $50) plus shipping, while if you miss an early bird slot the watch will set you back £47 (approximately $60) plus shipping. Inside the box is the smart watch, and a magnetic USB charge cord.

The watches are expected to start shipping in March 2020, although if you’re desperate to get your hands on the hardware you can always grab one of the limited beta models. That will cost you £110 (approximately $130) plus shipping, but the beta units should ship next month, so you might have it in your hands in time for Christmas.

UPDATE: William's talk at NodeConf EU on the Bangle.js is now on YouTube.

Gordon Williams talking about the Bangle.js Smart Watch at NodeConf EU. (📹: NearForm)

UPDATE: There is now a new firmware build available for the Bangle.js smart watch. The main fixes for the new build are:

  • Memory fragmentation fixed - TensorFlow gesture recognition now doesn't end up giving 'out of memory' errors.
  • Graphics drawImage( ) handles transparent colours.
  • Failure to connect sometimes after a few long presses of BTN3 is fixed.
  • Watchdog reboot after enabling BLE HID is now fixed.

To put the watch into DFU mode press the top two buttons as you would for a full reboot, and then release them both while the progress bar goes across the screen. Then follow the firmware update instructions for the Puck.js.

It also looks like the NodeConf EU attendees have been busy, there are a lot of new apps appearing on the Bangle.js app store that weren't there a couple of days ago when the watch was made public.

Alasdair Allan
Scientist, author, hacker, maker, and journalist. Building, breaking, and writing. For hire. You can reach me at 📫 alasdair@babilim.co.uk.
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles