Download as pdf or txt
Download as pdf or txt
You are on page 1of 27

instructables

Neopixel LED Face Mask

by AGBarber

Hi everyone, in this Instructable I'm going to show you how to make an animated face mask using WS2812b LEDs
(Aka Neopixels). That description doesn't really do it justice, so go check out the video above! Please note that many
of the animations use randomly chosen colors, so you'll get di erent e ects each time. I thought this would be fun
to wear around during the current pandemic while also helping to keep other people safe. The mask fully covers
your mouth and nose and while remaining easy to breath through. Obviously it's not medically rated, but it should
capture any moisture you exhale, and so should be safe to wear while out and about. Just to be certain you are
keeping yourself and others safe, I suggest wearing a normal cloth mask underneath mine. This also helps keep the
mask clean, as you're basically limited to lightly soaking the back of the mask with soapy water otherwise (or using
a UV light for straight disinfection).

I should also add that the LEDs are not super visible in direct sunlight, but they certainly are in any shade or
indoors.

The mask uses 104 WS2812b LEDs, assembled from sections of commonly available 144 LEDs/m LED strip.
WS2812b's are individually addressable, meaning that you control the color of each led. This lets you create almost
any e ect you can imagine (as long as you can code it). If you're not sure what e ects you might like, or don't want
to write a bunch of code, don't worry; I've written code to control the mask, including 41 di erent e ects, which
you can control using a series of buttons. The LEDs are controlled using a Wemos D1 Mini, an Arduino compatible
micro-controller featuring an ESP8266 as the processor. This gives you plenty of memory and power to run as many
e ects as you'd like. It also gives you access to WiFi functionality (although not currently implemented in my code).
The mask is powered externally via a 1S LiPo cell. Although the mask can run for a long time on just one cell, by
keeping the cell external, you can easily swap in a fresh one. The all the components are mounted on custom PCB's
(except the LED strip).

You have two options when assembling the mask controller:

1. Follow the steps in this Instrucable using a few separate PCB's all designed by me. You will have to do a bit of
soldering to wire everything together.

You can nd all the PCBs here (Click on the link in Github and there should be a download button on the right hand
side):

https://github.com/AlbertGBarber/General-PCBs/tree... (Use 3v3 Reg version)

https://github.com/AlbertGBarber/General-PCBs/tree...

Neopixel LED Face Mask: Page 1


and the 3D Printed parts here:

https://github.com/AlbertGBarber/Pixel-Mask/tree/m... (Use V1 Box Parts)

2. Use a single, all-in-one PCB designed by me to mount all the components. This is easier to assemble than option 1,
but I have not tested the board myself. I designed the board after assembling the original mask. I have not built
another one, and so I have not tested the board. That said, it is essentially just a combination of the boards from
option 1, and so I'm very con dent it will work without any issues. It will also give you the option of adding a
MAX4466 mic (for audio reactive e ects) and a HC-05 Bluetooth breakout board, although my code currently
doesn't incorporate either of them. I do not have assembly pictures for you to follow for this option, but the steps
mostly match option 1, and I will add notes for option 2 when needed.

You can nd the PCB here (Click on the link in Github and there should be a download button on the right hand
side):

https://github.com/AlbertGBarber/General-PCBs/tree...

and the 3D Printed parts here:

https://github.com/AlbertGBarber/Pixel-Mask/tree/m... (Use V2 Box Parts)

Regardless of which option you choose, both boards will require some SMD soldering, but nothing smaller than
0805, which can be soldered by hand with a ne-tip iron. Finally, you will need access to a 3D printer to make a few
mechanical components.

I recommend reading through the whole Instrucable to familiarize yourself with the steps and components. This is
especially true for option 2 as you'll have to rely on my notes over pictures.

One note: the mask is powered using an external LiPo battery. These batteries can be dangerous if miss-treated. If
you do not have any experience with LiPo's I recommend you do some research into them before attempting this
build.

If you have any questions, please leave a comment, and I'll get back to you.

Supplies:

(You might be able to nd most of the parts for lower cost at places like Aliexpress, Ebay, Banggood, etc)

PCBs :

If you're building option 1 you need to order two PCBs: One Wemos LiPo Charger Combo board and one Triple Flat
tactile button board. You can nd both these at the Github links above.

If you're building option 2 you just need one PCB: a Wemos LiPo Button Combo board. You can also nd it using the
Github links above.

Neopixel LED Face Mask: Page 2


If you've never ordered a custom PCB before, it's easy. I brie y go over it in Step 2 of one of my other Instrucable
here. As with that Instrucable, all the ordering defaults should be ne for this project.

Ele ct ro nic Pa rt s :

For Either Option:

Three 6x6x9mm Tactile Push-Buttons: Found Here


One JST-XH 2.5mm 2 Pin Male Connector: Found Here
One JST-XH 2.5mm 3 Pin Male Connector: Found Here
Five JST-XH 2.5mm Crimp Terminals: Found Here
2.54mm Male Headers (can probably improvise with what comes with the Wemos)
One 19 x 6 x 13 Slide Switch (these are pretty common, the actuator should be 4-5mm long): Found
here or here
Three SMD 0805 1k Resistors: Found Here
Three SMD 0805 1uf Capacitors: Found Here
Three SMD 0805 100k Resistors: Found Here
One Wemos D1 Mini V3: Found Here
One TP4056 LiPo Charger: Found Here
22Ga Silicone Wire in Various Colors: Found Here
One (or more) 1S LiPo Battery(s). The capacity is up to you, but I'd recommend 850mah as a minimum.
You can buy the one I used here or a similar one here. If you buy a di erent pack you'll have to also
design a strap mount to attach it to the mask.
One Female Connector that matches your LiPo's output connector. It'll probably be a red JST
connector: Found Here

For Option 1:

One JST-XH 2.5mm 2 Pin Female Connector: Found Here


One JST-XH 2.5mm 3 Pin Female Connector: Found Here

For Option 2:

One Right Angle JST-XH 2.5mm 2 Pin Female Connector: Found Here
One Right Angle JST-XH 2.5mm 3 Pin Female Connector: Found Here

O t he r Pa rt s :

One Airsoft Mesh Half Mask: Found Here

~40mm of 10mm Dia. heat shrink (any color, optional)

~40mm of 3mm Dia. heat shrink (any color, optional)

One 8mm M2 Screw


Neopixel LED Face Mask: Page 3
300 x 600mm (1x2 Feet) of 2mm LED Foam (Plastazote): Found Here or here or here (US seller). This
goes in the front of the mask to di use the LEDs. LED foam is great for di using, but it can be
di cult to nd, so shipping may be expensive depending on where you are. As an alternative you can
probably use felt or other fabrics with similar results, but be sure to test it rst. Helps if it's easy to
cut with scissors.I encourage you to experiment, you might nd something that works even better
than mine.

300 x 600mm (1x2 feet) of dark cloth. I don't have a link for this as I don't remember where I bought
it. This is to cover the back of the mask. Any thin fabric should do. Helps if it's easily cut-table with
scissors.

To o ls :

3D printer + 1.75mm lament


Hot Glue Gun + Hot Glue
Wire strippers
Wire cutters
Crimper for JST terminals: Found Here
Heat gun
Soldering iron w/ ne tip
PH0 screwdriver
Scissors
Small needle-nosed pliers (like for bead work)
Tweezers (for SMD placement/soldering)

https://youtu.be/gnIS7tqx5eU

Neopixel LED Face Mask: Page 4


Step 1: (Optional) Some Design Notes

These are just some notes on the general design of the mask. Re a ding t his s t e p is o pt io na l .

As with all my Instrucables, I wanted to the mask to be fairly easy to assemble, so I mostly tried to use
readily available, through-hole parts. After assembling the rst mask using a few of my own PCB's, I
thought the assembly was a bit too ddly, and so I designed an all in one PCB to make it easier.
However I didn't want to build a whole new mask, and so I don't have pictures using the all-in-one
PCB. Hopefully my notes in each of the steps will be enough for everyone.
If you'd like to tweak/view any of the PCBs you can nd them here, here, and here
Currently, when it comes to controlling WS2812b LEDs, it's hard to beat esp8266's because they
feature far more memory and processing speed than most common Arduino boards, while also
being very inexpensive. As a bonus you also get the possibility of wi .
From the set of common esp8266 breakout boards, the Wemos D1 Mini is my favorite due to its size,
availability, ease of programming (it features a ch340g usb to serial chip, so you don't need a boot
button for programming) and cost.
The Wemos is a 3.3 volt device, while WS2182b's are 5 volt. In general, this means that you need a
Neopixel LED Face Mask: Page 5
logic level converter(LLC) to communicate between the two. However, I have found that you can
power both using a 1s LiPo battery (4.2 Volts, 3.3 volts nominal) without the need for an LLC. This is
great because LiPo's are ideal for portable devices.
My previous Instrucable used an external power bank as it's power source. This was because there
was not enough room for an LiPo on the shades. On the other hand, the mask's straps have plenty of
space, so mounting a LiPo was not a problem. This is better because it keeps the mask as an all-in-
one package.
The LiPo is charged using a TP4056 breakout board. I use these all the time as they are cheap,
common, and o er a decent 1A charging current.
Each of the mask's three buttons have a debounce circuit. Theory on the circuit can be found here. I
could have just debounced in software, but I decided it was easier to add a couple of components,
and then not have to worry about it at all.
I used silicone wire for most of the wiring on the mask. Silicone wire is more exible than standard
wire, and should withstand any repeated exing from taking the mask on/o . Eventually it will
probably fail, but this may be after many thousands of exes.
Rather than wire together a bunch of individual LEDs, I used LED strip. Not only does this save on
wiring, but it also ensures than the LEDs are evenly spaced. I tried to cram as many LEDs as possible
into the mask so I went with the highest density WS2812b LED strip available (144 LEDs/m). However,
the strips do need some space around them to conform to the mask properly. The result is that the
LEDs are spaced out more horizontally than vertically. This does mean that some animations appear
stretched, but overall it's not a huge issue.

Step 2: Mask Assembly Step 1: Add a Diffuser to the Mask

Remove the straps attaching the mask harness to the will be enough room for your nose once the mask is
mask body (you may want to take a picture of the nished.
strap setup so you can re-attach it later).
Your choice of glue will depend on your di using
Place the mask on you face as if you were wearing it. material, but hot-glue worked ne for me. I
Bend the mask so that it conforms to your face's recommend only gluing around the outer rim of the
shape comfortably. mask, not to the mesh directly.

Take a section of whatever di using material you've Once the glue is dry, trim away any excess material
chosen (LED foam, felt, cloth, etc) and glue it to the from the edge of the mask with scissors/hobby
outer rim of the mask. You'll need to push the di user kife/etc. The end result should be similar to mine as
into the mask and probably trim it in certain places to shown in the image above. Note that the edge around
get it to conform the the mask's shape. The closer you the mask does not need to be super clean, as long as
can get the material to the mask's outer mesh the it still conforms to the mask's shape; you'll be covering
better. Be especially careful of the nose area; you want all this up with more fabric later anyway.
to get the material as deep as possible to ensure there

Neopixel LED Face Mask: Page 6


Step 3: Mask Assembly Step 2: Cut the LED Strip Into Sections

Cut the LED strip into sections as shown in the image above. Cut the strip along the contact areas between the
LEDs. Be sure to cut them evenly so that you have enough room to solder onto the remaining pads.

You should have 12 sections in total:

Two 5 LED long sections


Four 7 LED long sections
Two 9 LED long sections
Two 11 LED long sections
Two 13 LED long sections

For a total of 104 LEDs.

Neopixel LED Face Mask: Page 7


Step 4: Mask Assembly Step 3: Solder the LED Strip Sections Together

Arrange the LED strips as shown in the image above. Leave about a 5mm gap between each strip as shown
For WS2812b LEDs, data only ows in one direction, in the image above. Solder 22Ga wire sections to join
with each LED passing data to the next LED in line. the strip sections together. These are for power
This means that the orientation of the strip sections is distribution, we'll do the data wires in the next step.
very important. If you do not orient them correctly You do not have to follow what I've done in the
data will not be able to ow. Make sure to match the pictures exactly, as long as each section is connected
orientation shown in the the image above. to power and ground.

This step is the same for both options 1 and 2.

Step 5: Mask Assembly Step 4: Add Data Wires to the Sections

Flip the strip sections over and solder data lines a lot, as the pads are fairly small. Try to avoid heating
between each section using 22Ga wire. Use the images the strip for too long to avoid potential damage to
above as a guide. Data lines should be added such the LEDs.
that data ows out of one section and into the next in
a zig-zag pattern. If your strip has adhesive backing (Optional) At this point you should test the strip to
you'll need to remove a section of it using a hobby ensure it works properly. Skip to Mask Assembly Step
knife in order to solder on the the strip's pads. 6 and add the data input wire. Then continue on and
build the controller. Test the strip and return here to
This step is the same for both options 1 and 2. nish the mask assembly.

Make sure to tin the pads before soldering, this helps

Neopixel LED Face Mask: Page 8


Step 6: Mask Assembly Step 5: Glue the Strip Sections to the Mask

Glue the strip into the mask. Make sure the remove the paper covering any adhesive backing
orientation is correct; data should ow from left right before gluing.
(when viewed from the front). You need to bend the
strip sections to make them conform to the mask's Finally, add a ground and positive wires running from
shape. The exact position is up to you, but don't put one side of the mask to the other as pictured. This is to
the strips too high, or they'll push into your nose. ensure a steady voltage across all strip sections.

Use hot-glue to secure the strip in place. You should

Step 7: Mask Assembly Step 6: Attach Power/Ground/Data Input Wires to the Strip

Neopixel LED Face Mask: Page 9


Cut three 28cm long sections of 22Ga silicone wire. glue. Be liberal; you want to avoid any of the solder
These wires will connect the strip to the control box joints exing directly.
and will ex repeatedly when the mask is put on/o .
Silicone wires should last much longer than normal Using a crimping tool and crimp connectors, add a 3
wires. The colors are up to you. pin JST-XH male connector to the other end of the
wires. The order should be positive, data, ground. See
Solder these wires to the rst (right-most) strip section the images above. You can also add some heat shrink
of the mask. You should attach one wire to the to help keep the wires together.
ground, positive, and data pads. The data wire should
be attached to the rst pad of the rst section. Be sure Fo r o pt io n 2, t he JS T- XH o rde r is re v e rs e d,
to tin the pads rst before adding the wires. Be s o it s ho uld be g ro und, da t a , po s it iv e . If y o u
careful when soldering, you'll likely heat up any hot g e t it w ro ng it ' s no t a big de a l, y o u' ll jus t
glue in the area, which can make soldering di cult. ha v e t o re - do t he JS T co nne ct o r by
re m o v ing t he pins .
After the wires are attached secure them with hot

Step 8: Mask Assembly Step 7: Attach Cloth Backing to the Mask

Similar to Mask Assembly Step 1, glue a cloth backing can to the inside of the mask, then glue it into place
to the mask to cover up the LED strip. Any thin, light with the glue of your choice (hot glue again for me).
fabric should work. You want to be able to breath Finally, trim o any excess fabric around the edge of
through it easily. the mask. This is the last layer, so the neater the better.

Like with Step 1, try to conform the fabric as best you

Neopixel LED Face Mask: Page 10


Step 9: Controller Assembly Step 1

Grab the Wemos D1 Mini LiPo Combo Board (see connected to the power switch.
pictures). Flip the board over and nd the VIN, D5, D6,
D7, and D8 jumper pads. Leaving these pads empty Ple a s e no t e t ha t t he W e m o s LiPo Co m bo
allows you to use a logic level converter and 3.3V B o a rd is a g e ne ra l PCB t ha t I us e t o m o unt
regulator to power the LEDs, but we don't need to use W e m o s D1 M inis . It ha s a num be r o f o pt io na l
either of these for this project. Bridge each of the co m po ne nt s t ha t w e do n' t us e , s o do n' t
pads with solder as pictured. w o rry if it s e e m s like y o u' re m is s ing pa rt s a t
t he e nd o f t he a s s e m bly.
Next, cut three 55mm lengths of 22Ga wire. Solder
these to the three pads on the left side of the board. If you're doing option 2, skip this step.
Makes sure the wires are on the Wemos side of the
board as pictured. These wires will eventually be

Neopixel LED Face Mask: Page 11


Step 10: Controller Assembly Step 2

Cut two ~45mm lengths of 22Ga wire. Using two should be connected such that the negative wire is
colors will help keep things orderly. Next, strip and closest to the PCB. This will be the connection to the
solder each of the wires to the VIN +, - positions on the LiPo battery.
Wemos LiPo Combo board, as pictured. Note that I
attached one wire to the top of the board, and one Optionally you can add some 3mm heat shrink to
wire to the bottom. This helps keep the bottom of the shield the connections to the JST.
board less crowded.
If you're doing option 2, solder the 2 pin, right angle
Next, solder the two wires to a female 2 pin JST-XH JST-XH connector to the board (ignore the solder pads
connector as pictured. Pay careful attention to the under the connector). Make sure it is on the side with
connector's orientation! It should be oriented with the the TP4056 and buttons.
open side of the connector facing the bottom of the
PCB (side with the LLC and VIN jumpers) and the wires

Step 11: Controller Assembly Step 3

Neopixel LED Face Mask: Page 12


Cut two 55mm and one 35mm lengths of 22Ga wire. jumpers). The ground wire should be connected to
Use three colors if possible. Strip and solder the two the pin that is closest to the PCB. The wire connected
55mm lengths to the D8 pin and a ground pin as to D8 should be connected to the middle pin. Finally
pictured. Strip and solder the 35mm length to large the positive wire should be connected to the outer
pad on the right side of the board closest to the "ON" pin. Optionally you can use 3mm heat shrink to shield
silkscreen label. The side of the board (top or bottom) the connections. This connector will be used to pass
that the wires are on doesn't matter. power and data to the mask LEDs.

Solder the three wires to a 3 pin JST-XH female If you're doing option 2, solder a 3 pin right angle JST-
connector. Just like with the 2 pin connector, XH connector to the PCB in the appropriate place. It
orientation is critical. As pictured, the connector should be on the same side as the 2 pin JST connector.
should be oriented such that its open face faces the
bottom side of the PCB (side with the TP4056 and LLC

Step 12: Controller Assembly Step 4

Get the triple button PCB. Using clippers, cut two of If you're doing option 2, do the same steps as above,
the mounting legs o the PCB as pictured. Next, but attach the components to the Wemos Button
solder three 0805 1k, and 100k resistors and three 1uf Combo PCB instead. The buttons should be facing the
capacitors to the bottom of the PCB as indicated. side with the JST connectors.
These added components create a de-bounce circuit
for the buttons. Finally, solder three 6x6x9mm tactile
switches to the top of the PCB.

Neopixel LED Face Mask: Page 13


Step 13: Controller Assembly Step 5

Cut ve lengths of 22Ga wire: three ~20mm lengths Next solder the three 20mm lengths of wire to the K1,
and two ~25mm lengths. At least the two 25mm K2 and K3 pins on the pushbutton PCB. Then solder
lengths should be di erent colors. the other end of the wires to pins D5, D6, and D7 on
the Wemos Combo Board, as pictured. The
Now we're going to connect the pushbutton PCB to connections should be: K1 to D5, K2 to D6 and K3 to
the Wemos Combo PCB. D7. If you switch them around it's ne, but you'll have
to change a few lines of code later.
Begin by soldering the two 25mm lengths of wire to
the 5V and G pins of the pushbutton board. Then If you're doing option 2, skip this step. The buttons are
solder the other ends to VCC and GND pins on the already wired on your PCB version.
Wemos Combo board. 5V should be connected to VCC
and G connected to GND.

Neopixel LED Face Mask: Page 14


Step 14: Controller Assembly Step 6

Do this step for both assembly options 1 and 2.

Solder male 2.54mm headers to the Wemos Combo PCB for the Wemos D1 Mini and the TP4056 as pictured. You
may want to use the Wemos and the TP4056 to help align the pins. Trim o any excess pin lengths.

Neopixel LED Face Mask: Page 15


Step 15: Controller Assembly Step 7

Do this for both options 1 and 2. Under tools->board, select "LOLIN(WEMOS) D1 R2 &
Mini". Also select the port the Wemos is connected to
Before you do this, you should con rm that you can under tools. Try uploading blink (or your own favorite
program the Wemos, and that it's working correctly. test program). If everything's OK, the Wemos's LED
Begin by following the instructions here to install the should start blinking once a second.
ESP8266 core for the Arduino IDE.
Press the Wemos D1 Mini and TP4056 onto their
This allows you to program the Wemos as if it was an respective male headers. Solder them in place. Trim o
Arduino. Once installed open the IDE and connect the any excess lengths of pins.
Wemos to your computer using a micro-USB cable.

Step 16: Controller Assembly Step 8

Neopixel LED Face Mask: Page 16


Solder the three wires you attached in Controller If you're doing option 2, you should mount a 3 pin
Assembly Step 1 to the slide switch tabs. Make sure male 2.54mm header to the area labeled "Switch".
the order of the wire ends attached to the switch Mount it so the long legs are on the side with the
matches the order that they are attached to the pads TP4056.
on the Wemos Combo PCB (the middle one is the most
critical to match correctly, everything will still work, if
you switch the outer wires).

Step 17: Controller Assembly Step 9

Using a 3D printer, print out each of the parts found print two "Battery Rear Strap Mount pt 1.stl" and one
at: "Battery Rear Strap Mount pt 2.stl"

https://github.com/AlbertGBarber/Pixel- or
Mask/tree/m...
If you're using a di erent battery, then you'll have to
You'll need to print out a few copies of "Strap Cable design your own strap mount.
Guide.stl"
if you're doing option 1, print out "Box V1"
Depending on your battery mounting method (see
Final assembly Step 1) either print two If you're doing option 2, print out "Box V2"

"Battery Strap Mount V2.stl" Print three copies of the button caps for both options.

or

Step 18: Controller Assembly Step 10

Neopixel LED Face Mask: Page 17


Place all the electronics in the control box as pictured. the lid, o er-up the lid holes with the button caps.
Make sure you align the USB ports of the TP4056 and
Wemos D1 Mini with the corresponding holes in the Once it's o ered-up, glue down the pushbutton
box. The JST connectors should slide into tabbed board.
mounts. There are a couple of domed pegs for the
slide switch to rest on. If you're doing option 2, your box and board will look
a bit di erent, but you should be able to insert the
Use hot glue to secure everything in place except the board into the box without issue. As above, secure it
pushbutton PCB. with hot glue. You'll need to slip the slide switch into
position on the male headers you attached in the last
Attach the lid to the box using a length of 1.75mm step.You should cover up the pads below the switch
lament as a hinge pin. with a bit of tape to avoid shorting to the switch's
case.
Press the button caps onto the pushbuttons. Using

Step 19: Controller Assembly Step 11

Glue the "Wemos Box Strap Mount" to the control box as pictured. Make sure you leave a gap at the bottom the
insert the strap.

Neopixel LED Face Mask: Page 18


Step 20: Controller Assembly Step 12

Create an adapter between you're LiPo's output connect to positive, and ground should connect to
connector and the control box's JST-XH input ground. This is very important, you do not what to
connector. Use 22Ga silicone wire and crimp terminals. short out your battery!
In my case my LiPo has a red JST connector, so I used
the female version for my adapter. The adapter
doesn't need to be very long, just a few cm's. Fo r o pt io n 2 t he po s it iv e a nd g ro und
co nne ct io ns t o t he JS T- XH co nne ct o r s ho uld
M a ke s ure y o u pa y a t t e nt io n t o t he be re v e rs e d f ro m t he im a g e a bo v e .
co nne ct o r' s o rie nt a t io n. Po s it iv e s ho uld

Step 21: Final Mask Assembly Step 1

Neopixel LED Face Mask: Page 19


Do this for both options 1 and 2. LiPo into the mounts.

Slide three "Strap Cable Guides" along the lower right 2: Glue a pair of "Battery Rear Strap Mount pt 1"'s to a
strap of the mask's head harness. Run the cable "Battery Rear Strap Mount pt 2", as pictured. we'll
coming out of the mask through each guide. This attach it to the harness in the next step. Using this
helps keep the cable in place. option may help reduce wear on the harness's elastic
straps.
For the battery, you have two options:
Reattach the harness to the mask front.
1: Slide two "Battery Strap Mounts" along the lower
left strap of the mask's head harness. Then slide you

Neopixel LED Face Mask: Page 20


Step 22: Final Mask Assembly Step 2

Attach the control box to the mask's head harness as pin port on the control box. Make sure your wiring is
pictured. The main harness strap should slip into the correct; positive to positive, data to data and ground
control box's strap mount hooks. to ground.

Secure the control box's lid with an 8mm M2 screw. To connect the LiPo to the controller, using the
adapter, Insert the the 2 pin male JST connector into
If you're mounting the battery on the large rear strap, the corresponding 2 pin port on the control box.
hook the mount onto the strap just like the controller. M a ke s ure y o ur w iring is co rre ct , a s ho rt
co uld da m a g e y o ur LiPo a nd po s s ibly y o u a s
Slide the LiPo into the battery mount. w e ll. Po s it iv e s ho uld co nne ct t o po s it iv e ,
a nd g ro und s ho uld co nne ct t o g ro und.
To connect the LED strip to the controller, insert the
the 3 pin male JST connector into the corresponding 3

Neopixel LED Face Mask: Page 21


Step 23: Code Uploading

The code largely mirrors what I wrote for my LED Pixel Shades, so I'll repeat most of what I said there.

Neopixel LED Face Mask: Page 22


I've written code for the mask that includes 40 di erent e ects. It can be found at my Github in the folder
"Pixel_Mask_Code". Before you can upload the code to the Wemos, you'll need two libraries:

My "PixelStrip" library

The Adafruit Neopixel library

You can download the PixelStrip library from here. Download all the les and place them in a folder named
"PixelStrip" in the libraries folder of your Arduino install directory.

You can install the Adafruit Neopixel library using the Arduino IDE's library manager.

Once you've installed both libraries you can open Pixel_Mask_Code.ino and upload it to the Wemos. If everything's
good, the shades should begin cycling e ects. Your shades are now complete! :).

If something's wrong, please post a question and I'll try to help.

Cha ng ing E e ct s :
If you'd like to disable an e ect you'll rst need to nd it in the Pixel_Mask_Code.ino le. It will be in the large
switch statement in the main void loop(). The e ects aren't individually labeled, as it's hard to describe them with
just comments, so you might have to do a bit of hunting. Once you've found the e ect, you just need to change the
case number to anything higher than the total number of e ects (99 for ex) to disable it.

You're also welcome to modify or add your own e ects. To add an e ect, add it to the switch statement in the main
void loop(), and increase the "numE ects" var.

My library is capable of doing a wide range of e ects, but it is a bit di cult to work with. It originally began as just a
small storehouse for e ects, but I later extended it to run e ects across odd shapes of pixels (rings, stars, etc), so it's
become a bit jumbled. At this point I have an architecture for the library, and I fully intend to re-write it in the
future. In the meantime, the current library is fully commented and bug free (look in segmentSet.h for comments
about segments), but you'll probably have to do some experimentation to understand how each e ect works.

The Github page includes an Excell spreadsheet containing the numerical layout of the LEDs. This maybe helpful in
creating e ects.

But t o ns :
The mask control box has three buttons. When using my code, they do the following things:

But t o n 1: Ne xt E e ct (or restarts current e ect if e ect rotation is o )


But t o n 2: E e ct Ro t a t io n o n/o . This makes the current e ect repeat inde nitely
But t o n 3: Brig ht ne s s cy cle . You can adjust the increments by changing the "brightnessLevels"
array in my code.

The code stores the e ect number, brightness, and rotation on/o in ash, so they should be remembered after
turning the mask o /on. In other words, if you cycled to e ect number 5, and set the brightness to level 2 before
turning the mask o , when you next turned it on, it would start with e ect number 5 at brightness level 2.

The slide switch on the side of the control box turns the mask o and on.

Neopixel LED Face Mask: Page 23


Ple a s e no t e t ha t y o u s ho uld no t t ry t o cha rg e t he LiPo w hile t he m a s k is o n. Do ing s o w ill
pro ba bly da m a g e y o ur ba t t e ry.

If you've made it this far, thanks for reading! I hope you have fun with your mask, and stay safe. If you have any
questions, please leave a comment and I'll get back to you.

So I showed this to my friend, (I'm currently buying all the materials) and now he want's one. If it's
alright with you I was going to make one for him and I was going to charge him for only the parts.
I'm wondering if that is alright?
Thank you for asking. I'm fine with anyone making a few copies for their friends here and there. As
long as you aren't trying to mass produce them it's okay by me. Since I wrote this instructable with
the intent of teaching others, it would be nice if you explained to him a bit about how the mask
works rather than just giving it to him.
Put him to work. Got it. Thanks! :D

Note about the LED foam. It appears LED foam is just EVA foam, which is easy to find.

LED foam (plastazote) is different from normal EVA foam. It is significantly less dense, and allows
more light through. I used LED foam mainly because I already have a bunch, and it works well. It's
difficult to get directly in the US, but I have found one US seller, which I've linked to in the supplies
list. That being said, you can definitely use other materials as a diffuser, so I encourage you to
experiment.
Yeah I realized that after I posted that comment lol. However, I still think I'm gonna try EVA foam,
as it can also be molded with a hairdryer so it should contour to the mask shape nicely. I'm also
going to use 1mm EVA foam instead of 2mm since it's denser. My plan is also to use an ESP32
instead of the 8266, as I can find several models of ESP32's that have built-in lipo power/charge
circuits which will simply the build. I'll have to make some minor changes to your code for it to work
with an ESP32 but that shouldn't be too difficult.
I'll also have to redesign a 3d printed enclosure since I'm gonna use a different controller. I'm also
trying to come up with a way to use an 18650 cell for the battery, either in a separate battery box or
inside the controller box, I'm not sure which yet.
Good luck! Btw, if you do go with an ESP32, be sure to test it with the LEDs before putting
everything together. Since the ESP32 is newer, it's support is a bit more patchy than the ESP8266,
and I've had them produce visual glitches when driving ws2812b leds. I think this is fixed when
using the FastLed library, but I've been using the Adafruit one for a while, and have not had the
time to port my code over.
Hi again! Ok so yeah I tested your code with several of my ESP32's and there were definitely
some issues. Random LEDs stuck on with a random color, the last (end) 1/3 of the strip flickering,
etc. I tested the strip with one of the example sketches for the Adafruit Neopixel library and had the
same issues. Then I tested the strip with the FastLED library and it worked great. Unfortunately
porting your code to the FastLED library is beyond my skills at the moment (or would take me
forever to figure out at least lol) so I'm just gonna buy the Wemos D1 ESP8266 you used and go
from there.
Yeah, eventually I'll port my code, but until then Esp8266's seem to work best. It's not too bad tho,
you do miss out on the built-in Bluetooth and dual core capabilities of the Esp32, but overall, both
processors have plenty of memory and speed to drive most led setups.
Yeah the Bluetooth is the one reason I was hoping to use an ESP32. I wanted to try to make an
Android app that would control the mask and show a visual representation of the mask pattern
currently playing, although I wasn't sure how I was gonna do the visual representation lol. Control
Neopixel LED Face Mask: Page 24
would've been easy, but a visual representation would've taken some work as I'm not familiar yet
with the whole matrix layout code and exactly how the LED strip is controlled on a fundamental
level.
Yeah, atm, with my code, pretty much any external inputs have to be handled with interrupts. So
it's not really Bluetooth friendly. I fully intend to refractor the whole thing in the future. You could
ditch my code all together. There are a number of fastLed based libraries that support matrices and
probably have bluetooth/wifi support built-in. You would lose my effects, but it might be a good
option if you want more connectivity.
Lol yeah I can't believe I didn't realize that until you just mentioned it. It's quite obvious now looking
at the code Bluetooth would be difficult due to the interrupt nature of inputs in your code! I fully
remember seeing how it was controlled by interrupts when I looked over the code, it just didn't click
in my head that Bluetooth wouldn't work like that
Is your design inspired by this build from Reddit?
https://www.reddit.com/r/arduino/comments/b055a1/led_half_face_mask_running_on_adafruit_gemma_m0/
Not specifically, but I did do an image search for led masks to help brainstorm when first
developing this project, so maybe it popped up. I don't really remember haha.
Right on! I've built hundreds of these masks using the configuration in that post. One worry I have
with your design is with the wiring between LEDs, specifically that they're horizontal and fairly taut.
As you bend the mask throughout its life they'll slowly either break away from the contact pads or
break internally, and if they're glued over they'll be a nightmare to repair or completely ruin the
mask if the design doesn't support repairs. Also, you'll find with all the weight from your battery
pack and controller case that the straps are going to degrade pretty fast; I repair tons of masks with
that same airsoft frame and the straps lose their elasticity even with moderate use and a little
weight attached after a few months when pulled tight each time. If intended for repeated use, those
bulky addons might be better suited being worn at the waist or as part of a jacket/necklace.

As it happens I'm actually building one of these right now, my design has the controller embedded
inside the mask and runs for 1-6 hours (depending on the mode/brightness) but with half the LED
density off 3 triple A batteries.

Good things to know, and it's nice to see an alternate design. It's true that flexing the mask a lot will
damage the wiring eventually, but if you pre-bend the mask so it fits your face, it should minimize
any flexing. Likewise, the mask should be handled with some delicacy. As for the battery, I was
thinking of mounting it with the controller on the large rear strap. This should take the strain off the
elastic, as the rear strap is supported by your head when worn. I'll update the design asap.
Really great. Have to try this <3

You are a Genius! Great work!

Nice project you have build during quarantine

Just a quick thing. If you can blow out a flame with the mask on it doesn't work. It's just an easy
way to make sure the mask is efficient and works! Otherwise great project!
Good to know. You definitly cannot with my mask haha.

It's Corona Safe Then!

Neopixel LED Face Mask: Page 25


It would be really cool to redo this mask with the Adafruit Mini Skinny 144/m Neopixel strips! They
are about half the width of the normal Neopixel strips so you could fit about twice as many LED
strips in the mask. But that would also mean twice the power consumption and current, and a
major rewrite of the code
Wow! You did an awesome job! Thanks for sharing!

Just wondering.. How do you wash/clean it?


You can't really do a super intensive cleaning unfortunately. You can lightly soak the back fabric
with soapy water, but be sure to disconnect the controller first and wait until the mask is thoroughly
dry before reconnecting everything. You could also disinfect it with UV light. If you'd like the wear
the mask a lot, I'd suggest wearing a regular cloth mask underneath, to catch/absorb moisture.
I'm on it. This is going to be my next obsession for a couple weeks! :-) I'll post a picture when it's
done.
I really like the mask you used, can you post a link to it also?

There's a link to the mask in the "other parts" section of the supplies list.

Please include a link to the sketch file: Pixel_Mask_Code.ino


https://github.com/AlbertGBarber/Pixel-Mask
Great job!

Great idea!

Next, mic and audio generated patterns including some lips that follow the audio.

Haha that would be fun to add, maybe someday......

Voice-activation would add so much in meetings! I think someting along the lines of "Kit" from
knight rider?
If I'm going to make one with/for my son, I'd need only red LEDs, but RGB would add more. Also,
he's too young to know about knight rider :-)

So excited to make this with my 12yo. As masks are now the outfit du jour, this is fantastic. Thanks
so much for sharing.
Sorry, nice design BUT you should ve paid more atention to its use which is, Face Mask. Cost a
little to make it safe using two layers of fabric, and one filter
Its just as good as any other cloth mask. Just maybe a little cooler and hotter at the same time.

You could fairly easily add a filtering layer behind the leds, but it is my understanding that, in the
context of the current pandemic, a mask only needs to capture water droplets to be effective. The
cloth and foam layers I use certainly do this. You can also wear a normal cloth mask underneath
my mask, just to be safe.
I was thinking today that it would be cool to have a mask that would be able to scroll messages in
led lights. Any takers?
its so daaam awesome. i definately will try this.

Neopixel LED Face Mask: Page 26


That's a great mask! I wanna take a look at all the patterns, that's my hardest part is making cool
looking light patterns.
Thank you, my code might not be the easiest to go through, but you're welcome to try :)

Brilliant work. Excellent instructions.

Thank you :)

Impressive work!

Thanks! :)

You are a Genius! Great work!

You nailed it! Fantastic project and great result!

Thank you, btw I really like your LED Christmas tree :)

Neopixel LED Face Mask: Page 27

You might also like