Audio Module Project

Thread Starter

andrew74

Joined Jul 25, 2022
102
Assuming that I do not know whether this thread goes in the 'Power Electronics' section or in this one, I ask the moderators to move it to the right section (in case this one is wrong).

I recently bought this MP3 Module Amplifier (or this one if you cannot open the previous link) to be able to play with a speaker the tracks inserted in a micro SD card. What I want to do is 'copy it', or rather, create it myself.

There are 3 main steps:
1) Choose the components
2) Draw the schematic
3) Draw the PCB

I would like to go through some of these steps with you because it is the first time I am doing something like this and I am not sure where to start. Obviously if I need help with, for example, the third point I will open a thread in "PCB layout", but for now I would say: let's talk about the first point "Choose the components".

I think a class AB or class D amplifier is sufficient for this purpose, for example the 8002 (I think it is the same one used in the module I bought).
On the Digi-Key website I looked for an amplifier filtering only the output I want, which is (if I am not mistaken) 2W 8Ohm because the speaker I have is 2W 8 ohm. Is this correct? Any advice? I power the entire module with a small 5V power bank.

opamp.png
When choosing the amplifier I have to take into account that it will have to receive the songs on the sd card as input... so maybe I need an opamp with SPI or I2S? (like TAS5760LD but less performing)
 

Thread Starter

andrew74

Joined Jul 25, 2022
102
You need a microcontroller and MP3 decoder. This is not a project for a beginner.
I am in my third year of electronic engineering but unfortunately we have never created this kind of projects, but you learn from these things too.
 
Last edited:

KeithWalker

Joined Jul 10, 2017
3,091
I am in my third year of electronic engineering but unfortunately we have never created this kind of projects, but you learn from these things too.
Have you ever used an Arduino in a project before? There is a lot to learn before you can consider designing a project like this. There are tutorials on-line showing how to construct and program an MP3 player using an Arduino and similar SD card players to the one you have. I suggest that you use them as a starting point.
 

Thread Starter

andrew74

Joined Jul 25, 2022
102
You need a microcontroller and MP3 decoder. This is not a project for a beginner.
Have you ever used an Arduino in a project before? There is a lot to learn before you can consider designing a project like this. There are tutorials on-line showing how to construct and program an MP3 player using an Arduino and similar SD card players to the one you have. I suggest that you use them as a starting point.
Thanks! I'd prefer to use an STM32, but I'll have a look with Arduino too
 

BobTPH

Joined Jun 5, 2013
8,952
Actually, looking at those boards, they appear to use a single chip that probably does it all. But I doubt you can get your hands on one, (short of taking off such a board.)
 

Thread Starter

andrew74

Joined Jul 25, 2022
102
Have you ever used an Arduino in a project before? There is a lot to learn before you can consider designing a project like this. There are tutorials on-line showing how to construct and program an MP3 player using an Arduino and similar SD card players to the one you have. I suggest that you use them as a starting point.
Do I have to use a microcontroller? In this module I bought I don't see a microcontroller ... there are these 2 integrated circuits in the photos I enclose:

WhatsApp Image 2022-08-10 at 21.15.34.jpeg

WhatsApp Image 2022-08-10 at 21.15.35.jpeg
Which of these two is a micro?
The smaller IC is an 8002A amplifier ... the other micro I really don't know what it is.
Actually, looking at those boards, they appear to use a single chip that probably does it all. But I doubt you can get your hands on one, (short of taking off such a board.)
I found this very interesting video in which the signal from an audio jack is amplified and reproduced by a speaker.

I do not use a 3.5 mm jack but an SD card ... so I guess such a circuit is no good? I have a problem with the SD card which, I think, necessarily needs an IC with I2S or SPI .. Right?
 
Last edited:

Thread Starter

andrew74

Joined Jul 25, 2022
102

Yes I have seen several of these videos, but I have yet to find one that explains how to make/build those modules. Many people use ESP32, Arduino etc. and it's not a problem for me to use micros.

My idea was to recreate from scratch that MP3 decoder module with SD card ... and in the photo I sent in my reply #8 I don't think ESP32 etc. are used, but an integrated with I2S.

Maybe I am wrong but, as @BobTPH said, in the module I bought (I have already attached the two photos) only a single chip is used that probably does it all. Whether, then, this chip should be configured via Arduino or a micro I do not know.
 

Thread Starter

andrew74

Joined Jul 25, 2022
102
Yes I have seen several of these videos, but I have yet to find one that explains how to make/build those modules. Many people use ESP32, Arduino etc. and it's not a problem for me to use micros.

My idea was to recreate from scratch that MP3 decoder module with SD card ... and in the photo I sent in my reply #8 I don't think ESP32 etc. are used, but an integrated with I2S.

Maybe I am wrong but, as @BobTPH said, in the module I bought (I have already attached the two photos) only a single chip is used that probably does it all. Whether, then, this chip should be configured via Arduino or a micro I do not know.
Yes I have seen several of these videos, but I have yet to find one that explains how to make/build those modules. Many people use ESP32, Arduino etc. and it's not a problem for me to use micros.

My idea was to recreate from scratch that MP3 decoder module with SD card, or copy exactly (perhaps even using the same components) this module that I bought ... and in the photo I sent in my reply #8, I don't think ESP32 etc. are used, but an integrated with I2S.

Maybe I am wrong but, as @BobTPH said, in the module I bought (I have already attached the two photos) only a single chip is used that probably does it all.
 

BobTPH

Joined Jun 5, 2013
8,952
Okay, I will explain it.

The SD card contains digital data. It is just like a disk drive on your computer. You seem to think that it outputs audio directly, this is not the case. What you get from the SD card is compressed audio usually in MP3 formats, hence the name, but it could be any other format of your choice.

So, the first thing you have to be able to do is read the data off the SD card. This requires a processor. I believe the interface is either SPI or I2C, not sure which. Both of these are serial communication protocols. They provide nothing but a stream of bits.

Then you have to take the compressed data from the SD card and de-compress it. This is the MP3 decoder I mentioned. I don't think an Arduino is capable of doing this by itself, perhaps an ESP32 is. If you use a processor that is not capable of the decompression in real time, you need a separate MP3 decoder. If the processor is fast enough to do it itself, you need the software to do the decompression.

Once the MP3 is decoded, you need to turn this digital data into audio. That is done by a digital to analog converter DAC. With an Arduino, you are going to need a separate chip to to that. It can do D to A itself but not fast enough to play high quality audio.

And finally, the easy part and the one you have been concentrating on, you need and audio amplifier. This is the easiest part of the project.

I believe the modules that you linked have a single chip that includes all of these things, a processor, MP3 decoder, and DAC and has audio out. You may be able to find such a chip in small quantities with documentation, but I would not bet on it.
 

BobTPH

Joined Jun 5, 2013
8,952
One more thing. What is your purpose in doing this? Is it to learn about how it is done, or simply to make your own boards? If it is the latter, I would say forget it. They will cost way more than the finished modules sell for. If you can find the chip (and documentation) they use, it will likely cost you more than the entire board.
 

Thread Starter

andrew74

Joined Jul 25, 2022
102
One more thing. What is your purpose in doing this? Is it to learn about how it is done, or simply to make your own boards? If it is the latter, I would say forget it. They will cost way more than the finished modules sell for. If you can find the chip (and documentation) they use, it will likely cost you more than the entire board.
Thank you so much for the clarification!

My idea is to create my own mp3 decoder (i.e. recreate the ones you find a few dollars on the internet and that I attached a few posts ago) .. obviously this would be a good lesson to learn new things.

I would like to draw the schematic of the project: sd card + microcontroller + amplifier and speaker ... and possibly draw the pcb on the computer.
Then, I don't know if I will actually make the circuit, because I don't know how much the components, pcb printing, etc. will cost me.

But .. at home I have a STM32F407, the sd card, resistors, capacitors and the speaker ... do you think I can make the entire mp3 decoder? I'll probably connect everything on breadboard or a thousand hole card and the quality will be bad ... but that's for educational purposes only :)

In this "project", several times I thought of limiting myself to just drawing the schematic and the pcb on the computer ... but I don't think this is one of those analog-only applications (like a classic amplifier) that you can simply simulate on LTSpice. .. I think it needs to be assembled and tested. I am wrong?
 
Last edited:

BobTPH

Joined Jun 5, 2013
8,952
I think you are trying to take way too large a leap. An MP3 player is not the first circuit you should try to build.

What specifically are you hoping to learn?
 

Thread Starter

andrew74

Joined Jul 25, 2022
102
I think you are trying to take way too large a leap. An MP3 player is not the first circuit you should try to build.

I think you are trying to take way too large a leap. An MP3 player is not the first circuit you should try to build.

What specifically are you hoping to learn?
What specifically are you hoping to learn?

I would like to "play" with a microcontroller by receiving an audio signal via SPI or I2S etc. .. process it by producing an analog output signal and possibly amplify it with external circuitry.

Being a novice, I may not realize the difficulty of such a project.

As has already been said, there should be two ways: use a micro .. or a single chip that does it all.

In your opinion, which of the two ways should I do? Which is simpler?
Any advice / opinion is useful and welcome! Also, for example, an advice to try to make other simpler projects similar to this one.

Thanks!
 

KeithWalker

Joined Jul 10, 2017
3,091
You still do not understand the complexity of the project you are proposing. The hardware is the easiest part. How are you programming skills?
The only way you are going to get a single dedicated microprocessor already pre-programmed is by taking it off the module you already have. I would be a rather pointless exercise to just take the module apart and re-assemble it on a new circuit board.
There are available SD card reader modules which can be interfaced with a microcontroller. The physical circuitry is fairly simple. The major task is writing the software to access and process the data on the SD card. There are libraries available for most popular microcontrollers for I2C communication and audio signal data processing. You can use the libraries or if you are a software guru you can write your own. Either way, if you have not programmed a microcontroller before, you have a very steep learning curve ahead of you to find out how to write and test the software and how to get it into the microcontroller.
Here is a link to a page that describes how the SD card works and how to interface it with an Arduino. Good luck!

https://circuitdigest.com/microcontroller-projects/interfacing-micro-sd-card-module-with-arduino
 

Thread Starter

andrew74

Joined Jul 25, 2022
102
You still do not understand the complexity of the project you are proposing. The hardware is the easiest part. How are you programming skills?
The only way you are going to get a single dedicated microprocessor already pre-programmed is by taking it off the module you already have. I would be a rather pointless exercise to just take the module apart and re-assemble it on a new circuit board.
There are available SD card reader modules which can be interfaced with a microcontroller. The physical circuitry is fairly simple. The major task is writing the software to access and process the data on the SD card. There are libraries available for most popular microcontrollers for I2C communication and audio signal data processing. You can use the libraries or if you are a software guru you can write your own. Either way, if you have not programmed a microcontroller before, you have a very steep learning curve ahead of you to find out how to write and test the software and how to get it into the microcontroller.
Here is a link to a page that describes how the SD card works and how to interface it with an Arduino. Good luck!

https://circuitdigest.com/microcontroller-projects/interfacing-micro-sd-card-module-with-arduino
Thank you! I found this very interesting video that explains and implements the code using STM32 and I2C .. What do you think?
I will have a look!

I had not thought about using a USB one for music ... which (perhaps) is easier to handle since it is already mounted/supported on STM32 and requires no external circuitry ecc.
 

KeithWalker

Joined Jul 10, 2017
3,091
Thank you! I found this very interesting video that explains and implements the code using STM32 and I2C .. What do you think?
I will have a look!

I had not thought about using a USB one for music ... which (perhaps) is easier to handle since it is already mounted/supported on STM32 and requires no external circuitry ecc.
I watched the video. No doubt if you follow the instructions carefully, you will probably get it working but you will not learn much. He gives all the details of how to set up the registers and how to program it but he doesn't explain why. You will still have very little understanding of what the STM32 is doing, or how it is doing it. You will not learn enough to set it up and program it to do anything else.
I still recommend the link to the Arduino project if you really want to understand how to get sound files from an SD card and play them as audio. It explains the basics and is a much simpler project for a first microprogrammer project.
 
Top