I am a front end developer but I am quite new to the micro controller world.
The Project
I am trying to create a RFID tag controlled mp3 player for my son (kind of like a "tonieBox" clone.
The idea is to build something like this:
When we put an RFID tag on the device, we must read the tag and start playing mp3 from the corresponding folder on the sd card
When we remove the RFID we should stop playing
The parts
I have started out with an Arduino Uno, but now changed to a ESP32 doit devkit v1 (because of the builtin wifi)
What i have done
I have been following some tutorials and tackling the problem piece by piece.
I have the RFID tag reader working
I have buttons for start, stop, volume up and down working
I have connected the SD card and could read the content of a test txt file
My problem
I now need to play the correct m3 file when a tag is present.
I thought this would be something easy, but after trying for a week i am about to give up. i have no idea what i am doing wrong.
I get no sound!
If i add a Serial.println to the code where i read the tag, i see it on the Serial Monitor, but i can't get the audio to work!
The code
I'm not sure what code to post.
I have split the code into several smaller files, you can see it all on the github page for the project
I would really thankful for any help.
Please let me know if there is any other information you need.
Posting the part where the problem appeared, the SD card being execised, would be good.
Does using Serial.println of the filename of the mp3 file tell anything?
Having a number of predefined files used according to the selection ought to be easy.
Following the advice from both of you i have tried a couple of different things to see if it works just the mp3 player.
The first thing i did was to use a different speaker. No change...
Then i tried adding some serial prints to the see if the audioPlayer is getting initialized:
Added this:
AFTER SETUP ========================
0
15
16
0
AFTER CONNECT ========================
1
15
16
3980786
3.980.786 is indeed the number of bytes on the file (as i see it on my mac).
So i think the audio player is getting initialized and it can get the mp3 file from the SD card. Am i wrong assuming this?
So i think the problem is with the MAX89357A module or with how i have it wired.
I have another module around. just need to solder some pins so i can try it (will do tomorrow).
I have tried connecting to different pins, but no luck either.
I have some problem understanding what the ESP32 pins are for. It's not like just analog or digital pins like on my UNO. The pins have some "roles", so maybe i am connecting to some wrong pins?
Currently:
LRC: pin 26
BCLK: pin 12 (also tried on 22)
DIN: pin 25
Could this be the problem?
Any other ideas on how i could debug this?
Would it be possible to connect a speaker directly to the board?
@Railroader The code is split into smaller files, so i am not sure how to post that correctly.
On the question i have posted a link to the github, is that ok? enough?
Setting up audio player...
AFTER SETUP ========================
0
21
16
0
info PSRAM not found, inputBufferSize: 6399 bytes
info buffers freed, free Heap: 149252 bytes
info Reading file: "/amaze.mp3"
info MP3Decoder has been initialized, free Heap: 121536 bytes
AFTER CONNECT ========================
1
21
16
3980786
info Closing audio file
info End of file "amaze.mp3"
eof_mp3 amaze.mp3
So it opens the file but it immediately closes it!
Any ideas?!