Introduction
After my IP Engineering Plate Frame Simplex loco's cheap greetings card sound module failed (see How I modified a cheap greetings card module as a sound card), I wanted something similarly cheap but more reliable as a replacement. Enter the DF Player Mini.
The DF Player Mini sound module has been around for quite a few years. It is modestly priced (c£3.50GBP on eBay or less than £2.00GBP on AliExpress), and is very versatile.
Basically, it is a compact MP3 player which can access tracks stored on a Micro SD card. What makes it particularly useful for use as a soundcard is that it has a built-in audio amplifier which will power a 3W speaker. Its operational voltage range is 3.2v - 5v and so will need to be connected to a voltage regulator if used with locos with a higher voltage battery pack (or track power).
VCC is the positive (+ve) input and either of the GND pins are the negative (-ve) input. The speaker is connected to SPK_1 and SPK_2.Tracks stored on the SD card are played in the order in which they were uploaded to the card and need to be numbered 001, 002, 003, etc. They can be in .MP3 or .WAV format. .WAV files are better for our purposes as they can be accessed or looped with a hardly noticeable gap between them. The module can accept cards up to 32Gb and so can potentially access thousands of sound files. However, I only needed a couple of files and so used a 521Mb card.
It has been designed to interface with microprocessors such as Arduino but, for my purposes, sound files on the SD card can be triggered by connecting various pins to Ground (ie 0v or the negative side of the battery used to power it).
For simple soundcard purposes, the most useful pins are:
Creating the sound files
Firstly, I needed to track down some suitable sound files. I would need the sound of a Simplex loco running at a fairly constant speed, and also the sound of a Simplex loco's fairly distinctive horn.
Browsing through dozens of videos on YouTube, I eventually located a couple of clips with segments which would suit my purposes. I captured the relevant sounds using Audacity, a free, open-source sound editing package.
I then highlighted a section of the recording which I felt was most appropriate for my needs, .......
I could now store this file on an SD Card (as 001) and then loop it using ADKEY_1 connected to ground to provide continuous sound for my loco.
Adding a horn sound
However, I also wanted to add a hooter or horn sound, triggered by pressing the Bind button on any of my Deltang or Micron transmitters.
After tracking down a section of video which featured a typical Simplex loco horn sound, I exported the short segment from Audacity (as above) and then re-opened the file of the steady Simplex engine sound which I had saved earlier.
The new combined sounds were then exported as a WAV file.
The reason for overlaying the horn sound on to the steady engine note is so that when the horn sounds, the engine sound continues in the background.
To allow the two files to be played and triggered, I had to make use of the ADKEYs ability to trigger separate tracks using resistor inputs. This also required the tracks on the SD card to be arranged accordingly.
I found that, not only did I need to delete the original WAV file, I also had to reformat the SD card otherwise the sound files wouldn't play properly. The horn sound was loaded first on to the card and renamed 001.wav . The steady engine sound was uploaded second and renamed 002.wav .
The link from GND to ADKEY_1 was replaced with a 3k resistor (so Track 2 on the card would be played continuosly) and a link from ADKEY_1 to pad C on the Deltang Rx65b receiver was made. Pad C gives 0v output when the bind button is pressed on the transmitter (ie Channel 5)
So, when the loco is first turned on, the 3k resistor from ground to ADKEY_1 makes DF Player loop Track 2 (the steady engine sound) but when the bind button is pressed on the transmitter, the receiver connects ADKEY_1 to ground directly and so, while the bind button is being held down, track 1 (ie the horn sound) is looped.Here's how it sounds.
Further DF Player Mini Projects
- A series of tracks triggered with the transmitter (pending)
- Automatically triggered tracks dependent on speed (pending)











No comments:
Post a Comment