Below video will be a bit louder and better compared to the above one. This is taken at day time, so no restriction for volume... Unfortunately I couldn't demo few songs due to copyright protection, so after few trial and error of uploading, this worked.
A small standalone IR remote controlled MP3 WOOFER from scratch using NXP ARM Cortex M4 microcontroller (FRDMK64F), helix MP3 decoder, Texas Instruments 15W class D audio amplifier, @xiaomi 5v, 104000 mAh power bank and a $2 MUD POT with a hole for the bass reflex.
Audio without mud pot
I am having an FRDMK64F board with me and I was confused what to do with it. Now I got an idea to make an MP3 woofer project using this. Basically I want to make a standalone
I googled for some mp3 decoding library for ARM cortex and I found a couple of those from Github mostly ported for STM32 boards. I selected the helix port and included in my project.
For now I am using the internal DAC of the MCU to spit out analog audio signal from the decoded PCM signal. I am using a small 128x32 OLED display for showing song name and the time. This is based on SSD1306, i2c interface.
Apart from this, the FRDMK64F is having micro-sd slot and debugger, I am using J-link debugger, I replaced the default CMSIS-DAP to J-link which seems much better and reliable.
For audio amplification, I am using a 15W class D amplifier (TPA3122D2) form Texas instruments.
To power the system, I am using a 10,000 mAh 5V power bank. For powering the amplifier I am boosting the 5v to 12v using a boost circuitry. Also a 4700 uF capacitor is connected at the 12V side so that it take care of sudden burst current required while the speaker is performing heavy bass. The inductor and capacitor for audio filtering should be selected properly according to the recommended values from the datasheet, else the results can be poor and the circuitry may get damaged as well.
Nothing more to write regarding this project. :) If any one need any more information, please comment and I will update accordingly. Please find the complete source code for the project from the below link.
Working:
On reset, the mcu will read all the mp3 file names from the root folder (sd card) to an array and start decoding the first file. Here I am using SDIO interface for micro sd card. This is much faster than the SPI interface. For fatFS I am using the Chan's fatFS library.
After opening an MP3 file, the mp3 data is provided to the helix library which will decode and provide the PCM data. This PCM data is then provided to the DAC via DMA in circular manner. While the first half of audio buffer is played via DAC via DMA, the second half is filled after decoding the frame, and this process is toggled between the first and second half of audio buffer.
This way we can achieve uninterrupted playback. Thanks to DMA without which it will be extremely difficult to do. Unfortunately the DAC is of only 12 bit precision, to get a better audio quality, we need to use external I2S DAC chips, but for now this is okay for me. A;so I am doing only mono now as I couldn't find second DAC on the FRDMK64F board.
CPU is free to do any other activity after it pushes a decoded frame to one of the half of audio buffer until the DAC finishes playing the other half.
The i2c based OLED display is updating time regularly without affecting the playback and timings. Here the i2c is implemented based on interrupt, so there is no waiting/blocking.
The RC5 -IR signal is capture by input-capture module which saves the time-stamp and gives interrupt. The time-stamp is collected to an array and interpreted after required amount of bits are received with a timeout.
Source code:
https://github.com/vinodstanur/frdmk64f_mp3_player
The above source code can be compiled using MCUXpressoIDE which is free to download and use.
Circuit connections and parts:
1> Boost converter: MT3608 Step Up Boost Module
2> OLED connection: The OLED is soldered to the accelerometer i2c pullup resistors. You can zoom the image and check the connections if required. After soldering, I am hiding the wires under the display and the display is glued using hot-glue. So it looks like the display came along with the board. Don't get confused.
3> Audio amplifier.
I am using bridge tied configuration for connecting MONO woofer to the amplifier. In bridge-tied model, I will be able to get more power delivered to the woofer because it is driven by two half bridge circuitry which is supposed to drive a stereo (dual woofer). Please check the datasheet for the circuit diagram.
Since I am using bridge tied mode for speaker, I am using a small additional circuitry between the differential audio input and the real mono input. This is nothing but a phase splitter with a decoupling circuitry. (as below)
4> IR Receiver (TSOP1738) connection:
The IR receiver is powered from the GPIO of the MCU, two pins are configured as GPIO OUTPUT with one PIN 0 and other one 1 which is programmed accordingly. A small capacitor (2uF) is connected in parallel to the TSOP1738 VDD and GND. Connections can be as per the below pic. I am not drawing circuit diagram for this.
5> Remote control:
I am using Mi-remote using my Xiaomi A1 android mobile. I selected Philips TV option and the protocol is RC5. I am using input-capture feature of Timer and GPIO for capturing the time-stamp of IR-receiver output. You can check the source code for more details. Currently I implemented NEXT, PREVIOUS, Fast forward, Mute, bass-boosted, Pause/play features on remote. Can implement a lot more as well.
Pics:
Source code:
https://github.com/vinodstanur/frdmk64f_mp3_player
The above source code can be compiled using MCUXpressoIDE which is free to download and use.
Sir,
ReplyDeleteThis is a great project
My name is SHIJITH from Kannur,Kerala.I am doing my B Tech Degree in EEE form GEC Wayanad. Can you suggests some methods to improve my skills in analog and digital circuit designing,
Try doing it, if not try simulating circuits so that you will get a better understanding. Then slowly you will realize that those boring classroom theories are becoming more and more interesting.
DeleteFor example, try making a boost regulator or buck regulator using a microcontroller and external MOSFET - Inductor switching. Take a feedback from output to ADC pin and try to regulate the output, you will definitely learn a lot by doing all these. This is a analog-digital combined example which you can practice.
Never connect any expensive load to the output (example Mobile phone) coz a bug/transient can damage the device from overvoltage/overshoot. So try doing all these, you will definitely enjoy it and at the same time you will learn a lot.