I have an electro-mechanical arcade game that has some poorly rigged electronics in it. I'm going to replace that mess with an Arduino.
This is a marionette that dances and sings to music. Here's the sequence of operation, how it originally worked:
Dime inserted into plunger-type slot. This throws a switch which turns on the motor, lights, and starts the music.
The motor (which makes the marionette move side-to-side and makes his mouth cycle open and closed) and lights stay energized while the song is playing through a proprietary tape player.
The circuitry listens for the 4 seconds of silence between each song on the tape. When the circuitry stops hearing music (indicating that the 4 seconds of silence between the songs has been reached), the lights and motor are de-energized
I am using an Arduino Uno R3 and a SEED Studio Relay Shield. I also have all 9 of the puppet's sings on a micro SSD card that resides on a Sparkfun MP# Trigger.
My question is, what is the best approach for creating an algorithm that will work for this hardware setup?
When the dime is inserted, the switch is triggered in momentary fashion. It cannot mechanically stay triggered. So I need the Arduino to energize the motor and lights relays upon a momentary-contact switch closure.
Then I need those relays to de-activate once the song has finished playing. So far I haven't found a signal I can grab from the MP3 Trigger board that indicates the song is over. Is there another way to perhaps have a pin on the arduino "listen" for silence.
I'm sure this description is woefully quirky and incomplete. Please bear with me as I'm a noob to the Arduino world.
To nutshell it, I need to energize 2 relays on the relay shield when the momentary closure of a mechanical switch is detected. I need them to stay energized until an MP3 file plays through the speakers, at which point the relays will de-energize.
I have no need of help with the relay shield. Rather, i don't know how to energize based upon an external switch, nor how to de-energize based upon the absence of sound.