Lazydoro migrates to the Pi
In the previous blog post I described cushadoro and its successor, lazydoro Mk 1.
That was the first version of lazydoro, implementedin CircuitPython and based on the Adafruit Trinket M0. Today I'll describe the next stage of the project, a Raspberry Pi-based version.
I made real progress but, as you'll see, lazydoro was still not quite good enough.
Lazydoro needed unit tests
At the point were we left the project the Python code had become a little complicated. I thought I ought to do more automated testing.
It's possible to do that on CircuitMpython devices like the Trinket M0, but it's a lot easier if you canuse the standard Python libraries, including Python's unittest and mock frameworks.
I decided to migrate the project to a Raspberry Pi.
Moving to the Raspberry Pi
Explorer HAT prototype |
I liked the Explorer HAT so much that I wrote a book about it!
The first version of Lazydoro Mark 2 used an Explorer HAT, a VL53L0X sensor and a buzzer for feedback.
Migrating the code with Adafruit Blinka
Adafruit's VL53L0X library is written for CircuitPython, but the clever folk at Adafruit have come up with a library for the Pi called adafruit-blinka.
Blinka allows you to use Adafruit's CircuitPython's device libraries on a Raspberry Pi or a Jetson Nano. I found I could move the sensor code from the Trinket to the Pi without change.
I did make one change, though, taking an opportunity to enhance the hardware.
Adding the Pimoroni Blinkt!
Pi zero version with Blinkt! |
The Blinkt! has a bank of 8 multi-colour NeoPixels. There's a Pimoroni library that can set the colour and brightness of each display.
That allowed me to show how much time had passed during a Pomodoro or a break.
The project doesn't need a lot of computing power, so I decided to run it on an inexpensive Raspberry Pi Zero.
Once I had a working prototype I transferred the design to an Adafruit perma-proto bonnet.
That was good enough to demonstrate.
Featured on Hackaday!
I showed it off at a Raspberry Pint Meetup, and posted the project on Hackaday.io. To my delight it got featured, and quite a few people showed interest.
I might have stopped there, but I didn't.
The Mark 2 version was good, but not quite good enough.
Lazydoro - usable but not ideal
I used Mark 2 intermittently, but it wasn't perfect.
The ToF sensor still returned occasional spurious readings. Some were easy to fix.
The sensor sometimes returns a distance of 0 instead of the 8191 reading that means 'out of range'.That looked like an off-by-one error in the library or the hardware! I wrote a simple fix for that problem, but I found I still got occasional spurious readings.
I found the necessary change was harder that I'd hoped. I made a few attempts, but I used lazydoro less and less, and I eventually accepted the frustrations of using a web-based timer.
In November last year I started work on a new book: Give Memorable Technical Talks.
I did a lot of Pomodoro-based writing, and I longed for a better Pomodoro timer.
Next - Lazydoro Mark 3
Want to know how the search for a timer went? Look out for more revelations in the next thrilling episode!
Comments
Post a Comment