

If you get stuck anywhere feel free to send your questions via the comment section. That’s it for this tutorial guys, thanks for following. Multi-channel voice alarm or equipment operating guide voice.Electricity, communications, financial business hall voice prompts.

Some of the applications of this tutorials are listed below and I hope it gives you the inspiration to build something really cool. Your final setup should look like the image below.

You should hear songs start streaming out from the connected speaker.
Arduino speaker code code#
Load an SD card with songs and insert into the DFplayer mini, then upload the code to your Arduino and connect the wires from speaker to the speaker pins of the DFPlayer mini.
Arduino speaker code serial#
With this done we start the software serial communication with a 9600 baud rate. Next, we move to the void setup function where we set the pin mode of the pins to which the buttons are connected and set those pins “high”. Next, we declare the pins of the Arduino to which the push buttons are connected. # define Acknowledge 0x00 //Returns info with command 0x41 Next, we define some of the commands that we will use specifying the hex values. The first thing we do in the code, as usual, is to include the libraries that we will use which in this case is the software serial library, creating an object of the library while declaring the Rx and Tx pins (10 and 11 respectively). The code for this tutorial is simple, while the DFPlayer mini has a library which contains different functions for controlling the mp3 player, we will write our own functions for the fun of it and to help show how the module really works. So to communicate in a stress-free manner we will use the software serial library with pins 10 and 11. While we could have used the hardware serial to send commands from the Arduino to the DFplayermini, the Arduino hardware serial pins (0 and 1) are the same pins used by the Arduino to communicate with the computer and may prevent code to uploaded smoothly if connected to any other device. To send commands from the Arduino to the DFplayer mini, based on the button pressed, we will use the Arduino software serial library. Our switches are intentionally connected without pull up (or down) resistors because we will enable the Arduino internal pull up resistors. Go over the connections once again to ensure everything is as it should be. The connection is described below for clarity. It should be noted that the 1k resistor added in between the Rx pin of the module and the Arduino was added to reduce noise but it’s not necessary if your module setup is not accompanied with noise on the Rx line. The schematics for this project is fairly easy SchematicsĪs seen above the connection between the Arduino and the DFplayer mini is very simple as we only need to connect two pins aside VCC and GND. The following components are required to build this project Īs usual, each of this components can be bought via the link attached to them in the list above.

The second button will be to “play/pause” the file currently being played and the third button will be used to play the next file. The first button will serve as the “previous” button that will enable us to play the previous song. We will use three buttons to achieve this. The goal of this tutorial is to demonstrate the use of this module with Arduino, using the push buttons to instruct the Arduino to send serial commands to the module and control mp3.
