Circuit Python Watch Status

It's been a bit since I've posted on my round screen watch project. Most of my time has been taken up by work, travel, and family stuff, but I did have a few seconds to add a feature or two.

New Screens

The Waveshare board I'm using has a lipo battery charger inside it, but until now I hadn't exposed it. There is now as screen that shows the current battery percentage, though I think my calculations might be off. What do you think?

I also added a screen with a timer. The actual timer itself works, but it won't alert you when the timer ends if you switch to another screen. I need to figure out some sort of a background task.

I also added a moon phase indicator using some calculations I found on the web. Again I'm not sure it's accurate, but the fun part is the star field particle effects behind the text. The hard part was figure out how to draw lots separate pixels (one for each star) without forcing the entire screen to refresh. The secret is to call bitmap.refresh() after each star is moved, rather than after drawing all the stars. If you do all the stars then you get one giant dirty rectangle that fills the whole screen and will be slow. If you call refresh after only changing two pixels (undrawing the old, then drawing the new), then in most cases you'll have a dirty rect that is only 2 or 4 pixels in size, which is super fast to draw. Even with 50 particles, the total pixels drawn with my incremental approach is still a fraction of the full 240x240 screen size.

z

Sleeping

The final big feature is making the watch sleep, though it's only partially working. The screen will turn off after N seconds of no input. This more than doubles the watch lifetime on a single charge. However, the touch sensor and CPU are still running a full power, only the screen is off. The device does have a more advanced low power mode that will wake up the main CPU when a tap is detected, but unfortunately it requires monitoring a specific interrupt pin, which CircuitPython doesn't support. There is some async io support in the form of a counter api, that I plan to investigate next.

Pausing

I'm happy with the progress of my watch, but I'm pausing this project for now while I work on a few other electronic projects. I recently built a set of animatronic eyes based on Will Cogley's video tutorial, which I plan to expand into a singing tiki head. I'm also experimenting with the new synthio CircuitPython API to build a step seqencer in a gameboy-like form factor.

As always, the full source is on github.

Talk to me about it on Twitter

Posted July 25th, 2023

Tagged: circuitpython embedded