Most clocks use sound to wake you up. This clock is no exception.
A little "DFPlayer Mini" module does all of that, also MP3 decoding. It even includes a speaker driver.
Yue Xin YX5200-24SS module
! Check for short circuit between pin 3 and ground! The corner of the SD-card connector is very close to pin 3. Two of my boards had that issue.
Works like a breeze with the platformio. Be careful to connect your module correctly. I've already destroyed one by wrongly connecting it and nearly killed a second one. Strange...the polarity is clearly marked on the module.
- Decoder IC : (auto translated datasheet)
- AliExpress $1.17
- Modules
- DFplayer Mini module
- SMARTWAV
- Flyrontech as FN-M16P, module datasheet can be found here.
- Embedded Adventures MOD-1021
- User experience from Markus Wobisch
- Library:
- The official library from DFRobot locks up when making too many calls to it.
- DFPlayer Mini Mp3 by Makuna is a better alternative
- Power supply : The DFPlayer Mini sometimes crashes when it's powered by the 3V3. Maybe my 3V3 supply can't deliver enough current. I didn't have this problem when supplying it with 5V.
- Before copying music files, normalize their volumes.
sudo apt install python-rgain replaygain --force *.mp3
I have the impression that it works well on a PC, but that the DFPlayer ignores the normalization. I have also tried to use Audacity using the procedure described here, but also with disappointing results.
sudo apt install ffmpeg ffmpeg -t 430 -i 2.mp3 2b.mp3
One song ended in a 1min20s silence. The ffmpeg command allowed me to strip that pause off.
- There are two options for audio output: headphones (stereo) and speaker (mono).
- Speaker output is generated by the on-board amplifier. According to the VCC, GND and speaker connections, the amplifier is a PAM8302A (or LM4871, or XPT4871, or YX8002-8S). This one can send 2.5W into a 4ohm speaker. That's certainly loud enough.
- The speaker output of the module certainly needs filtering to reduce EMI.
- The speaker sound lacks low frequency content. The input coupling of the PAM8302A might have a too high corner frequency. Let's see what other designs are using:
- Elektor "PAM8302A Audio Amplifier" (issue June 2018) : 180ohm in series with 220nF
- Adafruit 2130 : 100ohm in series with 1uF
- DFRobot advises to add a 1K resistor in series with the RX-line (pin 2) to reduce noise.
- See also Markus Wobisch schematic to reduce noise.
- EMI precautions : see Elektor "PAM8302A Audio Amplifier" (issue June 2018)
WTV020 module
- $1.93 module from AliExpress
- SMD (only components on one side)
- Also used by Sparkfun
- ADPCM, WAV, no MP3
- serial interface : DATA + CLK
GeneralPlus GPD2846A module
This module doesn't seem to allow control by a MCU, except through USB.
GeneralPlus GPD2856A module
This module doesn't seem to allow control by a MCU, except through USB.
PWM output
It doesn't look like there's already an established solution for the STM32 platform. This will require lots of work.
The cheapest option would be to generate sound using PWM, but it requires some work. The sound files also need special conversion before storing them to flash. An output amplifier is needed for connection to a speaker.
Arduino Wave shield
It uses a MCP4921 DAC and an SD-card. Both are SPI devices, but they're connected to a different bus.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.