I have a pretty cool workplace where we're all about fun pranks. One of the programmers I sit next to has a habit of banging on his desk a lot when he is frustrated.
I decided it would be a fun prank to hook up a LinkIT ONE and some sensors to his desk to trigger a music file to play. I got a fun music file off youtube to play every time he banged on his desk. The first time he hit his desk, boy was he surprised!
Step 1: Supplies
Not a whole lot here.
- LinkIT ONE board
- Vibration Sensors (Piezo Element)
- 1 Mega ohm resistor
- Computer Speakers
- A fun mp3 file to surprise them with!
When I deployed this at my co-workers desk, I actually plugged it into his computer speakers to freak him out even more! Hopefully if you deploy this on someone else they don't notice the lack of music form their own speakers!
Step 2: The Circuit
Piezos (our vibration sensors) are polarized. This means that that voltage passes through them in a specific direction. You'll notice that the Piezo has a specific black and red wire running out of it. Black is for our lower voltage, while the red wire is for our higher one. Connect the black wire to ground, then connect the red wire to Analog 0 (A0).
Additionally, it's good to connect a 1-megaohm resistor in parallel to the Piezo element to limit the voltage and current produced by the piexzo and to protect the analog output.
Step 3: Transferring Music to Your LinkIT ONE
Before we go too far, let's make sure to get some sounds on our LinkIT ONE.
First, find a cool sound that you want to surprise your desk banger friend. I chose this quote as I thought it would serve him well; maybe actually get him to calm down a bit!
You'll want to turn your LinkIT ONE into 'MS' mode. This stands for 'Mass Storage' and will make your computer treat your LinkIT ONE just like a regular old USB Stick or SD Card. This makes it super easy for us to simply click and drag media over to our LinkIT ONE. When we do this, we'll be storing it in LinkIT ONE's internal memory (Versus an onboard sd-card). There is only around 10mb available here, so don't try and overload this feature.
Step 4: Deploying the Code
The code logic here is pretty straight forward:
If we detect a large vibration ( someone slamming their fist down on the desk) we want to turn on our music and play it!
The code (which isn't that long) is pretty heavily commented, so hopefully it is easy to understand. The only major library we use is the LAudio library. If you would like to read up more on that, I suggest you go check out the github examples.
Step 5: Deploying to the Desk
Now that we have our project all up and running, we want to set it up on the desk in question so it's ready for our friend to bang on.
First, you can simple tape the Piezo elements (wired to the LinkIT ONE) to the bottom of the desk. This will detect any large vibration changes to the desk.
Then, make sure your LinkIT ONE is plugged into an audio source. Plugging it into their computer speakers is the best for maximum effect, so they really have no idea how the sound just occurred. If they frequently listen to their speakers though, you might have an issue and have to set up your own under the desk or something.
Step 6: Going Forward
Now you're free to prank your friend whenever you want! Hopefully this gets him good. You can change this prank up to include a few different voice files on your LinkIT ONE (as long as they are small enough) so it plays something different every time.
Happy pranking and tinkering!