Introduction: Halloween Mirror

Have you ever come across a smart mirror? It's a clever device that uses an LCD screen's backlight to display an image that seems to magically appear on what looks like an ordinary mirror. When the screen is turned off, it goes back to being just a regular mirror.

In our project, we take inspiration from this idea and place an image or 3D print behind the mirror. We use a Light Dependent Resistor (LDR) to sense the room's light levels. When it gets darker, an LED strip activates, revealing a spooky image. To add some fun, we've also included an MP3 module that plays a scream at just the right moment!

Imagine inviting a friend or family member to check themselves out in this unassuming mirror. They switch off the lights, and suddenly, there's a surprise! It's all in good humor.

For this project, we use the Arduino IDE to program a Digispark, but you can use any Arduino board you prefer. We chose the Digispark for its compact size. We also incorporate a DFplayer MP3 module. We use a standard 5V white LED strip, but with a little adjustment in the code and some extra hardware, you can customize the colors using a Neopixel.

Supplies

1 × DFplayer MP3 player

1 × Digispark MCU (Or any Arduino)

1 × 5V White LED strip (not neopixel)

1 × Light dependent resistor

1 × Hookup wire

1 × Picture Frame

1 × Scary image or 3D print.

1 × 10k PCB mount variable resistor

1 × A speaker (or 2)

1 × Power source. Either a slim USB power pack or mains adapter

1 × 10x10mm pine trim approx 1 meter

1 × 4-5mm thick particle board

1 × strip/variboard

4 × Screws 3x15mm self-tapping countersunk

1M x 20% mirror window tint

Step 1: Pick a Frame

The mirror will be housed within a picture frame, which offers the advantage of having glass that you can easily apply the window (mirror) tint to. The frame's dimensions primarily depend on the size of the image you intend to place inside it and the length of your LED strip. In my case, I chose a skull bas-relief image, and illuminating it from below added a more ominous and dramatic effect.

Step 2: Construct the Frame

There are countless ways to construct a frame, and here's my approach to it. What you primarily need to think about is creating enough space to accommodate the LED strip, the MP3 player, and the controller. The materials list I'm providing is tailored to a 6x8 frame, but it can be adapted as needed.

Step 3: Boxing for LED Lamps

LED strips typically have a width of around 10mm. In this case, I'll be crafting a frame using 10x10 pine trim, which will snugly fit inside the area where the picture traditionally goes. To get the right dimensions, measure the inside of the frame where the glass is typically placed.

Begin by marking out the pine trim and then cut the long sides about 20mm shorter than the frame's interior measurement. Since we're using a butt joint, cut two pieces for the short sides and four for the long sides.

Next, drill a hole into each end of the long pine trim pieces that will join with the short pine trim pieces. Apply glue to these joints and secure them with self-tapping screws. Drilling the holes helps prevent the wood from splitting during assembly. Set aside any surplus long pieces for later use.

Once the glue has set, carefully affix the LED strips to the inside of the frame, ensuring that there is a continuous connection all the way around. In one corner, you'll need to run a wire to the back of the frame, but we'll delve into this in more detail later on.

Step 4: Assemble the Boxing

Once you have assembled the LED frame, you can compile all the parts of the frame in the following order:

  1. Picture frame
  2. Glass
  3. Mat
  4. LED frame
  5. Picture (shown in red below)
  6. The backing that came with the frame

Once you have compiled these 6 items move on to the following steps.

Step 5: Assembly Step 1

Add the two extra long pine trim pieces from earlier to the assembly and measure the height from the frame's top edge to the top of the pine trim. These dimensions will be used in the next step to create the boxing around the outside.

Step 6: Assembly Step 2

Next, measure out this distance on a flat particle board or pine sheet (about 4-5mm thick) for the length of each side. Construct a box around the frame using screws and glue to secure the pieces together. Measure the width and height of this box and cut one more piece to cover the entire back.

Step 7: Assembly Step 3

Assemble the back section of the frame. The gap between the back of the frame and the picture will be the housing for your electronics.


Step 8: Assembly Step 4

Drill a hole in both the picture and the picture's back for the wires from the LED lamps to feed through.

Step 9: Assembly Step 5

Typically, most picture frames have metal clips to hold the picture in place. Mark the positions of these clips onto the side of the LED frame, then drill holes halfway in to accommodate the clips. This allows the rear frame to slide on and off easily, making it convenient for changing the picture or servicing the electronics.

Step 10: Tint the Glass

This is best explained with a demonstration. But if you have tinted windows before the process is identical. Here are the steps if you prefer not to watch the video.

  1. Prepare Your Workspace:
  • Choose a clean and well-ventilated area to work in.
  • Ensure the glass is clean and dry.
  1. Measure and Cut the Tint Film:
  • Measure the dimensions of the glass.
  • Cut the tint film to the appropriate size.
  1. Clean the Window:
  • Spray the window with a soapy water solution.
  • Carefully clean the window with a soft, lint-free cloth.
  1. Apply the Tint Film:
  • Peel the backing off the tint film.
  • Carefully position the film on the inside of the window, smoothing it out as you go.
  • Spray the outside of the film with the soapy water solution to help with positioning.
  1. Trim and Smooth the Film:
  • Use a razor blade to trim any excess film around the edges.
  • Use the squeegee to smooth out any bubbles or wrinkles.
  1. Clean and Dry the Window:
  • After the film has been applied and smoothed, clean the window one more time to remove any residue or fingerprints.


Step 11: Prepare Electronics

As previously mentioned, I opted for a Digistump board in my project because of its compact form factor. However, you can utilize any Arduino board of your choice, albeit with potential adjustments needed in the code to align with your specific pin configuration.

For the assembly of the DFplayer, controller, and their associated components, I arranged them on a variboard. Nevertheless, given the relatively sparse component layout, using hookup wire alone might be an alternative.

Note: P1 on the controller connects to a resistor and then to the TX pin NOT to the pin marked L DAC. As long as your LED strip is not too long and mono color you can drive it from the board directly. Neopixels would need a driver board to support he current. 

The Light Dependant Resistor should be connected to the hookup wire and run to the side of the frame. The LDR will need to be able to "see" the light in the room. It won't work contained in the frame. 

The variable resistor will adjust the sensitivity of the light sensor.

Step 12: Program Your Contoller.

Here is the sketch I cobbled together to make it work. Disclaimer, I am not a programmer there are almost better ways to complete this task. I salute those who can do better. 

#include "Arduino.h"
#include <SoftwareSerial.h> k
#include "DFRobotDFPlayerMini.h"

// Change the defaults below to match you needs.

// Set the serial pins to the DFplayer here
SoftwareSerial mySoftwareSerial(1, 2); // RX, TX

// The LED lights use PWM to light up and down set this output pin here
int PWM_pin = 0;

// This is the in the light dependany resistor is connected to
int LDRpin = 5;

// how long the light stays on
int onTime = 15000;

// speed of the light up/ light down effect
int dtpause = 30;

DFRobotDFPlayerMini myDFPlayer;
unsigned int randomNumber = 0;

int dimmerLoop = 0;
int darkFlag = 0;
int sensorValue = 0;

int level = 153; // Variable level of brightness of the on phase (0 <= level <= 255)
int L1=10, L2=210, L3=110;

void setup() {
pinMode(PWM_pin, OUTPUT);
pinMode(LDRpin, INPUT);

mySoftwareSerial.begin(9600);
myDFPlayer.begin(mySoftwareSerial);
myDFPlayer.volume(5); //Set volume value. From 0 to 30 set it louder here if required.
}

void loop() {
sensorValue = analogRead(2);
delay(1000);

if (sensorValue < 300 && darkFlag == 0)
{
dimmer();
darkFlag = 1;
}
if (sensorValue > 200)
{
darkFlag = 0;
}
}

void dimmer()
{
randomNumber = random(0, 10);
myDFPlayer.volume(20);
myDFPlayer.play(randomNumber); //play a random MP3 file

dimmerLoop=1;
while (dimmerLoop != 0)
{
L1=L1+1;
analogWrite(PWM_pin, L1);
delay(dtpause);
if (L1 == 255)
{
delay(onTime);
while (L1 > 0)
{
L1=L1-1;
analogWrite(PWM_pin, L1);
delay(dtpause);
}
dimmerLoop=0;
}
}
return;
}


The code is simple, It waits for the analog reading from the LDR to drop to a threshold and then kick-off the player and light circuit. The light will not go on again until it is reset by the lights turning off in the room and coming on again.

Step 13: Operation

Now, it's time to assemble all the components inside the frame in the correct order.

Ensure that the Light Dependent Resistor (LDR) is positioned outside of the frame, securely glued to its side.

For the DFplayer to function properly, it's crucial to name your files in the format nnnn.mp3, where nnnn represents a 4-digit number ranging from 0000 to 9999. Start with the first sound file as 0001.mp3 and increment the number for each subsequent sound file. The provided sketch is set up to play 10 different MP3 files. If you want the same sound to play consistently, make sure to copy and rename the file 10 times, numbering them from 0000.mp3 to 0009.mp3. This ensures that the sound will play reliably.

Attach your power source. If your controller has a USB plug, simply connect the battery or power source accordingly. If you're using a mains adapter, connect it to the ground and VIN pins on this controller. For other Arduino boards, power can typically be supplied via the USB port.

Place the frame in the location where you intend to use it. Test the functionality by turning the lights on and off to see if the sound and LEDs activate as expected. If they don't, adjust the variable resistor to match the ambient light conditions. If further fine-tuning is necessary, you can also adjust the value within the if statement in the sketch.

With everything set up and working correctly, it's time to have some fun – go ahead and surprise someone with your spooky creation!

Halloween Contest

Participated in the
Halloween Contest