Mini Maestro and sound

Hello,

I am new to this board and am curious how I can sync sound with the mini maestro. This is for a Halloween prop with servos and I would like to have them synced with the sound if possible. Does anyone know if this is possible with the mini Maestro?

Thanks!

Hello.

Yes, this is possible. You can configure any channel on a Maestro servo controller as a digital output and then use it to trigger the MP3 trigger. So what you can do is write an internal Maestro script that triggers an MP3 and then starts a servo motion sequence at the same time, and they will be synchronized.

–David

Thank you David. Also, how would I set up a trigger with a simple NO/NC circuit?
Also, any chance to get a sample of what that script would look like?

Please see the “Using multiple buttons or switches to control servos” example script in the Maestro User’s Guide for an idea of what your script would look like (except you would only have one button, and would add some extra calls to the “servo” command in the “sequence_a” subroutine to change your output line and start the MP3). Please see the “Attaching Servos and Peripherals” section of the Maestro User’s Guide for information about how to wire a switch to the Maestro. The user’s guide can be found here:

pololu.com/docs/0J40

–David

Hi, I also want to play Audio with my Pololu Mini Maestro (12 channel) micro controller. I bought the Sparkfun MP3 Trigger and want to use Serial commands to trigger the mp3 files. I know that I need to connect the TX of the maestro to the RX of the MP3 Trigger in order to send serial commands, but is there an example code for a simple:

-Trigger 001_Track.mp3 if button_1 is pressed
-Trigger 002_Track.mp3 if button_2 is pressed

I coudn’t find the code for the pololu script :confused: . I also have Servos and LED’s connected and working so I just want to add sound to the loops I already wrote.

Thanks in advance!
Sebastian

PS:I don’t want to use the Output solution cause it takes away all my pins for the servos and leds…

Hello, Sebastian.

The following subroutines are examples of how to play a specific MP3 on the MP3 trigger using two different serial trigger commands (which are described in the Serial Control Protocol section of the MP3 trigger’s user’s guide):

# uses the Trigger (ASCII) command to play track 1.
sub trigger_ascii
	0x31 0x54 serial_send_byte serial_send_byte  
	return

# uses the Trigger (binary) command to play track 1.
sub trigger_binary
	0x01 0x74 serial_send_byte serial_send_byte 
	return

Please note that you will have to change the Maestro’s Serial mode to be “UART, fixed baud rate” at 38.4K baud to communicate with the MP3 trigger. Examples of how to call a subroutine if a button is pressed can be found under the “Using a button or switch to control servos” and “Using multiple buttons or switches to control servos” sections of the Maestro’s user’s guide. (By the way, we describe how to use serial under the “Serial output” section of the user’s guide.)

-Jon

Thanks Jon!
That really helped a lot!!!

I read the instructions but never now how to actually write the code in a row.

So for ACSII it is clear now:

sub trigger_ascii
 (ASCII for the Tracknumber: 1 = 0x31) (ASCII for the Trigger command: "T" = 0x54) serial_send_byte serial_send_byte 
   return

same for binary but with other commands :slight_smile:
That really cleared everything up! :smiley:

Thanks again!
Sebastian

So how would this be wired

As I described in my response to your thread, if you want to use the serial interface, you would connect the TX pin from the Maestro to the RX pin on the DFplayer, the RX pin on the Maestro to the TX pin on the DFplayer, and a ground connection between the two.

Brandon

hello! I’m very new and how in the world would I sync audio to a 18 channel servo control?

Hello, Beckam.

Unfortunately, the Maestro controllers do not have any special features for choreographing movements to an audio track and cannot play or read audio tracks directly. There are a couple of options for accomplishing movements synced to audio, such as using a third-party program like Brookshire Software’s Visual Show Automation or triggering the sound/track from the Maestro to a separate audio playback board and timing your sequence manually, which I describe in the last paragraph of this post . You can see an example of what can be done with the simple timing method (and some patience) in this diorama posted by Makidog.

Brandon

Thanks so much. So how would I use a mp3 to sync them at all? And if not what should I do. I’m a teen and no not alot so please put it in very simple terms! Thanks sorry.

Unfortunately, as I mentioned in my last post, the Maestro does not have any special features for syncing to audio.

If you are just asking how to trigger an MP3 file to play, you could use something like the MP3 Trigger from SparkFun. Jon’s post earlier in this thread has some sample Maestro code for communicating with the MP3 Trigger through TTL serial; however, please note that this method will only work with one of the Mini Maestro controllers (i.e. not the 6-channel Micro Maestro) since it uses the serial_send_byte command.

Alternatively, since the MP3 Trigger can also be configured to play tracks when a specific pin is pulled low, you can use Maestro pins configured as outputs to trigger them using this method.

In either case, that would just be telling the MP3 to play; after that, you would need to set up and time your servo movements on the Maestro so they are in sync with the music manually. You can either do this through the “Sequence” tab or by writing a custom script. However, please note that sequences created in the “Sequence” tab do not record the speed and acceleration for each frame, so you would need to convert your sequence to a script and manually add those if you need to adjust speeds throughout the sequence.

Brandon

So would there be any way I could add a button to the mp3 and a button to the mini maestro and manually time them so that when I press the button they go off both at the same time? If so where would I put it on the servo control?

Yes, you could connect a button to both the Maestro and the MP3 Trigger and have your Maestro script and audio track start at the same time.

You can find information about connecting a button the Maestro in the “Attaching Servos and Peripherals” section of the Maestro user’s guide. To start your servo movements from a button press you will have to write some code at the beginning of your script. I recommend looking through the “Example Scripts” section of the Maestro user’s guide as well so you can get an idea of how handling button presses would work, but you can also find some sample code to start your script with the push of a button in my post here.

If you have additional questions about using a button with the Maestro, I suggest creating a new topic of your own, since this is getting away from the original topic of this thread.

Brandon

So would I connect the mp3 and servo controller to 1 button or 2, I would do a new topic but I’m new to the site.:frowning: sorry

Whether you want to use 1 or 2 buttons is up to you. You can connect them both to the same button if you want them to always trigger at the same time, or 2 separate buttons if you want to manually control when each one is triggered.

Brandon

Is there anyway I could add a 18 channel maestro and a mp3 and a button to a bread board?

The Maestro boards are not directly compatible with breadboards due to their pin layout, but you could use something like our M-F Premium Jumper Wires to make connections to a breadboard.

If you solder male header pins to the “trigger” pins on the MP3 Trigger you could use them with a large enough breadboard, or you could use jumper wires to make the breadboard connections.

It is not clear if you are referring to a specific button, but if you are looking for something very small and compact our mini pushbutton switch can be plugged into standard 0.1" breadboards.

Brandon