Go Down

Topic: Piezo sensor problem. (Read 513 times) previous topic - next topic

Mobben

Hallo, I have made a simple setup with an Arduino UNO, where a Piezo sensor and a 1M resistance are in parallel and are connected to GND and A0.
Then I made this simple code to see the analog input:
Code: [Select]
int knockSensor = A0;

void setup() {
  pinMode(13, OUTPUT);     
  Serial.begin(9600);
}

void loop() {
  Serial.println(analogRead(knockSensor));
  }


I thought that my output in the serial monitor would lay steady and jump then the piezo was tapped at. But instead it just looks like this:
0
0
0
0
70
84
0
0
0
8
91
69
0
0
0
26
102
0
0
0
2
80
78
0
0
0
16
106
And that is when you don't touch the piezo. The numbers jump then I tap the piezo directly, but not when I tap around it. I am quite new to this, so I hope someone could help me out :)

//Mobben

Grumpy_Mike

A 1M resistor is rather high and so the analogue input 'floats' picking up random interference. That's what you are seeing.
Try reducing it to 100K or lower.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy