DFPlayer Mini MP3 Module with Arduino
FunduinoPublished on
Von der SD-Karte bis zur Türklingel mit eigener Ansage
You need this
5 V buzzer - electromagnetic sounder, 2400 Hz
0,90 € *Item no. F23108736About the product — 5 V buzzer - electromagnetic sounder, 2400 Hz
MP3-TF-16P V3.0 MP3 player - microSD up to 32 GB, serial
3,11 € *Item no. FUN-1010563About the product — MP3-TF-16P V3.0 MP3 player - microSD up to 32 GB, serial
Funduino UNO R3 Microcontroller - ATmega328P, 16 MHz, for Arduino
11,12 € *Item no. F23107480About the product — Funduino UNO R3 Microcontroller - ATmega328P, 16 MHz, for Arduino
830-point Breadboard - solderless breadboard for Arduino
2,90 € *Item no. FUN-1010553About the product — 830-point Breadboard - solderless breadboard for Arduino
Breadboard Cables Male-to-Male - 40 Pieces, 20 cm
1,74 € *Item no. FUN-1010558About the product — Breadboard Cables Male-to-Male - 40 Pieces, 20 cm
All 5 parts together 19,77 € *Ready to ship immediately · Delivery time: 1-3 business days
* All prices include statutory VAT, plus shipping costs.
Prepare the SD card
The circuit diagram
Install and test the library
1 / 2
The program code in its simplest form
Minimal form: play an MP3 file
#include "Arduino.h"
#include "SoftwareSerial.h"
#include "DFRobotDFPlayerMini.h"
SoftwareSerial mySoftwareSerial(10, 11); // RX, TX
DFRobotDFPlayerMini myDFPlayer;
void setup()
{
mySoftwareSerial.begin(9600);
myDFPlayer.volume(30); // Set volume to maximum (30)
}
void loop()
{
myDFPlayer.play(1); // Play the first MP3 file
delay(3000); // The sketch pauses for three seconds after playback.
}Doorbell with voice announcement
Doorbell with voice announcement
#include "Arduino.h"
#include "SoftwareSerial.h"
#include "DFRobotDFPlayerMini.h"
SoftwareSerial mySoftwareSerial(10, 11); // RX, TX
DFRobotDFPlayerMini myDFPlayer;
int taster = 7; // The word "taster" now stands for the value 7.
int tasterstatus = 0; // This is where it is stored whether the button is pressed or not.
void setup()
{
mySoftwareSerial.begin(9600);
myDFPlayer.volume(30); // Volume at maximum (30)
pinMode(taster, INPUT); // The pin with the button (pin 7) is now an input.
}
void loop()
{
tasterstatus = digitalRead(taster); // Read pin 7. The result is HIGH (5 volts) or LOW (0 volts).
if (tasterstatus == HIGH) // If the button is pressed …
{
myDFPlayer.play(1); // … the module plays the first MP3 file.
}
}The scolding houseplant
The scolding houseplant
#include "Arduino.h"
#include "SoftwareSerial.h"
#include "DFRobotDFPlayerMini.h"
SoftwareSerial mySoftwareSerial(10, 11); // RX, TX
DFRobotDFPlayerMini myDFPlayer;
int messwert = 0; // The sensor reading will be stored here later.
void setup()
{
mySoftwareSerial.begin(9600);
myDFPlayer.volume(30); // Set volume to maximum (30)
}
void loop()
{
messwert = analogRead(A0); // The voltage at the sensor is read and stored in "messwert".
if (messwert <= 300) // If the reading is 300 or less …
{
myDFPlayer.play(1); // … the module plays the first MP3 file.
}
}Done!
Rate the instructions