So by this point i had several ideas floating in my head for PComp finals. For midterm, turned out we’re going with a Halloween theme and the only idea i thought related was the animotronic tail idea. Though my teammate didn’t like it and i thought i really wanted to experience with piezos and analog signals. I have half a mind of building an 8-bit drum at some point.
In the end i compromised and proposed that it has to be something that we can work on it seperately. The drum idea seemed to fit. Next was the Halloween layer which we added by creating a simple game with candies for rewards. This was something we could easily work on different parts seperately.
I also always had this design of subtle lighting around the “drum” circle. I like the dim and sharp light the EL wires give. For that i ordered a pack with assorted colors that comes with their own driver. Now what this driver does is that it gives out an AC current to the coil and the active fluorescent material inside the wires. Later i’ll tell you how it became problematic.
So i was tasked mainly with the electronics and programming side of things while my colleague built the built the drum circles and the wire around them, plus the box and servo mechanism.
I started by figuring out the measurement of impact with a Piezo sensor. You see, ideally, i wanted to build my MIDI drums on the way as well. So i wanted to be able to measure the force of impact as well as the confirmation of impact. And why Piezos? well, i opened up one of Guitar Hero video game drums to fix, and saw that all the impacts are measured with Piezos (and a failed solder was the issue with the drums). Guitar Hero was able to pick up the force of impact on the drums and play a louder sample if you stroke it harder.
So i bought a pack of fairly big (35mm Diameter) Piezo sensor discs and proceeded to solder two wires to the inside and outside (which i had a hard time to do when i was fixing the GuitarHero!) and the trick is to scratch both surfaces with a knife and use oil to get things hot and solder friendly.
Then i connected it to an Analog pin to see if can measure impact. And sure enough it did, tough it kept giving higher and higher values and hardly curved down. That’s when i realized Piezos need a lot of resistance (in my case 1 Mega Ohms!!) between the two discs in order to work. After that everything worked find and i was able to get very detailed reading of the impact force. I made this LED indicator to show the measurement (Though their main use was to indicate impact for each piezo, which happens later)
So i added 3 more piezos and their individual LED to indicate the impact. And everything works beautifully. For now.
Finally it came for the code and game logic. The logic of the Simon says game goes like this:
- Game starts and plays a sound, lights a light and waits for you to repeat it.
- The process continues until you miss one and the game starts again.
So for my intents, i added these steps to the logic.
- The games only goes up for three levels.
- game begins with 4 parts and goes up to 7.
- each level is faster and therefore harder than the last.
- If you clear all levels, a servo activated box will open, granting you candies.
- if you tap wrong, the game goes back to the first level
- if you get it wrong, the game will shock you on touch! (explained in “The Shocker”)
okay so i started hand coding the game logic, but quickly resorted to using another Simon Says arduino code and modify it. i put LEDs for various functionalities until my partner delivered the necessary parts so i can implement them.
The last part of the code was to add a buzzer and play a sound with each drum hit or play. I adjusted the Buzzer volume with a resistor to not annoy everyone in the shop and removed it during midterm presentation. The interesting thing about the buzzer is that it’s the exact same sound generator used on the original Simon Says game. And each color has a classic tune to it:
- E-note (blue, lower right);
- C♯-note (yellow, lower left);
- A-note (red, upper right).
- E-note (green, upper left, an octave lower than blue);
So that was a nice piece of history/nostalgia behind it.
Now for a bit of cheekiness! I thought following the Halloween theme it shouldn’t just be Treats… How about some Tricks?
So i had played with EL wires before and i knew the “Driver” is simply turning DC input into AC which could excite and light up the material inside the EL wire, much like a Neon light.
Also, our bodies are very vulnerable to AC current. We are insulated from DC to a good degree that you need a lot of voltage and current to even feel it on your fingers. But even a small AC current with little voltage can give a very pronounced shock to the user!
The issue here was that i had a more advanced driver that had circuitry to switch between constant light and blinking light. It also resets when it’s not powered. So i couldn’t just power it off and on with a switch. I had to turn it on to the right “constant light” mode and then turn it off after it produced AC. That alone opened a big can of worms i did not really predict. If i could just switch the DC input, i could easily use a MOSFET for the task and use the same power source for the Arduino as well. But now i had to use a Relay to do the job.
In my hopeless attempt to maybe avoid using relays and measured the output of the AC driver to see if voltage doesn’t go to negative and it just a wave above 0 volts. Which it wasn’t..
So the 5 relay strategy initially worked. i could turn the EL lights around the drum discs off and on with 4 relays that had AC fed to them. I could also use only one AC driver in an always on mode. Finally i attached a different wire with a fifth relay to some aluminum layer over the discs to deliver the shock. They were right next to my Piezos and when it turned on, it messed with the inputs from the Piezos and gave wrong reading.
UPDATE: i now actually think the problem was the all the components were sharing the same ground, So maybe the issue is that AC and DC shouldn’t share the same ground…
No matter the cause, all my AC endeavors are out and replaced with a corresponding color of LED. The solution was to use a different driver or modify the existing one.
Bringing it All Together
Alrighty, So The last step was the easiest, as i used LEDs for output and only had to replace them with the proper inputs. Yinghua did a great job of fabricating both the drum circles, EL wires (that sadly wont be used) and the box mechanism.
The last step was to just add the candy and now we’re ready to play!!