Maestro making raspberry pi play mp3 files

HI,

Is it possible to have the maestro send a number from within a script to the raspberry pi through the USB connection? Could you then have a python program that would look for incoming numbers from the maestro then play the mp3 audio file with the same numbered file name.
I’m hoping that if I had let’s say 20 subroutines inside the script, that each subroutine could signal the raspberry pi to play different audio for each of the 20 servo movement subroutines.

Norman

There is not a direct way to send a specific value over USB from a script; however, if you are using a Mini Maestro, you have access to the SERIAL_SEND_BYTE script command. You can find more information about this command in the “Command Reference” section of the Maestro user’s guide. This command sends a single serial byte from the TX pin of the Mini Maestro, so one option might be to use a TTL serial connection to the Raspberry Pi GPIO pins. Please note that since the Raspberry Pi has a logic voltage of 3.3V and the Maestro operates at 5V, you should use a level shifter if you try this. Alternatively, if you want to communicate over USB, you could put the Maestro into USB Dual Port or USB Chained mode, then connect the Maestro’s TX pin to its own RX pin. This should cause the byte sent to get echoed over USB.

The SERIAL_SEND_BYTE command is not available if you are using a Micro Maestro. So, if that is the case, one way to communicate from the script over USB would be to use a servo channel as a dummy channel. For example, you could have the Raspberry Pi monitor the target value of a particular Maestro channel, and have the Maestro script set that channel to a known target. When the Raspberry Pi sees the channel change to that particular target value, it can play the MP3 file.

Brandon

Thanks Brandon. I am using the mini maestro 24. If I use the SERIAL_SEND_BYTE command over the maestro’s TX line back into the RX line, am I correct in assuming that I can have a possibility of either 256 or 512 different values of binary numbers depending on whether it sends all 8 bits in the byte or just 7 bits due to overhead.
I am going to have the raspberry pi telling the maestro which subroutines to play in the script as needed. Each subroutine will be a different series of movements (ex.= move right arm, move left arm, turn torso left, ect.)
I guess I could also just have the python program tell the maestro to play a subroutine and then have the raspberry pi trigger the proper mp3 file itself as soon as the subroutine starts.

Norman

The SERIAL_SEND_BYTE command interprets the value as a byte, so it will send 8 bits resulting in a number between 0 and 255 (512 would be 9 bits). If starting the audio at the same time as the subroutine works for your application, you might try just doing that. Sending a value back to the Raspberry Pi to trigger the audio would probably be a better solution if you needed to trigger some sound effects mid-sequence.

Brandon

Thanks . I’m going to try sending the byte to the pi first to see if I can
make it work.

Norman