Thursday, April 21, 2016

Office Door Knocker Castle

We are always looking for more ways to make our office fun and strange. One of our engineers, Mike, until recently rigged elevator Tardis sound and play. I wanted to do something similar in my office, but, especially. I often close my door does not work, but most of the time, when someone comes to my office, the door to indicate their presence in the rap formal announcement. I decided to have a little fun with him.


Instead of making annoying noise standard door door, I Young Frankenstein castle door knockers from the door, I wanted to sound like.
To do this, I'll need a few things:
  • Some knock to detect and
  • Some of the sound to play.
Knock for identification, I chose large Piezo vibration sensors.
Office Door Knocker Castle
Office Door Knocker Castle
Because it is cheap and only need to use a resistor with an Arduino ADC accuracy of this sensor. When the film moves back and forth in a small AC voltage output sensor. I have to do is to use the material for a 1M ohm resistor in parallel with the solder, an ADC pin and connect the ground lead to one of the other lead. I simply solder a resistor between the leads of the device, and then I'm on the solder wires to connect to the Arduino.
Office Door Knocker Castle
Office Door Knocker Castle
There is no sound to play in the second major piece of the project. In order to play sound, I need to get the word out. Luckily, I'm here to Young Frankenstein clip from the scene were able to find an mp3 song.
mp3 music was a recording of the whole scene, so I have a very useful program called Audacity using just the sound of the door knocker was cut out. I'll need to edit sound files when the program easier for me to go, and it's free. Audacity, I open the mp3, I did everything but knock the sound cut out and magnify the high waveform before clipping it as much as possible so that it began to be loud.
Office Door Knocker Castle
Office Door Knocker Castle
Next, I exported the mp3 file and save it as "track001.mp3." This is because the file name will be published later. And I'm onto a microSD card to be used with the mp3 of the MP3 player loaded Shield.
Office Door Knocker Castle
Office Door Knocker Castle
Arduino shield triggered by an MP3 player is designed to play MP3's. It's a microSD socket via a 3.5mm audio jack s raw MP3 and audio to mp3 files as output process and has been a VS1053 audio codec. An example of the product page sketch that only after the other in an endless loop of mp3 files on the microSD card has been played. I would like to recognize the sound of a knock trigger only when I had to change some code.
If you're playing along at home, here in this tutorial is the final Arduino sketch.
First, I checked a function that returns the line analog 0 to detect whether or not a knock. I readPads the bottom of the existing code to add () function:

int readPads(void)
{
  if(analogRead(0) > SENSITIVITY) { return TRUE; }
  return FALSE;
}

Piezo sensors are drawn on the ground, the constant "sensitivity" 3. The sketch above is defined as, it will report a zero voltage until it is heated. 3. sensitivity means that any time is a constant set of values ​​greater than 3 is detected, the function returns true. This makes the sensors are very sensitive, but since it has been identified in a thick door with a knock, just in case I set it low.

Then, a knock is detected only when I play track001.mp3 loop () function code needs to be changed. Since the code is already written several tracks to play, I had to add more code than I was to be removed. The final loop function looks like this:
void loop(){

    int pad_pressed = FALSE;
    pad_pressed = readPads(); // Check for a "knock"
    if(pad_pressed == TRUE)
    {
        trackNumber = 1;
        sprintf(trackName, "track%03d.mp3", trackNumber); //Splice the new file number into this file name
        playMP3(trackName); //Go play trackXXX.mp3
    }
  }

This code first readPads () function call. If the function returns true, it plays the first track. Function returns false, and then loops back to check it. Very simple. To my Arduino shield, Piezo sensor attached soldered on, and sure enough, when I tap sensor, it plays the sound.
Office Door Knocker Castle
Office Door Knocker Castle
Now, attach it to the door. For this, I have to supply my local store to special order a precisely-machine Custom attachment device:
Office Door Knocker Castle
Just kidding.
I have a battery holder with a barrel of Jack Arduino powered with 4 AA batteries. I then used a 3.5mm audio extension cable to connect my computer speaker MP3 Player Shield. I Piezo sensors are attached to the back door, to the right height, where no one will knock around. The whole rig looks like this:
Office Door Knocker Castle
Office Door Knocker Castle
The final effect was pretty impressive:


Now that sounds like a giant wave knock on my door knocker are using. The project is how to use the MP3 shield and a Piezo sensor to integrate the object is just one example of the word. I drum sounds and electronic drums and other percussion instruments set up with multiple Piezo sensors are used. Only one device can use it to turn on in! Tell us more ideas / flex / Piezo sensors do not forget to check out.


No comments:

Post a Comment