View Full Version : Play sound file with FRC Control system?
CNettles11
13-03-2011, 19:37
Hi, i know this sounds crazy but, is there any way you could program a sound file into teleop and have it playback through the FRC Control system? this might not be legal but our team is taking our bot around to elementary and middle schools and we want them to hear more than "WHIRRRRRRRR" come from our bot.
Thanks in advance
Chris Nettles
Team 3556, GET SMART
EHaskins
13-03-2011, 22:08
Probably not directly, but using an external device could work.
A quick search on SparkFun, and you can find several serial controlable MP3 player/decoder boards for <$50.
http://www.sparkfun.com/search/results?term=mp3&what=products
CNettles11
13-03-2011, 22:14
and would these have a way of pulling information from the cRIO or would a different communications/control confuguration have to take place alongside our robot radio?
It should be possible, but could be a major PITA. Last May, I made a programmable milling play the song from portal, using labview to write gcode to drive one of the motors at varying speeds. If one of your motors seems to have a different pitch at different speeds, you might be able to use that to get the desired result. pm me if you want to see the code.
EHaskins
13-03-2011, 23:16
and would these have a way of pulling information from the cRIO or would a different communications/control confuguration have to take place alongside our robot radio?
The audio would be stored on an SD card attached to another device, controlled by the cRio via GPIOs or serial.
From the MP3 Trigger v2 page (http://www.sparkfun.com/products/9715):
Description: Created in collaboration with Jamie Robertson, the MP3 Trigger is quite possibly the most versatile, low-cost, low power embedded MP3 Player. The board has 18 external trigger pins that will directly trigger pre-selected MP3 tracks, and a full-duplex serial control port that provides full transport control, remote triggering for up to 256 tracks, and fast real-time volume control. The board plays the MP3 files directly from a FAT16 microSD flash card and supports 192Kbps stereo playback. There is also an on-board navigation switch for local access and playback of all MP3 tracks on the flash card.
Datasheet (http://www.sparkfun.com/datasheets/Widgets/MP3Trigger/MP3TriggerV2UserGuide_2010-07-30.pdf)
NOTE: I have not used this or any similar devices, but it looks like it should work.
CNettles11
14-03-2011, 00:57
The audio would be stored on an SD card attached to another device, controlled by the cRio via GPIOs or serial.
From the MP3 Trigger v2 page (http://www.sparkfun.com/products/9715):
Description: Created in collaboration with Jamie Robertson, the MP3 Trigger is quite possibly the most versatile, low-cost, low power embedded MP3 Player. The board has 18 external trigger pins that will directly trigger pre-selected MP3 tracks, and a full-duplex serial control port that provides full transport control, remote triggering for up to 256 tracks, and fast real-time volume control. The board plays the MP3 files directly from a FAT16 microSD flash card and supports 192Kbps stereo playback. There is also an on-board navigation switch for local access and playback of all MP3 tracks on the flash card.
Datasheet (http://www.sparkfun.com/datasheets/Widgets/MP3Trigger/MP3TriggerV2UserGuide_2010-07-30.pdf)
NOTE: I have not used this or any similar devices, but it looks like it should work.
This device looks like the solution, now how to control it through the DSC :confused:
EHaskins
14-03-2011, 01:19
This device looks like the solution, now how to control it through the DSC :confused:
The simplest way would be to connect a digital output to one of the trigger pins on the MP3 Trigger device. Setting the digital output to low will cause a corosponding mp3 file to be played. This method can be used to control upto 18 files.
This is documented on page 3 of the datasheet I linked to above.
If you require more control you can also control it via serial, also documented in the datasheet.
CNettles11
14-03-2011, 01:28
The simplest way would be to connect a digital output to one of the trigger pins on the MP3 Trigger device. Setting the digital output to low will cause a corosponding mp3 file to be played. This method can be used to control upto 18 files.
This is documented on page 3 of the datasheet I linked to above.
If you require more control you can also control it via serial, also documented in the datasheet.
a couple more questions,
1) can you control digital ouputs from the drivers station?
2)Which DIO wires would run to the trigger?
EHaskins
14-03-2011, 01:49
a couple more questions,
1) can you control digital ouputs from the drivers station?
2)Which DIO wires would run to the trigger?
1) You can. In Java, C++ is very similar. You'll need to find someone else to help if you're using LabView.
DigitalOutput file0 = new DigitalOutput(1);
Joystick stick = new Joystick(1);
//...
public void teleopPeriodic() {
//...
if (stick.getRawButtons(1)){
file0.set(false);
}
else{
file0.set(true);
}
//...
}
}
2) You would connect the signal wire, white, to the pin on the MP3 Trigger device.
CNettles11
14-03-2011, 07:51
well, i can dissect what i would need to do in labview from the java code you posted, Thanks!
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.