DF Player with a Piezo plate Triggering Issue

Hello All

I am having a code for DF Player with a triggering piezo plate at analog input

#include <SoftwareSerial.h>
#include "DFRobotDFPlayerMini.h"
SoftwareSerial mySoftwareSerial(10, 11); // RX, TX
DFRobotDFPlayerMini myDFPlayer;
byte pbRegister = 0;
void setup()
{
  mySoftwareSerial.begin(9600);
  Serial.begin(9600);
  if (!myDFPlayer.begin(mySoftwareSerial))
  {
    while(true)
    {
    delay(0);
    }
  }
  myDFPlayer.volume(29);
}
void loop()
{
        int sensorValue = analogRead(A0);
        if(sensorValue>=300)
  {
     //myDFPlayer.play(1);
     myDFPlayer.playFolder(2,1);
     Serial.println(sensorValue);
     delay(10);
  }
  pbRegister = 0;
  delay(100);
}

Problem with the Operation is here :

When I hit the Piezo plate a bit gently, it triggers the sound (with a very very small delay as usual)

But when I hit it a bit harder than before, it starts playing the sound effect 3, 4 or 5 times
(for a single hit only)

Suppose i am using a Door-knocking sound single sound and hit the plate
it starts knocking so many times depending upon how hard we hit the plate

With a harder hit on plate , the number of repeats for the sound is getting increased
from 3, 4 to 7 or 8 times . . Don't know what's the matter . .

Whats the issue here ? please help in solving
Thanks !!!!

You'd have to view the signal in an oscilloscope. It probably bounces back and forth. A piezo element usually creates a very noisy signal with huge voltage spikes. It needs its own circuit to filter out everything.

1 Like

Ya ya exactly i had same feeling but when i connect with a cheap sd card module with TMRpcm
it works absolutely fine with no delay

But here a small delay is observed too.

Also in Sd card model we can have (val>50) or (val>100) for a proper functioning

But in this DF player case, we need to apply (val>200) or 300 or more so as to make it a bit stable but need to hit hard enough to damage or deform the plate.

So what type of network you would suggest for its own circuit to filter out ??????

Please let me know so as to surf it on net or any simple design !

Hi,
Can you please post a circuit diagram of your project?
Have you got 1M shunt resistor across the piezo device?

Can you please post an image(s) of your project?

Thanks.. Tom... :smiley: :+1: :coffee: :australia:
PS: Any particular reason to use piezo instead of buttons/switches?

1 Like

Oh yes yes i forgot to add shunt . . my goodness !!! :grimacing:
Ok le me add n check it

Regarding diagram :

DFPlayerMini_Arduino_bb

Just same as above including a piezo plate at A0 input and ground .
And just now a shunt as you recalled

Now coming to reason behind switch :

This type of sensors would work just like a

"Hit n Run"

Here Hit stands for hitting a rubber pad with a stick & Run is for running a program and triggering an assigned sound so as to act the system like a musical drum

and too i observed fast and real time triggering with piezo plate in case of cheap SD card module
sp it's another reason i am trying to implement the idea here ..

Well let me work with shunt first here and thanks a lot for the help :smiley:

Ya got it sir . . Thanks for the help !!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.