Introduction: AutoMatic Diva Mirror

Introduction

This machine is a automatic diva mirror, made with LED lights and a distance sensor. This product is for people with a dream of a supposed smart mirror that lights up when they come within the mirror’s range. The hardware and the coding is not very difficult to create, hopefully many people can also create my mirror invention.

Supplies

Jumper Wires

6 LED Lights

1 Distance Sensor

1 Arduino Leonardo Board

6 Resistors

1 Mirror

1 Box

Normal Tape and Double Sided Tape

Utility Knife

Step 1: Create the Hardware

- Use the LED Lights, Jumper Wires, and Resistors to create 6 functioning lights

- Then use the Jumper Wires and Distance Sensor and make the sensor stand a little farther away than the lights

- Be sure to use extension wires to extend the length of each LED piece so that it’s easier to connect the lights onto the mirror

Step 2: Make the Outer Design

- Grab the Box and the Mirror, tape the mirror the the top of the box in a standing position. If you don’t have a standing mirror, grab some cardboard and make one by scratch.

- Then cut out some holes in the back for the lights to pass through, that way you can close the box for the mirror.

Step 3: Test the CODE!

Download the code given!!!

#define trigPin 7
#define echoPin 6 #define led 13 #define led2 12 #define led3 11 #define led4 10 #define led5 9 #define led6 8 #define buzzer 3

void setup() { Serial.begin (9600); pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); pinMode(led, OUTPUT); pinMode(led2, OUTPUT); pinMode(led3, OUTPUT); pinMode(led4, OUTPUT); pinMode(led5, OUTPUT); pinMode(led6, OUTPUT); pinMode(buzzer, OUTPUT); }

void loop() { long duration, distance; digitalWrite(trigPin, LOW); delayMicroseconds(2); digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW); duration = pulseIn(echoPin, HIGH); distance = (duration/2) / 29.1;

if (distance <= 40) { digitalWrite(led, HIGH); } else { digitalWrite(led,LOW); } if (distance < 40) { digitalWrite(led2, HIGH); } else { digitalWrite(led2, LOW); } if (distance < 40) { digitalWrite(led3, HIGH); } else { digitalWrite(led3, LOW); } if (distance < 30) { digitalWrite(led4, HIGH); } else { digitalWrite(led4,LOW); } if (distance < 40) { digitalWrite(led5, HIGH); } else { digitalWrite(led5,LOW); } if (distance < 40) { digitalWrite(led6, HIGH); } else { digitalWrite(led6,LOW); } if (distance > 40 || distance <= 0){ Serial.println("Out of range"); noTone(buzzer); } else { Serial.print(distance); Serial.println(" cm"); } delay(500); }

Step 4: Put It All Together!

- First Glue or Tape the Leonardo Board on the bottom inside of the box

- Then stick all the lights and the distance sensor out of the hole(s) that you just cut out earlier

- Stick the LED lights on the side of the mirror with tape!

- Place the Distance Sensor in front of the mirror

- Make sure the machine works

Step 5: Enjoy Your Product!!!

This is my final video!!!

https://youtu.be/YzFTPza7t1c