Electronics > Projects, Designs, and Technical Stuff

DFPlayer mini tutoria with "error" but works

(1/1)

Youkai:
I can't figure out why this tutorial for the DFPlayer mini works. It seems to me that there is a clear error in the programming code. The tutorial: https://circuitjournal.com/how-to-use-the-dfplayer-mini-mp3-module-with-an-arduino

If you look at the code there is this section:

--- Code: ---static const uint8_t PIN_MP3_TX = 2; // Connects to module's RX
static const uint8_t PIN_MP3_RX = 3; // Connects to module's TX
SoftwareSerial softwareSerial(PIN_MP3_RX, PIN_MP3_TX);
--- End code ---
You can clearly see that the item he has commented as "RX" is the "TX" variable. But the TX variable is using the pin that is going to RX in the diagrams.

The RX and TX are swapped in the code but it actually works that way. I tried "fixing" the code and you get no audio. As far as I can tell from the wiring diagram and the documentation on "SoftwareSerial" this code should be incorrect. What am I missing?

OwO:
Maybe think about it a bit more  ;) ;)

coromonadalix:
They are not swaped in the code,  you define the tx and rx pins of the arduino board going to the module

you use pin 2 as the tx of the arduino board
you use pin 3 as the rx of the arduino board

The wire connections "are" crossed  going to the mp3 module


another page
https://wiki.dfrobot.com/DFPlayer_Mini_SKU_DFR0299#target_7

Youkai:
Thanks. I looked at the comments from the source code a little more carefully and figured it out. Good to see confirmation though :)

I didn't get that at first which is probably why my original sketch with a different library didn't work lol.

Navigation

[0] Message Index

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod