Pages: [1]   Go Down
Author Topic: Using the LDT0-028K piezo sensor to detect water impact  (Read 555 times)
0 Members and 1 Guest are viewing this topic.
India
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I bought a LDTO-028K (https://www.sparkfun.com/products/9196)
I want to use it in a situation to detect water falling on a surface. Water falls from a height of 10 inches onto a surface below which this piezo sensor is stuck. I have connected a 1M resitor in parallel to the sensor and I get readings when water hits the surface and I light an LED using that data.

My problem is the LED keeps blinking. How do i get a stable on/off like situation when water falls on the surface and when it does not. I tried some debouncing but that does not seem to work.

My code is very straight forward :
int sensorPin = A0;
int ledPin = 13;
int sensorValue = 0;

void setup() {
pinMode(ledPin, OUTPUT);
}

void loop() {
sensorValue = analogRead(sensorPin);
if (sensorValue >70){
digitalWrite(ledPin, HIGH);
}

else{
digitalWrite(ledPin, LOW);
}
}

Anyone has any clues?

Thank you
Logged

Oregon, USA
Offline Offline
Edison Member
*
Karma: 69
Posts: 2363
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Have you read through the technical manual and comments on the Spark Fun product page? There are lots of useful details and suggestions.
Logged

"It seems to run on some form of electricity"

United Kingdom
Offline Offline
Tesla Member
***
Karma: 227
Posts: 6637
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Have you tried increasing the value 70 in that code? Using a higher value will decrease the sensitivity. Hopefully, you will find a value that is sensitive enough to detect the falling water, but not sensitive enough to pick up noise.

Unless the wires between the transducer and Arduino are very short, use shielded cable to connect the sensor to the Arduino.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Pages: [1]   Go Up
Jump to: