Recently this facemask I made went viral. A lot of people have been asking where they can buy one or how they can make one, and I’m here to show you how to make it since it is a fun and easy little project to help you get started with electronics and coding.
Disclaimer: This article contains Amazon affiliate links. If you buy the parts listed through the links posted here, it helps support me financially. Please consider doing so if you like what I do and want to see more!
The Important Parts
Flexible 8x8 LED matrix (alternatively you can use a non-flexible one as well, its not a big deal) (some other possible links if that is out of stock: here) (the important thing here is that the LEDs are WS2812 LEDs, what that means is each LED has a little chip in it that lets it be controled with a data signal. If you use another type of LED you will need to modify the code yourself)
An Arduino Nano microcontroller (this is the “brains” of the device, you want one without pins so you can solder it together in a small form factor easily)
An Electret Microphone
A rechargable 9V battery (a normal 9V battery could work as well, but for safety reasons its probably better to have something with a safety circuit in it)
A 9V battery connector
A 9V to 5V converter (The arduino has one built in, however it cannot handle the power draw that the LEDs require, so we need this one as well)
A 330Ω resistor (I got one as part of this kit)
Some Electrical Tape
Fabric from an old shirt + straps or shoelaces (for the mask itself, also please make sure the fabric is fireproof)
Optional Useful Stuff
A heat shrink (electrical tape can make due in a pinch, but the heat shrink is nice)
A digital multimeter (for ensuring your connections are correct and your electronics work)
A soldering mat
Silver Sharpie (for marking on black surfaces)
Arduino Uno (useful for prototyping without needing to solder to it)
Additionally, it can be useful to buy a few extra copies of the electronic components. Electronics are fragile and it is possible to burn them out easily if you make a mistake. Better safe than sorry!
I have uploaded the code here
A note on safety
This is a fairly easy electronics project and anyone age 15+ (or possible younger, with a lot of parental supervision) should be able to make this mask. That said, please be careful while working. Wear safety goggles while soldering or snipping connections, make sure to unplug the soldering iron when you aren’t using it, and be very careful when wearing the mask itself. Short circuits and faulty batteries could cause fires, and that’s not something you want happening to a mask stuck to your face. Make sure to use fireproof fabric and make sure you can quickly remove the mask if something goes wrong. Anyway lets go!
The main design of the mask is simple. It needs a microcontroller (the arduino nano), an LED panel, a power source (the battery), and a microphone. The LED panel has different power requirements than the arduino, so the 5V converter is used to connect the LED panel to the power source. The 330 ohm resistor is required for the data line into the LED matrix. The heat shrink is just there to cover up the resistor. I will show you step by step how to connect all the parts.
Preparing the components
Find the DIN cable on the back of the LED panel
Snip off all the cables except DIN, then strip the end off the DIN cable. The DIN (data-in) cable is used to control the color and pattern of the LEDs on the panel. Note that there are 2 green cables on this panel, one labeled DOUT and one labeled DIN. The wire you leave here MUST be the DIN panel, it will not work connected to DOUT instead.
Mark which direction the voltage converter goes in silver sharpie because we will be cutting the connectors off and it can be hard to tell. If you don’t know which side is the input and which side is the output, you can use a digital multimeter to check. The purpose of this part is to take the 9V input from the battery and provide a 5V for the LED panel (to the 5V and GND pads on the LED panel).
Snip the connectors off of the voltage converter and strip the wires. Strip more off of the input end (I left about a centimetre of wire here)
Bend one end of the resistor 90° and trim off some of the wire on it. The purpose of this resistor is because the spec sheet for the LED panel says its needed on the DIN line.
Cut off some of the excess wire on the battery connector and strip the ends. Leave about a centimeter to work with here as well. The cords here will eventually connect to the VIN and GND pins on the arduino, so you can lay it out on top of the LED panel to judge how much to cut off. Leave some wiggle room. The battery is going to power both the arduino and the LED panel.
Trim and strip 3 equal sized pieces of red, black, and blue wire for the microphone. These are about the length of the LED panel. Strip a little bit extra off of one end of the black wire (again, I stripped about a centimetre off that end). Red and black are for power and ground, and blue is for the microphone signal itself.
Upload the code to the arduino. I recommend doing this now just to make sure the controller works, since you don’t want to wait till after you solder everything together to find out that the arduino is broken. My code for the mask is available here. Once the mask is fully assembled you can still upload new code, so don’t worry too much about customizing it yet. You can follow this tutorial for how to upload code to the arduino. You will need to install the Arduino IDE and the CH340 USB driver. You can get all that software from this page.
Note: You will need to include the Adafruit NeoPixel and NeoMatrix libraries to upload the code. Follow this guide to do so.
Soldering everything together
Watch this tutorial video for how to solder then put on your safety goggles and plug in your soldering iron.
Bend the exposed ends of the 3 microphone cables 90 degrees. You can use pliers to assist with this.
Align the wires with the pins on the microphone. Black goes to GND, red goes to VCC, and blue goes to OUT.
Mount the microphone and cord upside down with the helping hands then solder the connection
Repeat for the other 2 wires
Snip off the excess wire
Visually inspect both sides of the microphone to make sure the solder connection is strong and that there is no accidental bridge between pins. If the red and black wires are shorted together anywhere it could damage the electronics and cause a fire.
Make note of this screw on the back of the microphone. I found it easier to adjust with a flat head screwdriver than a phillips. This is how you adjust the sensitivity of the microphone. You will want to be able to adjust it once the mask is complete so that it will only pick up your own voice, so make sure you don’t make it inaccessible.
Next, twist the input end of the voltage converter together with the red wire from the battery connector
Feed this through the VIN pin on the arduino and solder it in place
Next twist the black wire from the battery connector together with the black wire from the voltage converter AND the black wire from the microphone together
Feed this through the GND pin on the arduino and solder it
Untangle it a bit and make sure that the VCC and GND connections are not bridged or shorted. This is what you should have now
Next, solder the red wire of the microphone to the 5V pin on the arduino, and the blue wire to the A7 pin on the arduino. (Any of the analog pins should work for this, you will just need to adjust the code on the arduino to compensate).
Place the resistor in the D6 pin on the arduino and solder that in place as well (any of the digital pins should work for this, again you will just need to adjust the code to compensate)
You should now have this
It is now time to attach this to the LED panel. First, trim and place a wire shrink on the DIN cable on the LED panel
Next, solder the DIN cable to the resistor
Pull the wire shrink up over the exposed wire and resistor and shrink it however you wish (holding a lighter under it for a very short amount of time works well if you don’t have a heat gun)
Next solder the Red and Black output wires from the voltage regulator and solder them onto the 5V and GND pads on the LED panel (any of them should work). There is already solder on the pads from the other cables, so I just melt that with the soldering iron and press the cables into them with tweezers until they stick. But any way you can get the cables connected should work.
Visually inspect all the connections and make sure there’s no unintended shorts or bridges between cables. The electronics part of this should now be done, and if you plug in a battery the LED panel should light up and it should respond to voice!
Adjust the screw on the back of the microphone to adjust the sensitivity of the mic. You want this to be really low, so tighten it all the way and then loosen it just a tiny amount. Test it out by holding the panel up to your face and talking. It should not register any sound if you are more than a foot away from it.
Time to clean up the electronics a bit. Place some electrical tape over the exposed solder pads on the LED panel.
Then tape the rest of the components in place. Make sure you can still access the screw on the back of the microphone if you need to, and try to cover any exposed metal. You can also use hot glue if you’d like.
Congrats, the electronics are now complete! Feel free to adjust as necessary and play around with the code to customize it more to your liking. There will be a code explanation at the bottom of this article as well if you want to. At this point you should run it for a bit to make sure it’s all in working order and there’s no smoke coming off of it or anything.
Ok, I’ll admit, this is the part where I don’t really know what I’m doing. You need a basic face mask with a pocket to place the electronics in. You can make this any way you want provided that the LEDs can shine through whatever fabric you use. I don’t have a sewing kit here so I used fabric glue instead. it worked. whatever. don’t judge me.
Cut a square of fabric out from an old tshirt (or just buy some fabric). This one is about 11 inches on each side.
Fold it in half
Secure it down with some cardboard spacers
Apply fabric glue to each edge and fold them over
Press down on them until the glue sets, then leave it to dry for a bit. (You could just sew this like a normal person, but I ain’t normal)
Once it dries, remove the spacers and thread some shoelace or elastic band through the sides
One end of the mask has a pocket in it. This is the top of the mask
Place the electronics in the mask
Solder the mask to your face and you are now done!
I make no guarantees that this mask is safe or effective in stopping viruses. Please refer to the CDC guidelines for cloth mask usage for more information. This is mostly meant as a novelty. Also please wash the mask (with the electronics removed) between uses. Stay safe out there! And tweet at me if you make one of these.