Audio Playback with the Basic Stamp
mattbstrong
Posts: 21
I am looking for a way to play back audio using the BS2. I really like the waveshield but I have not been able to find any information about its compatibility with a BS2. Does anyone know if a BS2 can be used to control a waveshield (for the arduino)? If so, can you point me to some documentation?
If the waveshiled is not compatible with the BS2 what are some other options? I need to store about 3 dozen very short audio clips (a few seconds each) and play them back in any order I want.
Thanks.
If the waveshiled is not compatible with the BS2 what are some other options? I need to store about 3 dozen very short audio clips (a few seconds each) and play them back in any order I want.
Thanks.
Comments
The Stamp will not work with the Wave Shield. The Wave Shield relies on the Arduino to do most of the work of reading the audio data off the SD card and presenting it to a DAC (digital to analog converter). The Stamp is neither fast enough nor has enough RAM memory to do this. The AP-16+ uses a Propeller to do the same kind of work as the Arduino and has a more powerful audio amplifier. The uMP3 uses a special purpose MP3/WAV player chip to do the work.
http://forums.parallax.com/showthread.php?141091-10-Full-Control-MP3-Player&p=1119861
Thanks for the help.
Matt
MP3 BS2
Pin 1 Vss
Pin 2 Vdd
Pin 3
Pin 4
Pin 5
Pin 6 Pin14
Pin 7 Pin15
Pin 8 1K->Speaker->Vss
Pin 9
Pin 10
Pin 11
Pin 12
Pin 13
The datasheet provided by MDFly does not provide much help but it can be found here:
http://mdfly.com/Download/Module/AU5106_spec.pdf
I am not really sure where to start. I would love some help simply sending a comand to the module and then reading back the retrun code. If someone can help me get that far I think I can figure out how to make the rest work.
I have been trying to use SEROUT and SERIN in the follwing way:
Send a STOP command to the module:
SEROUT 14,84,[$EF] 'STOP module
I am not sure if I am using the correct baud rate or if I should even be using SEROUT. I have no idea how to use SERIN to read the return code.
TXMP3 PIN 14
RXMP3 PIN 15
PAUSE 3000 'Allow module to fire up
SEROUT TXMP3,84,[$01] 'Play track 01
But still no sound. I don't know if the volume is too low or if I have activated the correct output pin on the module. I cannot seam to get SERIN to work so that I can read things from the module like the current volume.
TXMP3 PIN 14
RXMP3 PIN 15
PAUSE 3000 'Allow module to fire up
start:
DEBUG "PLAY 01.1",CR
SEROUT TXMP3,84,[$01] 'Play track 01
PAUSE 3000
SEROUT TXMP3,84,[$EF] 'Stop play
PAUSE 3000
DEBUG "PLAY 01.2",CR
SEROUT TXMP3,84,[$01] 'Play track 01
PAUSE 3000
SEROUT TXMP3,84,[$EF] 'Stop play
PAUSE 3000
DEBUG "PLAY 01.3",CR
SEROUT TXMP3,84,[$01] 'Play track 01
PAUSE 3000
SEROUT TXMP3,84,[$EF] 'Stop play
PAUSE 3000
If you did connect it properly somehow and changed the Baud to 115K, there's no way to change it back with a Stamp. The maximum transmit Baud for a BS2 is 9600. You'd have to get some kind of serial adapter for your PC like Parallax's USB2SER adapter and use the PC to send a "change Baud to 9600" command to the MP3 player at 115KBaud.
Your MP3 player has a headphone output. You can't drive a speaker without some kind of amplifier. Try earphones. Also, the A_GND connection ("analog ground") has to be connected to ground, ideally close to the power supply to minimize pick up of digital noise. For testing and experimentation, this usually doesn't matter, just connect A_GND to the same place as GND.
MP3 BS2
Pin 13 Vss
Pin 12 Vdd
Pin 11
Pin 10 Vss
Pin 9
Pin 8 Pin14
Pin 7 Pin15
Pin 6 1K->Speaker->Vss
Pin 5
Pin 4
Pin 3
Pin 2
Pin 1
My BOE has the same FTDI chip on it that is on the USB to SERIAL adapter you showed me. Is there a way to use the BOE to set the baud back to 9600? How do I hook up it up and what software do I use to send the command?
I am now trying to use the BOE as a USB3SER adapter so that I can change the baud on the MP3 player bacck to 9600.
I think I have the wiring figured out.
TX on the MP3 ----> SERIN on the BOE
RX on the MP3
> SEROUT on the BOE
Now I am trying to find some sort of Com Port Terminal.
Is my wiring correct?
What tool can I use to send the hex command to COM4 at 115200 Baud?
You can't use the BOE as a USB2SER adapter without some extra parts. Specifically, the BS2 uses inverted signals for its programming interface (Sin and Sout) while your MP3 player uses normal (non-inverted) signals. You'd need an inverter like part of a 74HC04. If you use the BOE's USB to serial interface, make sure to leave the BS2 module out of its socket so it doesn't interfere with the signals from the board's USB to serial interface.
You'll probably have to write a program for your PC to send a command to your MP3 board. How to do that depends on what you're familiar with. You could use Visual Basic. I've used Chipmunk Basic for this sort of project since it will talk to serial ports. It was developed for the Mac, but now has Windows and Linux versions as well and it's free and trivial to install.
I found a COM Port terminal called "The Advanced Serial Port Terminal 6 by Eltima Software" that looks like it will let me send and receive HEX.
There's also a quick and dirty serial adapter that uses a couple of transistors, resistors, and capacitors that you can get at a RadioShack. It's normally used for programming a Propeller, but would work for your MP3 board if you powered it from 5V instead of 3.3V as shown in this schematic. Leave out all of the stuff connected to the RESn pin of the Propeller up through the 0.01uF capacitor. It's not needed for your project. You do need the connection to DTR and the 10K resistor. Note that the pin marked Rx is the output from the adapter while the pin marked Tx is the input to the adapter.
2) The serial BOE won't help you much. The BOE's serial interface to the Stamp's SIN / SOUT programming pins is pretty minimal and doesn't do the voltage conversion or the inversion.
3) You didn't say how much experience you have in terms of basic electronics. The serial port adapter circuit is pretty simple. If it doesn't work, you may have wired it incorrectly. It's easy to get the transistors wired incorrectly since some transistors have their pins in one order and others have them in a different order. They're often marked on the case, but sometimes the description on the packaging is the only place to find the pin-out
Pin2 RX
Pin3 TX
Pin4 DTR
Pin5 Vss
I connected the DTR line to the RX line with a 10K resistor but left the 0.01 Cap off and everything that is down circuit from the cap the RES line.
I connected the line labeled Rx(P31) to the TX line on the MP3 Player.
I connected the line labeled TX(P30) to the RX line of the MP3 Player.
I connected the line labeled Vss to the same Vss used by the MP3 Player.
BOE
Cicuit(left side)
SOut
Tx
SIn
Rx
Vss
Vss
Circuit(right side)---MP3
Rx(P31)
Rx Pin8
Tx(P30)
Tx Pin7
Vss
Grnd
Forget the serial BOE for now. The voltage regulator on it can be used and the breadboard area can be used. The rest is not really helpful for now
Any other thoughts?
Is there a way to test the circuit without using the MP3 board to see if I have assembled it correctly?
You could test the circuit with a voltmeter. Really the transmit side (to the MP3 player) is the only one that's crucial. The idle (resting) voltage of that should be +5V. If you transmit a stream of characters with mostly 0 bits in them, like a byte of all zero bits or even something like a space, the output voltage should drop to near 0V. A transmitted character has 10 bits, a start bit that's always 0, a stop bit that's always 1, and the 8 bits of the character. If you transmit all zero bits quickly so there's no idle time between characters, that's 9 out of 10 bits with zeros, so the average voltage should be somewhere near 5 x (10-9)/10 = 0.5V.