Over the weekend I experimented with one of my options for sound. The MOL-AU5121 .mp3 module from MDFLY. I've been hard pressed to find a good example for designing a .wav player, or even one that was easily addressable from an outside source, but the board from MDFLY was an easy to use option that is really tempting to stick with. The module reads serial data in, and plays MP3 files stored on the sd card mounted to the back of the device. The documentation for this thing is wrong on at least a couple of things I have found. It states the Baud rate for the SR-232 is 4800 when in reality it's 9600. It also states that the addresses of the files are dependent on what you name them ie. address "01" = "001.mp3". This is however, not true. The addresses for the individual .mp3's depend on the order they are loaded onto the sd card. I'll give them that if were to name them all that way before hand and then load them all at the same time, this should work fine, but if you saved 001.mp3 then 003.mp3 then realized you forgot about 002.mp3, then 002.mp3 would be addressed with "03". There are programs out there that let you specify what order files are loaded onto the cards, so I will have to look into that. I'm thinking I'm going to need three or four of these modules chained together to be able to play multiple sound files at once. One for dialogue, one for music, and one or two for various sound effects. I will have to program in some sort of hierarchy for the audio files to make sure the more important files can interrupt and not be disturbed by less important sounds.
I ripped the audio in the video from the actual TV show. Unfortunately I got one where Walter says "engaged" instead of "encoded". I have started keeping a notepad file open and recording when and what is said on the show as well as various sound effects I want to go back and take later. I love that research for this includes watching my favorite show.
The switch I'm using is an old leaf type rollover switch used in older pins. I dont think I will be using these. They take up too much room on the bottom of the play field and are also comprised of two separate parts. A more modern switch uses the same curved wire actuator but instead of the leaf switch, it uses a micro switch.
|Rollover switch slot from top of playfield.|
|Older, leaf type rollover switch pieces.|
|Modern micro switch type rollover switch.|
When trying to test this thing using an Arduino, I was having problems with the ball rolling over the switch too fast and the code not catching the signal fast enough. This seamed very odd to me. How could I see the switch close faster than a 16MHz processor? Short answer, I can't. when I was programming the code I tried to get the state of my input inside my if statement instead of storing the state of the input into a variable and checking the variable inside of my if statement instead.
bool switchState = digitalRead();
I'm really not sure why it should make a difference at all, but I do know for sure that this is what fixed the problem. I had also thought about using a capacitor to temporarily store the 5v signal and release it slowly through to the input. I did try this too, I even thought it was working, but it didn't. Out of curiosity, I used my scope on the input and saw that the cap was draining just as rapidly as it was charging. Maybe there isn't enough internal resistance on the input? I will have to try this again later with a 1k resistor or similar going into the input from the cap.
Here's some more information on RC circuits and Time Constants.