Piezo sensors 3 vs 2 pins

Can someone explain to me how I would wire this piezos to for example A0 of a mega NOT using the little pcb delivered with the piezo? I want to design it to a custom pcb just using the red and black wire of the piezo element. So how would I do that?

Thanks in advance,

There is this, but why should it be powered at all? The piezo generates a voltage (tutorial) when vibrating.

Schnittstellentyp: analoger Signalausgang; Pin-Definition: S-Signalausgang, Spannungsversorgung (VCC), - Masse (GND).

I avoid products that no one has reviewed:

Schreiben Sie die erste Bewertung

I assume you want to use it as contact microphone (wiring it to A0).
Yes, you can do that.
Just connect the red wire to A0 and the black wire to ground.
You also need a 1 Megohm resistor from A0 to ground.
Google "knock sensor" for code examples.

I want to use it as a sensor to detect darts landing in the outer ring of the board. So if you do not hit any number but the piezo is triggered the dart has landed outside the board and you will loose a throw subtracted from throw count. Can someone scribble how this would look if using a pcb/prototyping board and I do not plug the resistor to the arduino directly?

What PCB/prototyping board? The one on the piezo sensor product page does nothing useful.

I designed one myself. So basically I want to use male headers to Plugin the piezo which I soldered female connectors to. The question is what schematic do I follow on my pcb? I understand I have to do Red piezo to A0 black piezo to ground. But how does the resistor come into play? I know how to stick it into the arduino directly, but how will this be on a pcb?

So just to clarify here are pictures of the pcb I designed. Will it work if I solder in a 1M resistor at the place I mistakenly labeled it to be a 5K resistor?

Pictures are here: Imgur Pictures

But how does the resistor come into play?

Most people find that using a 1Meg resistor in parallel with the piezo works well. Example

So I would say I designed the pcb right then. Traces are in parallel if I am not mistaken.

Well unfortunately it is not working as described in here. I will only get 0 as a value from the piezos. Tried a few things but it is not working at all. Disappointing if you ask me.

I will only get 0 as a value from the piezos.

That's normal when idle.
Code (which you didn't post yet) should constantly sample.
Example sketch (untested).

const int threshold = 100; // 1 (sensitive) to 1023 (less sensitive)

void setup() {

void loop() {
  if (analogRead(A0) >= threshold) {
    Serial.println("Knock detected");
    delay(1000); // timeout

Well thank you for the reply. I do exactly that. But it will keep beeing 0 no matter what happens. Even if I bang the dart board with my fist it will just be 0. So no chance to detect darts.

You might wanna look at my sketch but I do not think I did something wrong. I tried your example as well. Did not work either.

Sketch: dARts/dARts.ino at master · patrickhener/dARts · GitHub

Must be something wrong with your resistor values or wiring or soldering.
Show a clear picture of the test setup.

Thank you. You might see the images of the PCB in use here: Imgur Images.

Image one shows the PCB top side. At the bottom you will see 2 times 2 pins for either one piezo, leading to to red and the black cable of the piezo.

Image two shows the PCB bottom side. At the bottom you will see the traces and the 1M Ohm resistors.
The resistors are in parallel to the circuit. The red side of the piezos are leading to A0 and A1 and the black side to GND. So do the resistors, cause they are in parallel.

Image three will show the PCB in place on top of a Arduino Mega 2650 Rev3.
On the right side of the PCB you will see orange and black as well as yellow and black cable pair. Those will lead to each Piezo in use.

The USB Cable of the arduino is plugged into the Raspberry Pi in the picture which will read the serial communitcation.

The sketch I use can be found in the link I posted before. Also I took this sketch

/* Knock Sensor

 * ----------------


 * Program using a Piezo element as if it was a knock sensor.


 * We have to basically listen to an analog pin and detect 

 * if the signal goes over a certain threshold. It writes

 * "knock" to the serial port if the Threshold is crossed,

 * and toggles the LED on pin 13.


 * (cleft) 2005 D. Cuartielles for K3

 * edited by Scott Fitzgerald 14 April 2013


int ledPin = 13;

int knockSensor = 0;               

byte val = 0;

int statePin = LOW;

int THRESHOLD = 100;

void setup() {

 pinMode(ledPin, OUTPUT); 



void loop() {

  val = analogRead(knockSensor);     

  if (val >= THRESHOLD) {

    statePin = !statePin;

    digitalWrite(ledPin, statePin);



  delay(100);  // we have to make a delay to avoid overloading the serial port


I modified it to not trigger a LED but just println. Also I made it print out the val each cycle. The val remains 0 no matter what.

This is all detail I can give. I hope this helps.

Wiring seems ok.
Note that your code reads the piezo about 10x per second,
while my code reads the piezo about 10000x per second.
I will try to connect a piezo to my Mega tomorrow (almost midnight here), and try the codes.

Wiring seems ok.
Not that your code reads the piezo about 10x per second,
while my code reads the piezo about 10000x per second.
I will try to connect a piezo to my Mega tomorrow (almost midnight here), and try the codes.

Thanks so much for your effort. Really appreciate it.