Pages: [1]   Go Down
Author Topic: Piezo sensor problem.  (Read 438 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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 smiley

//Mobben
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 602
Posts: 33374
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1]   Go Up
Jump to: