Hello everybody,
i have this problem that i can't solve:
I am using Arduino NANO on expansion shield, with PIR module and the DFplayer Mini and a RELE module (the classic reverse logic blue relay module)
speaker connected to the GND and the DAC of the DFplayer.
The uploaded scketch is this:
#include "SoftwareSerial.h"
#include "DFRobotDFPlayerMini.h"
int PIRpin = 9;
int Pir_Stato = 0;
int LedVERDE = 13;
int RELE = 4;
SoftwareSerial ss(3, 2);
DFRobotDFPlayerMini mp3;
//# SETUP
void setup() {
digitalWrite(RELE, LOW);
delay(1000);
pinMode(LedVERDE, OUTPUT);
pinMode(RELE, OUTPUT);
pinMode(PIRpin, INPUT);
digitalWrite(LedVERDE, LOW);
//# === Setting DFPlayer
delay(1000);
ss.begin(9600);
delay(1000);
if (!mp3.begin(ss)) {
for (;;);
} //# controllo DFPlayer
delay(1000);
mp3.disableLoopAll();
mp3.disableLoop();
mp3.EQ(DFPLAYER_EQ_NORMAL);
mp3.enableDAC();
mp3.volume(30); //# VOLUME: massimo =30
} //# FINE Setup
//# .........INIZIO LOOP
void loop() {
delay(300);
Pir_Stato = digitalRead(PIRpin);
if (Pir_Stato == HIGH) {
mp3.enableDAC();
digitalWrite(RELE, HIGH);
digitalWrite(LedVERDE, HIGH);
delay(200);
mp3.volume(30);
digitalWrite(RELE, HIGH);
delay(200);
mp3.play(1);
delay(72000);
delay(500);
digitalWrite(RELE, LOW);
digitalWrite(LedVERDE, LOW);
delay(500);
digitalWrite(RELE, LOW);
} //# Fine Allarme
After receiving the PIR alarm signal, the RELE switches to give power to the externally powered speaker, waits and then starts the only .MP3 on the SD.
It waits for 72 seconds for the MP3 then turns off the speaker.
I put the internal LED Pin13 as a visualization of the received alarm PIR signal.
Everything WORKS, the PIR gives the start signal even after 15 minutes between one alarm and another ... BUT IF I WAIT for about an hour, and try to allarm the PIR, nothing works anymore.
Even the internal LED does not turn on .... in this "block/Stuck" state, if I tried to disconnect and reconnect the three wires of the PIR, the situation does NOT CHANGE.
I am forced to press Reset on Arduino.
Note: The connections are all made with very short wires.
What can I check/Do to understand the cause of the "block"