Inspiration
While browsing Hacker News one day, I came across this post. It shows an intense segment of getting MicroPython running on a $3 smartwatch. I was not interested in so much work. But maybe you are. Either way, it got me thinking about MicroPython and tiny portal computing environments.
MicroPython
When I worked at Peloton, we once did a Black Girls Code event where we gave everyone a BBC microbit to tinker with. The board has 25 LEDs wired on and this acts as the primary display. In order to program the board, they wanted an easy to use and easy to learn language. Lucky for them, in 2013, Damien George had a successful Kickstarter campaign where he developed a language called MicroPython that would run on a wide array of microcontrollers. The platform was ported to the microbit and used as the primary development tool for the board. I was enamored by the ubiquity of Python in so many platforms and systems combined with it's simplicity and forgiving nature for rapid prototyping and design.
Smartwatch
So, the downsides of these microcontrollers is that they aren't packaged into something you can easily use. Maybe some have a 2 or 4 line LCD, but in general, they become large and clunky when you add a battery and a screen to the already-cumbersome boards. What if you just want a decent environment ready to go? Something that will last a long time on a charge and has a full packaging system. My Apple watch is a fairly powerful computer, even without the benefit of being tethered to a phone. But an Apple watch is expensive, hundreds of dollars generally speaking, and the barrier to entry is rather high. I wrote some watchOS apps in my past, and even with SwiftUI today, I find it to be rather difficult and unintuitive. It would be nice if you could just run whatever you wanted, but Apple's walled garden makes that impossible.
Less Smart Smartwatch
So what else is out there? Turns out that a company called Pine64 created a full array of products from microcontroller boards to phones to tablets to - you guessed it - a watch. Cheap, and inherently designed to be hackable. You can pick one up for about $50 delivered in the US (it is only $27 for the watch but another $22 for delivery or something at the time of this writing). It is entirely relative, but I found the price to be offputting. For triple, I could have an SE-edition Apple watch. It seemed far too expensive for what it was. The watch comes with InfiniTime OS installed. It allows you to write applications in C++, but not MicroPython.
WASP-OS
Enter WASP-OS, an alternative operating system created by Daniel Thompson in late 2019/early 2020. The promise of this OS was to bring MicroPython to the PineTime. Now you had a great developer experience with familiar tooling and patterns ready to go. Seems like a slam dunk! Except that $50 every time you wanted to tinker with something was a bridge too far. Luckily, WASP-OS had been improved to work on multiple different devices based on the same SoC used in the PineTime (nRF52832, in case you're curious). The two options that had any kind of documentation were Colmi P8 and Senbono K9. The K9 touch display does not work with WASP-OS, so that ruled it out right away (it only acts as a single button, pressed or not, which means there's no swipe navigation, and since half the devices had no buttons anyway, that was a non-starter).
Colmi P8
So TVC Mall has these available here for a very respectable $16.29 and $5.38 shipping. I bought two, and then I bought two more once I got the first two working. It took about a week or so to show up, but that was fine for me. After all, $20 for a MicroPython environment that lasted days on a battery, with a 240x240 screen, was a no-brainer. This is the P8b model (has an Apple-watch-like wireless charging cable, which is fine, but has a few caveats vs the P8a, which we will fix below).
Setup
It was not easy to get this working, and required multiple different things, but I will try to give you a brief run-through of what I did. Let us assume you have received the watches and charged them up. Let us also assume you have an Android device lying around and a computer running some Linux:
- The Android device did not need to be a phone, or active, or relatively new, but it did need BLE. I have half a dozen of these lying around, but I choose my Google Pixel 4 (which I had purchased for a project where I was going to write a small Android app to take a photo every 2 minutes all day every day, compress it down into an H.265 video, and upload it daily, one day I will get to it).
- You need to get an app called DaFlasher onto the phone. It is in the Google Play Store, or you could try some other way to get the APK onto your device.
- You need to get DaFitBootloader23Hacked.bin and FitBootloaderDFU2.0.1.zip linked here onto your Android device. I emailed them to myself, as one possible low-tech solution, but an SD card or a file transfer app would also work.
- You need to get the bootloader-daflasher.zip linked here onto your Android device.
- Use DaFlasher to scan for your watch (it will be called P8b). Select the DaFitBootloader23Hacked.bin file and it will ship it to the watch. This downgrades the bootloader. Then restart your Android device. Then use DaFlasher to scan for your watch (now it will be called ATCdfu). Select the FitBootloaderDFU2.0.1.zip this time. Then go back and select the bootloader-daflasher.zip file. Basically you can follow the first 5 minutes and 45 seconds of this video.
- Now, if you keep watching the video, it suggests that you can just pick the micropython.zip file (from the same place you got the bootloader-daflasher.zip file two steps above) in DaFlasher. You are more than welcome to try. I was never able to get it to transfer the file to the device. I think the reason why is the same reason why we have to do such a dance from here on out, but if you do manage to get it to work, you can skip down six steps. At this point, you are done with the Android device, you can put it back in the drawer where it belongs.
- If you need a Linux computer, you can find something in the $200-$300 range on Amazon easily (look for a renewed Dell or Lenovo machine). Then find a nice performant distro to install, like Xubuntu (or Lubuntu) and run it alongside what is almost certainly going to be Windows (GRUB will let you pick on boot). This is just for doing things that do not work on your Windows or Mac.
- Install Docker, you can use instructions like these which should work properly.
-
Install Git by running
apt install git
in a terminal. - Follow these instructions. Note that the shell may fail for multiple reasons, the three common ones are accounted for here.
-
Run
make submodules softdevice
-
Go into the tools/ota-dfu folder and follow these instructions. Remember the micropython.zip file above? You will need to download it now. Then run
wasp-os/tools/ota-dfu# ./dfu.py -z /path/to/micropython.zip -a WA:TC:HA:DD:RE:SS --legacy
. If you need your watch address, use the Bluetooth tool in Linux to search for devices and the address will be listed for the watch. It will have 6 sets of 2 characters with colons (:) between them. For me, it was F2:55:96:F3:01:28. - So now, one way or the other, micropython.zip has been sent to the watch. You should be able to see the time on the device, although, you'll notice a small problem. The colors and display are inverted! Luckily there is an easy fix described here. Those files and commands are relative to the wasp-os codebase root.