Go Down

Topic: Using the LDT0-028K piezo sensor to detect water impact (Read 607 times) previous topic - next topic

dennyabrain

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

jremington

Have you read through the technical manual and comments on the Spark Fun product page? There are lots of useful details and suggestions.
"It seems to run on some form of electricity"

dc42

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

Go Up