Servo Sequence triggert by Audio?

Hi ! I want build a puppet which moves to different lenghts of songs. The moving sequence can be the same i a loop, but should stop/pause when the song is over. I think i need something like a sound switch as an input for my mini maestro. Has anybody done a project like this ?
Greetings Ralf

Hello, Ralf.

We do not have any specific examples showing how to do something like that, but I see no reason why you couldn’t do it with an appropriate sensor.

You could probably use something like the ADMP401 microphone breakout board that outputs an analog voltage. The Maestro can then read that output and compare it to some threshold. Although, that could lead to false readings if you are in a noisy environment.

Brandon

The music will come from a mp3 module,better than a mic input would be a line-in input, do you something like this ? And there will be noisy enviroment, so that a mic isnt the option.

Testet a code with if…else …endif , i could start the sequence with a button and when i hold the button the sequence loops. So far so good. Is there a way the sequnce stops immidiately, when i release the button and goes on at that point, when the button is pressed again ? Its like a pause button for the sequence.

I do not have any specific recommendations for adding something with a line-in input like that. What kind of MP3 module are you using? Does it have some way of indicating if a track is playing (e.g. a digital output that you can monitor to know when it is active)?

You should be able to add some kind of pause feature in a Maestro script like you described, but since it does not support interrupts on its input channels, it would probably not be trivial. Since you need to actively monitor the input to know when to stop, you would need to avoid blocking code like the normal delay command. When the button press is detected, you could go into a simple while loop that keeps checking it and returns to the normal code once it has been released. If you need help getting started with non-blocking delays, you might find my posts in this thread helpful. The application is a little bit different, but the example there shows how you might go about monitoring buttons while a sequence is running.

Brandon

I use a simple ipod shuffle clone Mp3 Player. Could you recommend a Mp3Player, which could send the needed signal ?

I do not have direct experience with any MP3 triggers with that kind of feature, so I cannot recommend one in particular. From a quick Internet search, it looks like the DFPlayer Mini from DFRobot might work, so you might try starting there.

Brandon