Everyone has a wee song to sing to while washing your hands for 20 seconds, since I had Adafruit’s Circuit Playground Express handy, why not create a visual countdown.
👉 You will need:
- 1 x Circuit Playground Express (aka CPX)
- 1 x MicroUSB to USB cable (so the CPX can talk to your computer)
- Editor of choice, I chose Mu Editor as it recognises Adafruit components and quick way to change and upload code as well as debugging, etc.
- CircuitPython for CPX installed
- Battery to power the CPX
🧐 Why did I choose Adafruit’s Circuit Playground Express?
I had one around and I wanted to put something useful on it, plus I want to play a little more with CircuitPython. The CPX has 10 bright LEDS (Neopixels) so perfect for the 20 second countdown.
It also has a “Microphone Audio Sensor” so it can pick up sounds. And there’s already code handily written on detecting sound via Adafruit’s Sound example.
ℹ️ Check out the guided tour of the CPX here: https://learn.adafruit.com/adafruit-circuit-playground-express/guided-tour
All the elements are there, so let’s get started! 💪
🤔 What I wanted to do
- Clap hands to initiate the countdown
- Changes colour and flashes a couple of times to let you know it heard your clap, and it gives you time to turn on tap, get soup on your hands
- Each Neopixel comes on for the 1st 10 seconds going clockwise, as it reaches the end, all Neopixels turns off and each one lights up going counter-clockwise.
- When 20 seconds are done, it flashes to turn on all Neopixels to green (one colour) to state that you have comepleted the required time to wash your hands.
The Circuit Playground Express (below) and it’s casing (above).
The MicroUSB to USB cable (top left)
The Circuit Playground Express in its casing, all ready to go.
This is what happens when it’s turned on and waiting for the clap (loud sharp noise).
📽 Here’s a video of it working, my hands were sore from clapping while testing so I tapped it loudly on the casing which registers the sound as well. 😊
Finally, here’s the source code on github: https://github.com/whykay/cpx_clap_wash