The mask is controlled by Arduino Lilypad board with FlashForth system installed on it.
FlashForth has prebuilt firmwares for Arduino boards with ATmega328P running at 16 MHz. In the LilyPad board ATmega runs at 8 MHz. I tried to build FlashForth for Lilypad, so I edited an assembler file with configuration to change the clock frequency, but after a successful build and flashing the firmware into MCU I got a trouble that there was no such a serial port terminal speed on which the correct data could be received from the board. I was stuck. I decided to change the Forth system, but installing another one (328eForth) didn't help because it appeared to be very inconvenient system to develop on. After that I tried to flash the prebuilt firmware of FlashForth that was configured to run on 16 MHz to my board running on 8 MHz, and everything worked! Even the milliseconds delay function worked right with no need to divide argument by 2 (as I expected). So I decided to stay on FlashForth when developing with Arduino boards.
The software measures the voltage at the output of the MAX4466 microphone module, converts it to a volume value and turns on the LEDs accordingly.
It is simple, and it was my way of trying the Forth language.
The 8 LEDs are connected in pairs, so we only need 4 pins of the board to control the smile. A built-in LED is used to indicate breathing.
I used a conductive thread to connect the LEDs to their pairs, and wires for the other lines.
Everything is powered by a LilyPad AAA battery module with DC-DC step-up converter.
The microphone module is attached to the inside of the mask with velcro.
So it can and should be detached before mask washing.