Most of the time, we wear masks to help us stay safe. But sometimes, it's fun to add a little life to your facewear. This mask uses an Adafruit Circuit Playground Express board to flash a shiny smile whenever you talk, using its built-in sound sensor and easy-to-learn Microsoft MakeCode programming!

This mask itself is simple to sew by hand or on a machine and comfortable to wear. It's got two layers of fabric with a pouch that can hold a filter -- or your CPX. 

It's a great project for kids (or anyone) who are just learning to sew and learning to code!

Parts List -- Electronics

About all you need for this project is a Circuit Playground Express programmable microcontoller board, a USB cable to transfer the programming from your computer to the board, and a AAA battery holder to make it portable. These are all contained in the CPX Base Kit, or you can buy what you need separately. You'll also need extension wires (one for a child, or chain two together for an adult) that can connect the board in your mask with the battery pack in your pocket.

A Black woman's manicured hand holds a round microcontroller with lit up LEDs.
Circuit Playground Express is the next step towards a perfect introduction to electronics and programming. We've taken the original Circuit Playground Classic and...
Out of Stock
Front angled shot of 3 x AAA battery holder with on-off switch and 2-pin JST PH connector.
This battery holder connects 3 AAA batteries together in series for powering all kinds of projects. We spec'd these out because the box is slim, and 3 AAA's add up to about...
In Stock
USB cable - USB A to Micro-B - 3 foot long
This here is your standard A to micro-B USB cable, for USB 1.1 or 2.0. Perfect for connecting a PC to your Metro, Feather, Raspberry Pi or other dev-board or...
In Stock
Front shot of JST-PH Battery Extension Cable.
By popular demand, we now have a handy extension cord for all of our JST PH-terminated battery packs (such as our LiIon/LiPoly and 3xAAA holders). One end has a JST-PH compatible...
In Stock
Rectangular case for Circuit Playground Express - Base Kit.
It's the Circuit Playground Express Base Kit! It provides the few things you'll need to get started with the new
In Stock

Materials List -- Household and Crafts Supplies

Other supplies you will need include:

  • 8 inch by 16 inch piece of tightly-woven cotton fabric ("quilting fabric"), preferably in a dark color
  • two (2) pieces of t-shirt yarn or other cord, about 28 inches long


  • 4 inch long piece of twist-tie or other wire
  • two (2) plastic beads with a large opening ("pony beads")
  • pair of peel-and-stick Velcro dots
  • disposible, non-woven filter layer, such as a coffee filter, one ply of paper towel, or waffle-pattern conference tote bag material.

The mask in this project is based on the "Imara mask" designed by Airigami artist Kelly Cheatle (original printable instructions here). It's a two-layer mask with a pouch to hold a disposable filter (made from a piece of non-woven material, such as a single ply of paper towel) and a casing or tunnel where you can insert a wire to make it fit better over the bridge of your nose. It also offers comfy ties that can go behind your head as well as around your ears.

All you need to make it is a rectangle of fabric (8 inches by 16 inches) and two cords made from t-shirt yarn (long narrow strips of t-shirt material pulled until they curl up).

The mask is sized for an adult, but easy to adjust by scrunching up the sides. The width when finished is 7 1/2 inches, and should fit snugly against your cheeks. If you need to make the mask smaller (or larger), just size the rectangle down (or up).

One change from the original pattern: You'll need to add a 1/2-inch gap in the stitching along the bottom to run a wire from the battery pack in your pocket to the Circuit Playground Express board inside the mask.

Here's what to do:

Before washing the mask, be sure to remove all the electronics!

Sew the Top and Sides

Fold down 3/4 inch from the top of the piece of fabric and press with an iron or your fingers. Fold up 1/2 inch from the bottom the same way.

To make a casing or tunnel that can hold a piece of wire to bend over your nose, stitch 1/4 inch from the top fold with a machine or by hand.

Turn when you reach the end, stitch down 1/4 inch, then go back to the first side -- stopping 2 inches before the end.

Fold the piece of fabric in half, wrong side out, and sew the raw sides together 1/2 inch from the edge.


Sew Side Casings to Hold the Cords

Turn the mask right side out. You can press the seam flat if you wish.

Take one of the t-shirt yarn cords and insert it into the mask. If you're machine sewing, pin the cord along one side of the mask.

Stitch a casing for the cord, about 5/8 inch from the edge, being careful not to catch the t-shirt yarn in your stitches.

Stitch the bottom of the mask closed -- stopping a little more than an inch from the side to leave an opening for the battery pack wire.

Insert the other cord along the other side of the mask. Stitch the casing to hold it closed the same way as you did the first.

Add Nose Wire and Finish the Cords

If you want to add a wire to make the mask fit better over your nose, cut a piece of wire about 4 inches long. With pliers, bend the tips over to hide the sharp ends.

Insert the wire into the opening you left in the top seam of the mask and center it. Wear the mask with the wire side facing out.

To finish the ends of the cords, you can simple knot them. To wear the mask, tie the top ends together behind your head and the bottom ends together behind your neck. You can also tie the ends of one side together to make ear loops.

Another way to finish the cords is to use beads with a large hole, like pony beads, as cord locks.

First, decide whether you want to wear the cords behind your head or as ear loops.

Then take the ends you want to connect and pinch the ends together. Use something with a blunt point to help you push both ends through the bead at the same time. Here I used a bamboo skewer with the pointy tip snipped off. 

Then cut off any extra if you wish and knot each end as before.

If you're not able to sew, you can try stapling the fabric together at the seams. Just make sure that the ends of the staples are on the outside, not touching your face!

To make the mask light up when you talk, you'll be programming the Circuit Playground Express using Microsoft MakeCode. It's really easy to learn and fun to play around with! You can use it online at the Adafruit MakeCode site, or offline with the Windows 10 app on your computer. If you've never used MakeCode before, there's a guide to getting started here.

First, you'll figure out how to program the ring of lights on the CPX to look like a mouth opening, closing, and smiling. Then you'll add code to trigger the lights using the sound sensor/microphone built into the board.

The instructions below show two ways to trigger the lights respond to your voice. One uses a pre-built code block called on loud. You can check out the completed code of that version by clicking the button here.

If you need to fine-tune your code to make your talking mask work better, go on to the steps that show you how to adjust the sound sensor to respond to the volume that you set using the sound level block. This version was adapted from the Sound Activated Shark Mask learning guide. The button below takes you to sample code using that method:

Program the Lights

The first step is to make the lights flash in a pattern that looks like a mouth talking. To do this, imagine turning the Circuit Playground Express board simulation on the screen sideways, so that the lights go across the top and the bottom.

When all the lights are lit, the "mouth" is open.

With just the bottom row lit up, the lights form a little smile.

The pattern of lights used in the example shown here is:

  • The open mouth flashes on and off twice.
  • The smile flashes on for a moment, then turns off.

You'll be building this part of the code using the show ring block from the LIGHT category of blocks in the menu column. Change the colors of the ring of lights by clicking on a color in the center of the diagram and then on the lights you want to change.

To test your program, insert the code inside the forever block that's already in the workspace whenever you open a new project. Here's how:

Program the Open Mouth

First, drag a show ring block into the workspace and insert it into the forever block. Change all the lights to white.

Then right-click on the show ring block to duplicate it, or just drag a new one over from the menu and place it under the first one. Click on the gray space in the middle of the ring, then click on every light to turn them all off.

The lights on the simulated board should start to flash on and off continually.

Program the "Smile"

Next, take another show ring block, attach it underneath the first two blocks, and turn just the lights on one side to white. (Which side depends on where you put the opening for the battery pack wire on your mask -- the JST cable plugs into the port shown at the bottom of the simulated board.)

Duplicate the block that turns all the lights off and put it at the end of the stack.

Add Repeats and Pauses

To create a pattern of flashes where the whole ring flashes twice,  drag a repeat block from LOOPS and place it around the first two show ring blocks. Change the number of repeats to 2.

Then, to adjust the timing, go back to LOOPS and drag a pause block into the stack after the repeat. Change the timing to whatever you like -- in this example, 300 milliseconds (about a third of a second). Add another pause block after the third show ring block. This one is set to 700 ms in the example.

Program the Sound Sensor/Microphone

Now it's time to add the sound sensor to trigger the pattern of lights!

Using the on loud block

From the INPUT category on the block menu, drag and drop an on loud block in the workspace.

To move the stack of code from the forever block, grab the top of the repeat block. The entire stack will come with it. Drag it inside the on loud block.

Look at the simulation of the board. Near the bottom left corner, a small round sound level indicator has appeared. It's at the midway point, which 128. (The highest it can go is 255.)

You can grab and move the indicator up and down, like a window shade. When that indicator hits about 191, the on loud command triggers the lights to flash.

Follow the instructions on the MakeCode guide to download your program to your CPX board.

Then test to see whether this will work for your mask by putting the CPX board near your mouth. Say something in your normal speaking voice.

If the lights don't turn on, go on to the next section and try creating some code that lets you adjust the sound sensor.

Using the sound level Block

From the LOOPS category on the block menu, drag and drop a while block in the workspace. Insert it inside the forever loop and around the rest of the stack of code, starting with the repeat loop.

Next, from the LOGIC category, drag and drop a pointy-tipped 0 = 0 comparison block. Change the "equal" sign to a "greater or equal to" sign. (It looks like ≤.) In the second oval, type 140 over the 0. Then drag the block over the pointy-tipped "true" space on the while block and let it click into place.

Now go to the INPUT category and scroll down until you see some oval-shaped blocks. Drag the sound level block into the workspace. Drop it over the first oval on the comparison block.

That's it! You've set the sound sensor to trigger your code when the sound level gets to 140 or above. Again, follow the instructions on the MakeCode guide to download your program to your CPX board.

Test out this setting the same way you did before and adjust it lower or higher to work with your mask.

When everything's working, go to the last page to see how to insert the electronics into your mask.

Once your mask is done and the Circuit Playground Express is programmed, you can add all the electronics to the mask!

The CPX board slips right into the filter pouch. You can carry the AAA battery pack in a pocket, or use the belt clip to attach it to a piece of clothing.

Make sure it won't snag on anything as you walk around. You may want to thread the extension wire down into your collar and under your shirt.

Don't use a LiPo or any battery that attaches directly to the CPX for this project. For safety, use an extension wire and keep the battery away from your face. If you feel the CPX board start to heat up, turn off the battery and remove the mask immediately.

Attach the JST extension wire to the battery pack. If it's not long enough to reach from the mask to wherever you are going to carry the battery, attach a second extension wire to the first.

Slide the end of the extension wire through the opening you left in the bottom seam. Thread it into the pouch and connect it to the CPX board.

To test it out, position the CPX in the middle of the mask, with the wire pointed towards the side its threaded through. In other words, the board will be sideways, with the lights positioned at the top and bottom.

Try on the mask and adjust the board so it sits over your mouth.

Then turn on the batteries and say something to see how it works!

The CPX board stays in place pretty well, but if you want to attach it to the mask and still remove it easily, use peel-and-stick Velcro dots on the back of the board and the inside of the mask pouch.

This guide was first published on Jul 03, 2020. It was last updated on Jul 03, 2020.