Screamer Mirror - Halloween Decoration

by CaveMad in Circuits > Arduino

1025 Views, 4 Favorites, 0 Comments

Screamer Mirror - Halloween Decoration

scream6 (1).png
scream.png
Screamer Mirror - Halloween Decoration

This is an idea I have had for a long time cause there are reflective glass windows on my house, I decided not to use it as there is a street next to the window, and people are not used to getting scared on Halloween (I'm from Colombia). If you also have a reflective glass window, this is a great decoration for your porch to receive trick-or-treaters. You can get a small piece of reflective glass and make a mirror to hang on the wall.


This project is made on Arduino using an ESP-32 board and uses Bluetooth to connect to a speaker and play the scream. I originally was going to use a custom android app to play the scream and connect to it via Bluetooth or serial connection. But I found the ESP32-A2DP library which allows it to connect to a Bluetooth speaker and play the raw audio data. Feel free to use this idea and adapt the code to your needs.

Supplies

scream7.png

ESP-32 Board

x8 WS2812B LEDs (I have individual LEDs so I soldered two different strips of 4 LEDs each to illuminate both sides of my mask)

HC-SR04 Ultrasonic sensor

Bluetooth Speaker

Protoboard

Wires

Halloween Mask (you can use a picture if you want to make a wall mirror)

Heatshrink

Hot glue

Soldering wire

Balsa Wood

USB cable and AC adapter or power bank


Tools:

Soldering iron

Cutting pliers

Hot glue gun

Lighter


Prepare Raw Audio Data

Audacity.PNG
HxD.png
notepad2.PNG
notepad3.PNG
notepad.png
notepad4.PNG

You can skip this step as the code include one scream audio data, but if you want you can upload a different sound to be played. This process is also explained in the video.

  • Use an audio editor software, I used Audacity to cut and separate the audio I wanted to use (you could pass the board's memory limit, I used 4 seconds of audio and it was ok, I think you could fit 15 seconds of audio) and make sure the sampling frequency is 44100HZ.
  • Export as the audio .WAV, Signed 16bit PCM.


  • Open the audio file using HEX editor software, I used HxD. Select All(Ctrl+A) > Edit > Copy as > C
  • Open notepad and paste, put "cons" at the beginning of the char and cut the number of the array and add an unsigned integer with the name rawData_len at the end of the document and add the array number.
  • Save the file adding the extension .h


Example:


What you copy from HxD:

unsigned char rawData[750852] = {

0x52, 0x49, 0x46, 0x46, 0xFC, 0x74, 0x0B, 0x00, 0x57, 0x41, 0x56, 0x45,

.................................Raw Data..................................................

};


.h document:

const unsigned char rawData[] = {

0x52, 0x49, 0x46, 0x46, 0xFC, 0x74, 0x0B, 0x00, 0x57, 0x41, 0x56, 0x45,

.................................Raw Data..................................................

};

unsigned int rawData_len=750852;

Upload the Code to Your Board

code.PNG
bt.PNG
port.png

Please check the video if you need an explanation of the code.

Make sure you have the ESP-32 board added to your Arduino IDE and download the Adafruit _NeoPixel library from the library manager and the ESP32-A2DP library from GitHub.

How to add the ESP-32 Board to your Arduino IDE: https://www.youtube.com/watch?v=fCfJjE3y2xE&ab_channel=N_Tech

ESP32-A2DP Library: https://github.com/pschatzmann/ESP32-A2DP


  • Download the code (it includes the scream audio data)
  • Add your speaker's Bluetooth device name on the code. Make sure you can access the pins you are going to use and make the changes you need. Also if you created your own raw data make sure to include it in the project's folder and add it to the code (#include "yourrawdata.h")
  • Connect your ESP-32 with a quality USB cable (i have had issues with cheap cables)
  • Config the COM port and select the "Huge APP" partition scheme
  • Compile and upload the code to the board.


If you have problems uploading the code, you might have to check this: https://randomnerdtutorials.com/solved-failed-to-connect-to-esp32-timed-out-waiting-for-packet-header/

Connections

Proyecto nuevo.png
scream8.png

I connected the echo pin directly to the board but I realized that you shouldn't do that as the ESP-32 works at 3.3v and the HC-SR04 is 5V, on my case the project worked well but this could end up malfunctioning or damaging the board. I found this instructable (https://www.instructables.com/Modify-Ultrasonic-Sensors-for-3-Volts-Logic-prepar/) in which they use two resistors (4.7k and 2.7K ohm) as a voltage divider.

I had individual Neopixels so I soldered short wires following the direction (of Din and Dout), I made two strips of 4 LEDs each.

  • Connect everything on the protoboard following the diagram and check everything is working before installing it on the window.


  • To test, turn on the board and the speaker; it should link automatically. Trigger the sensor and the LEDs will turn on and the scream will play on the speaker.

Final SetUp

scream6.png
scream5.png
scream9.png
scream10.png
scream11.png
20221106_002556.jpg
scream12.png
scream2.png

Now that we have everything working the only thing left is to install it on the reflective glass. This part will depend on your specific setup. This is what I made.

  • Glued the mask to a broomstick reclined on a chair (ideally use a tripod).
  • Made a C by gluing three pieces of balsa wood to support the LEDs as they have to illuminate the mask, and glued the C to the broomstick.
  • Placed the protoboard, sensor, and LEDs to cut the wire extensions to the right length, soldered them, and covered them with heat shrink (i used a female pin connector for the HC-SR04).
  • Glued the protoboard on the chair, LEDs on the balsa wood facing the mask, and the sensor on the window. looking forward.
  • Connected all the extended wires to the protoboard.
  • Place your Bluetooth speaker and turn it ON.
  • Connect the USB cable to the board. To power It, I used a power bank but you can use an AC adapter.
  • I noticed that the balsa wood was too pale and it was way better to paint it black.

Test for one final time and You are done, Hope you liked this idea and inspired you to make something.