Thanks to Tom for the link to the mini MP3 players. I raided the piggybank and paid 4 aussie dollars for two of them. (You need a TF / mini SD card too, so another couple of dollars!)
The whole thing is 20mm square and looks like this:
- DF mp3 mini player composite.jpg (57.79 KiB) Viewed 3850 times
It includes an amplifier to drive a speaker too. It runs from 3.3 to 5.5Vdc and takes about 18mA (@5V) when not playing a sound.
I was initially interested when I found that they could be used stand alone, just using switches and resistors to trigger up to 14 different sound files. I thought maybe some sounds like a diesel horn or shovelling coal, could be triggered from RC outputs?
I found that I could easily get them to work in that ‘switch’ circuit, called Adkey mode.
See data sheet here for the circuit:
https://www.dfrobot.com/wiki/index.php ... KU:DFR0299
Note that ‘segment’ on the circuit diag means file.
The sound files are stored on the TF card but since sound files are pretty small, the number you could store on even an 8 GB card would be enormous. You can use either MP3 or WAV files. (I did have one wav file that didn’t work – I think it was too low resolution at 8kbps)
The 'order' of the files called segments 1 to 14 is determined by the order in which you copy the sound files onto the TF card. The first one copied to the card will be segment 1. This is something to do with the FAT32 file system – I no understand.
I found a problem that if I copied a number of files all at once - I suspect it couldn't tell which one was 'first' etc. So I recommend copying one file at a time onto the TF card, with a few seconds between each one. The drawback to this is that if you ever want to change a file and reload it onto the TF card, it and all other files will have changed number and your switches will play the wrong files.
If the relevant switch 'K7 to K20' is closed to 0V momentarily, the segment is played once and then stops. If the switch is held low for 1 second or more (or continuously), the sound file loops when finished - ie it starts again WITH NO AUDIBLE PAUSE BETWEEN !
But having ‘mastered’ the Serial method, I abandoned it ! I realised that I couldn’t trigger enough files by RC switches. Maybe it would be useful for lineside sounds, but that’s it.
Since I am a Picaxe aficionado, I proceeded to look at the data sheet for the ‘Serial mode’ of operation. This is where you use a Picaxe (or Arduino) to send short serial commands to the mini MP3 player to select which track will play. Unfortunately since the method was designed for ‘real’ mp3 players it was very complicated at first look, sending messages back and forth between the picaxe and player. And I later found that the data sheet linked above, was not complete!
This was probably the reason when years ago I ‘looked at’ these things, that I gave up.
But I found it really is very simple if you have a little picaxe knowledge. All you need is one wire , with a 1k resistor, from the picaxe to the player’s ‘Rx’ terminal to send commands to the player.
In this mode the TF card MUST have a folder called /MP3 with the sound files in it AND each file must have 4-numerals at the start of the filename, and can be followed by further alpha characters if required. These are ignored and the 4 digit number is all that is used to address the file.
Eg 0001- startengine.mp3
Commands include “play track number xx’, ‘play and loop track yy’, increase or decrease volume in 30 steps.
A full listing of commands is here, starting on page 17:
http://www.picaxe.com/docs/spe035.pdf
Unfortunately, when you send a command to play another file, while one is playing, there is an audible sound gap. Maybe ¼ to ½ sec – there, but scarcely noticeable.
But if the file is in ‘loop’ mode there is NO gap when it goes from the end back to the start,
I have tested a program that could be used for a diesel loco sound. I had 5 files:
0001 engine starting.mp3, plays at power on to picaxe, then plays
0002-engine idling.wav, plays and loops over and over until picaxe detects a speed/motor volts increase, then plays
0003-engine notching.mp3, then plays
0004-engine running fast.mp3, plays and loops until voltage decreases, then plays idling again.
If idles for more than some time period, play
0005-engine shutting down.mp3.
All very promising. Might do a video soon.
As this forum is probably not that interested in picaxe programming, I’ll finish here. If you want more programming details, ask here or via PM.