Quick Maker Project - Counting down 20s while you wash your hands with Circuit Playground Express
Tags: circuitpython, python, maker, adafruit
Published: 2020-06-18 17:40:36

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/sqlmx8rmolc7mrnuzkrl.png)

(Note: This is a x-post from Coding Grace)

This project was during the "you better remember to wash your hands for 20s" back in April. But I wanted to post it here as well to share with folks.

---

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](https://learn.adafruit.com/adafruit-circuit-playground-express) (aka CPX)
* 1 x MicroUSB to USB cable (so the CPX can talk to your computer)
* Laptop
* Editor of choice, I chose [Mu Editor](https://codewith.mu/) as it recognises Adafruit components and quick way to change and upload code as well as debugging, etc.
* [CircuitPython for CPX](https://learn.adafruit.com/adafruit-circuit-playground-express/circuitpython-quickstart) 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](https://learn.adafruit.com/circuitpython-made-easy-on-circuit-playground-express/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](https://learn.adafruit.com/sensor-plotting-with-mu-and-circuitpython/sound).

##### ℹ️ More info about CPX
Check out the guided tour of the CPX here: [https://learn.adafruit.com/adafruit-circuit-playground-express/guided-tour](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.

# 📸 Some pics
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/tmasfl6bnvwm04s1tily.jpg)

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/tmasfl6bnvwm04s1tily.jpg)

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/fejdaeznuyehy4vly1xw.jpg)

# 🎉 Result
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/gcfylu0jpkko9u66ir1i.jpg)

📽 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. 😊

{% vimeo 430448000 %}

##### ℹ️ Source code for project
Here's the code on github: [https://github.com/whykay/cpx_clap_wash](https://github.com/whykay/cpx_clap_wash)