Micro:bit Dishwasher Tracking
Programming MicroPython on a micro:bit with the kids.
The kids were discussing, once again, whose turn it was to empty the dishwasher. Hard work, right? Such unfairness. While looking for a solution my daughter suggested they could sign their name on the calendar when they emptied the dishes to prevent future discussions. A great solution, but a little too easy maybe? Why not overengineer a complex solution and have some fun?
Micro:bit
I instantly ordered a micro:bit microcontroller for myself the kids. After playing a bit with the demo application my son lost interest. My daughter on the other hand figured out my masterplan and asked: “That’s one of those Scratch thingies again, isn’t it?” Well, no, Scratch is for little children you see. You on the other hand are ready for MicroPython!
We discussed what our program was going to do and wrote some quick pseudocode on a piece of paper: “When I emptied the dishwasher, I press button A and it should show my brother’s name!” Next, they designed the first letter of their name with a little drawing indicating which LEDs needed to light up to form their letter.
Using the web-based micro:bit editor and documentation we went to work. Me translating the documentation, she driving the keyboard and explaining her thinking. The best part was when we discovered the micro:bit can play little songs by stumbling on the music section in the documentation. A little later we had our first program ready: button A plays her favorite song with a little thank you message after which it shows her brother’s letter. Button B plays his song and shows her letter. The songs have an unexpected advantage: I can now hear when they finish their task!
Refactoring
Our prototype worked well for… a full day, after which the batteries died. “So, what do you do when you want to keep your game progress for later?” You save it! We reworked the code and now our micro:bit saves the last letter in a file when pressing the button and loads it back when the micro:bit starts. One week later now and we are still not out of juice!
It’s a stupidly complex solution to a simple problem, but we learned something, and best of all: we had fun!
The youngest really dislikes emptying the dishwasher. He suggested changing the code so it would switch back to his sister’s letter after pressing the button. I told him he could if he wrote the code for it. ;)