Project tutorial
LED Eye Mask

LED Eye Mask © LGPL

I made a mask for Halloween. This mask has an eye of LEDs and its mouth flashes red. This mask drops children there in fear.

  • 1,138 views
  • 0 comments
  • 5 respects

Components and supplies

About this project

I made a mask for Halloween. This mask has an eye of LEDs and its mouth flashes red. This mask drops children there in fear.

Paint the Mask Black

I bought a mask and painted black with a spray.

LED Tape Processing

In order to paint the LED tape black, attach a masking tape to the light emitting part. I paint the LED black with a spray.

Attach the LED tape to the mask and wire it.

There are 68 LED cells. It is connected by one signal line.

Microphone Attachment

Attach the electret microphone board and two red LEDs to the mouth of the back of the mask.

The red LEDs glow in response to the voice.

Overall Structure

Microcontroller (Arduino Pro Mini 5V 16MHz) controls LED tape, electret microphone board, red LED.

Arduino Code

LED eye moves to the right or left and blinks randomly. The electret microphone board detects the voice and lights the red LED.

#include <Adafruit_Neopixel.h>

const int analogInPin = A0;
const int ledPin = 12;

int sensorValue = 0;
int sensorTh = 700;
int avTime = 10;

#define PIN A3
Adafruit_NeoPixel led = Adafruit_NeoPixel(68, PIN, NEO_GRBW + NEO_KHZ800);

int blackNum = 24;
int pupilNum = 12;

uint32_t color;
int brightness = 20;
byte eyeColor;

int LR =7;

//Black eye L&R animation
int blackLED[15][24] = {{12,32,35,55,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68},
{12,13,31,36,54,55,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68},
{11,13,14,30,37,53,54,56,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68},
{10,11,14,15,29,38,52,53,56,57,68,68,68,68,68,68,68,68,68,68,68,68,68,68},
{ 9,10,11,12,15,16,28,33,34,39,51,52,55,56,57,58,68,68,68,68,68,68,68,68},
{ 0, 8, 9,10,11,12,13,16,17,27,32,35,40,50,51,54,55,56,57,58,59,67,68,68},
{ 0, 1, 7, 8, 9,10,13,14,17,18,26,31,36,41,49,50,53,54,57,58,59,60,66,67},
{ 1, 2, 6, 7, 8, 9,14,15,18,19,25,30,37,42,48,49,52,53,58,59,60,61,65,66},
{ 2, 3, 5, 6, 7, 8,15,16,19,20,24,29,38,43,47,48,51,52,59,60,61,62,64,65},
{ 3, 4, 5, 6, 7,16,17,20,21,23,28,39,44,46,47,50,51,60,61,62,63,64,68,68},
{ 4, 5, 6,17,18,21,22,27,40,45,46,49,50,61,62,63,68,68,68,68,68,68,68,68},
{ 4, 5,18,19,26,41,48,49,62,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68},
{ 4,19,20,25,42,47,48,63,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68},
{20,21,24,43,46,47,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68},
{21,23,44,46,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68}};

//pupil L&R animation
int pupilLED[15][12] = {{33,34,68,68,68,68,68,68,68,68,68,68},
{32,33,34,35,68,68,68,68,68,68,68,68},
{12,31,32,33,34,35,36,55,68,68,68,68},
{12,13,30,31,32,33,34,35,36,37,54,55},
{13,14,29,30,31,32,35,36,37,38,53,54},
{14,15,28,29,30,31,36,37,38,39,52,53},
{15,16,27,28,29,30,37,38,39,40,51,52},
{16,17,26,27,28,29,38,39,40,41,50,51},
{17,18,25,26,27,28,39,40,41,42,49,50},
{18,19,24,25,26,27,40,41,42,43,48,49},
{19,20,23,24,25,26,41,42,43,44,47,48},
{20,21,22,23,24,25,42,43,44,45,46,47},
{21,22,23,24,43,44,45,46,68,68,68,68},
{22,23,44,45,68,68,68,68,68,68,68,68},
{22,45,68,68,68,68,68,68,68,68,68,68}};

//Blink animation
int eyelid = 0;
int eyelidNum[8] = {0,4,8,16,24,34,44,56};
int eyelidLED[56] = {64,65,66,67,58,59,60,61,56,57,62,63,49,50,51,52,47,48,53,54,38,39,40,41,46,55,36,37,42,43,26,27,28,29,35,44,24,25,30,31,15,16,17,18,34,45,23,32,13,14,19,20,6,7,8,9};

void blink(int eyelid, int LR) {
if (eyelid != 8){
//White eye
for(uint16_t i=0; i<led.numpixels(); i++) {
led.setPixelColor(i, led.Color(0, 0, 0, 46));
led.setPixelColor(11, led.Color(26, 26, 26));
}

//Black eye
for(uint16_t i=0; i<blacknum; i++){
led.setPixelColor(blackLED[LR][i], color);
}

//pupil
for(uint16_t i=0; i<pupilnum; i++){
led.setPixelColor(pupilLED[LR][i], led.Color(0, 0, 66));
}

//eyelid
for(int i=0; i < eyelidNum[eyelid]; i++) {
led.setPixelColor(eyelidLED[i], 0);
}
} else if (eyelid == 8){
led.clear();
}
led.show();
}

void setup() {
Serial.begin(115200);

pinMode(ledPin, OUTPUT);

led.begin();
led.setBrightness(brightness); // Initial Brightness 40
led.show(); // Initialize all pixels to 'off'

color = led.Color(0, 177, 55); //pupil color

blink(eyelid, LR);
}

void loop() {
//mic input LED
for(int i = 0; i < avTime; i++){
sensorValue += analogRead(analogInPin);
}

sensorValue = sensorValue / avTime;
Serial.println(sensorValue);

if(sensorValue > sensorTh){
digitalWrite(ledPin, HIGH);
}else{
digitalWrite(ledPin, LOW);
}

int eyeMotion = random(0, 1200);

switch (eyeMotion) {
//Right
case 10:
for(int i = LR; i < 12; i++){
if(sensorValue > sensorTh) break;
blink(0, i);
delay(random(10, 100));
LR = i;
}

if(sensorValue > sensorTh) break;
delay(random(100, 700));

for(int i=LR; i>=7; i--){
if(sensorValue > sensorTh) break;
blink(0, i);
delay(random(10, 100));
LR = i;
}
break;

//Left
case 123:
for(int i=LR; i>2; i--){
if(sensorValue > sensorTh) break;
blink(0, i);
delay(random(10, 100));
LR = i;
}

if(sensorValue > sensorTh) break;
delay(random(100, 700));

for(int i=LR; i<=7; i++){
if(sensorValue > sensorTh) break;
blink(0, i);
delay(random(10, 100));
LR = i;
}
break;

//Blink
case 32:
case 300:
for(int i = 1; i < 9; i++){
if(sensorValue > sensorTh) break;
blink(i, LR);
delay(random(10, 30));
}

if(sensorValue > sensorTh) break;
delay(random(10, 300));

for(int i = 8; i > 0; i--){
if(sensorValue > sensorTh) break;
blink(i, LR);
delay(random(10, 30));
}
break;

default:
blink(0, 7);
}

sensorValue = 0;
}

Operation

The LED eye move, the mouth reacts to the voice and it glows red.

I cannot wait for Halloween!


Comments

Similar projects you might like

Third Eye for The Blind

Project tutorial by Muhammed Azhar

  • 81,251 views
  • 47 comments
  • 158 respects

Bluetooth control led with lcd led status display real time.

Project tutorial by Youssef Sabaa

  • 27,201 views
  • 4 comments
  • 52 respects

Eye Motion Tracking Using Infrared Sensor

Project tutorial by HomeMadeGarbage

  • 15,792 views
  • 15 comments
  • 83 respects

LED Emergency Lights using WS2812 RGB LED Module

Project tutorial by bigboystoys13

  • 14,714 views
  • 7 comments
  • 35 respects

Neopixel LED EyeBall

Project tutorial by HomeMadeGarbage

  • 6,898 views
  • 22 comments
  • 28 respects

Valentine Blink: Wireless LED Hearts

Project showcase by AdiK

  • 6,909 views
  • 16 comments
  • 37 respects
Add projectSign up / Login