DFPlayer Mini mit Wemos D1 Uno und wemos mini

Ich habe das hier nachgebaut.

Funktioniert einwandfrei.

Wollte das nun auf einem Wemos mini aufspielen weil er doch kleiner ist.

Aufgespielt. Leider passiert nichts.

Im seriellen Monitor kommen nur wirre Zeichen. Nicht wie beim Uno, wo alles klar zu sehen ist.

Kann es sein dass es auf dem wemos mini nicht geht ?

Danke

Du weißt schon, dass der Wemos ein ESP ist und damit ein komplett anderes System mit anderen Pins ist.

Zeige mal deinen Sketch und dein Schaltbild, wie du es am Wemos angeschlossen hast.
Wenn alles richtig ist funktioniert es auch am Wemos allerdings nur mit einer funktionierenden Library.

#include <SoftwareSerial.h>
#include <DFRobotDFPlayerMini.h> // download this library from Arduino IDE "Manage Libraries"

int pirPin = 2; // Arduino pin the PIR sensor is connected to
int rxPin = 3; // Arduino pin the TX pin of mp3 player is connected to
int txPin = 4; // Arduino pin the RX pin of mp3 player is connected to

int motionStatus = 0; // variable to store the PIR's current reading (high or low)
int pirState = 0; // variable to store the PIR's state change

SoftwareSerial fxSerial (rxPin, txPin); // Software Serial object
DFRobotDFPlayerMini fxPlayer;

void setup() {
  pinMode(pirPin, INPUT); // set Arduino pin that PIR is connected to as an INPUT
  pinMode(rxPin, INPUT); // set Arduino pin that mp3 player TX is connected to as an INPUT
  pinMode(txPin, OUTPUT); // set Arduino pin that mp3 player RX is connected to as an OUTPUT
  
  Serial.begin(9600); // initialize Serial Monitor (for looking at PIR readings)
  fxSerial.begin(9600); // initialize Serial communication for mp3 player
  fxPlayer.begin(fxSerial); // tells mp3 player to use fxSerial for communication
  fxPlayer.volume(16); // mp3 player volume (pick a value 10-30)
  
  delay(0); // allow 30-60 secs for PIR sensor to calibrate before proceeding with sketch
}

void loop() {
  motionStatus = digitalRead(pirPin); // read the PIR pin's current output (is it HIGH or LOW?)  
  
  // if PIR pin output is HIGH:
  if (motionStatus == HIGH) {
    
    if (pirState == LOW) {
      Serial.println("Motion Detected"); // print result to the serial monitor
      pirState = HIGH; // update the previous PIR state to HIGH
      
      fxPlayer.play(random (1,5)); // play track 1 from micro SD card
      delay(5000); // length in microseconds of the track
    }
  }
    
  // or else if PIR pin output is LOW:
  else {
      
    if (pirState == HIGH) {
      Serial.println ("Motion Ended"); //print result to the serial monitor
      pirState = LOW; // update the previous PIR state to LOW
    }
  }
}

Dann sieh dir mal die Pinbelegung des ESP8266 genau an.
Der GPIO3 wird für den seriellen Monitor genutzt und macht deine Probleme.

OK danke dann werde ich mal die Pinbelegung ändern

Prima, dann sollte es auch funktionieren.
Freue mich auf eine Rückmeldung.

Leider nein. bekomme das hier im seriellen monitor.

image

Beim uno wird Klartext angezeigt.

Stele mal SerMon auf 9600

Zeige mal dein Sketch

ser steht auf 9600

#include <DFRobotDFPlayerMini.h> // download this library from Arduino IDE "Manage Libraries"
#include <SoftwareSerial.h>
int pirPin = 7; // Arduino pin the PIR sensor is connected to
int rxPin = 6; // Arduino pin the TX pin of mp3 player is connected to
int txPin = 5; // Arduino pin the RX pin of mp3 player is connected to

int motionStatus = 0; // variable to store the PIR's current reading (high or low)
int pirState = 0; // variable to store the PIR's state change
int track = 1;

SoftwareSerial fxSerial (rxPin, txPin); // Software Serial object
DFRobotDFPlayerMini fxPlayer;

void setup() {
  pinMode(pirPin, INPUT); // set Arduino pin that PIR is connected to as an INPUT
  pinMode(rxPin, INPUT); // set Arduino pin that mp3 player TX is connected to as an INPUT
  pinMode(txPin, OUTPUT); // set Arduino pin that mp3 player RX is connected to as an OUTPUT
  
  Serial.begin(9600); // initialize Serial Monitor (for looking at PIR readings)
  fxSerial.begin(9600); // initialize Serial communication for mp3 player
  fxPlayer.begin(fxSerial); // tells mp3 player to use fxSerial for communication
  fxPlayer.volume(16); // mp3 player volume (pick a value 10-30)
  
  delay(0); // allow 30-60 secs for PIR sensor to calibrate before proceeding with sketch
}

void loop() {
  motionStatus = digitalRead(pirPin); // read the PIR pin's current output (is it HIGH or LOW?)  
  
  // if PIR pin output is HIGH:
  if (motionStatus == HIGH) {
    
    if (pirState == LOW) {
      Serial.println("Motion Detected"); // print result to the serial monitor
      pirState = HIGH; // update the previous PIR state to HIGH
      
      fxPlayer.play(random (1,6)); // zufall
      delay(5000); // length in microseconds of the track
      
      
        
    }
  
    }
  // or else if PIR pin output is LOW:
  else {
      
    if (pirState == HIGH) {
      Serial.println ("Motion Ended"); //print result to the serial monitor
      pirState = LOW; // update the previous PIR state to LOW
    }
  }
}


Weiter falsche Pins :wink:


der ESP startet dauerhaft neu um das zu sehen stell den SerMon auf 74880

Nehme 5, 4 und 2

Warum liest du dir den von mir verlinkten Beitrag nicht genau durch ?

Finde das besser

Label GPIO Input Output Notes
D0 GPIO16 no interrupt no PWM or I2C support HIGH at boot
used to wake up from deep sleep
D1 GPIO5 OK OK often used as SCL (I2C)
D2 GPIO4 OK OK often used as SDA (I2C)
D3 GPIO0 pulled up OK connected to FLASH button, boot fails if pulled LOW
D4 GPIO2 pulled up OK HIGH at boot
connected to on-board LED, boot fails if pulled LOW
D5 GPIO14 OK OK SPI (SCLK)
D6 GPIO12 OK OK SPI (MISO)
D7 GPIO13 OK OK SPI (MOSI)
D8 GPIO15 pulled to GND OK SPI (CS)
Boot fails if pulled HIGH
RX GPIO3 OK RX pin HIGH at boot
TX GPIO1 TX pin OK HIGH at boot
debug output at boot, boot fails if pulled LOW
A0 ADC0 Analog Input X

Die meisten Bastler können kein Englisch und kennen keine Übersetzer.
Man muss nur lesen und verstehen, dann klappt das auch.

Super mit den Pins klappt es einwandfrei. Motion detect und mp3 wird abgespielt.

Vielen Dank für eure Hilfe

PS. pir an pin 5 angeschlossen. aber leider reagiert er nicht auf Bewegung. Da muss ich nochmals was probieren.

Danke für Rückmeldung :wink:

Du weißt schon daß Du von einem 5V system auf ein 3,3V System wechselst? Der ESP darf keine 5V auf Steuer/Datenleitungen bekommen.

Grüße Uwe

Gehe von aus das der hängt an 3,3V

Wieso der ?
Der TO schreibt etwas von DFPlayer mini.

da würde ich mal fragen, was denn jetzt stimmt.

mein dfplayer mini arbeitet eiwnadfrei.

Nur der HC-SR501 erkennt keine bewegung