Go Down

Topic: Troubleshooting the knock sensor, sensitivity problem (Read 1 time) previous topic - next topic

goljat

I'm trying to get the knock sensor example to work but I can't. My connections are like in the example but I have 2 Mohm resistor since I read that it would increase the sensitivity. It didn't help.

Is there a certain way to attach the element to a surface? I tried to tape it on the surface and I would say it's quite firmly attached. I tried to tape over it. I also tried to tape from the biger discs side so it wouldn't press both discs together. I think the both ways gave same results.

When I slide my finger over the element it gives high readings, even over 1000. But when I knock hard the surface right next to it where it's attached, it gets readings very occasionally and they are below 20. If I slap the surface it might get 70.

How can I make it more sensitive or is it broken?

Erdin

#1
Sep 07, 2013, 11:11 am Last Edit: Sep 08, 2013, 01:27 am by Erdin Reason: 1
Those round piezo elements are very sensitive.
Which one are you using ? Could you attach a photo of it ?
Are you sure you have 2M resistors ? Perhaps the resistor is only 2k ?

jack wp

Can you give us the URL with specs?
Did you test it with a volt meter?

Sounds like you have a sketch running. Can you format it and show it in the program tags (# button on the forum editor)?

So you are saying, it is basicly working, but not up to your expectations?

goljat


Those round piezo elements are very sensitive.
Which one are you using ? Could you attach a photo of it ?
Are you sure you have 2M resistors ? Perhaps the resistor is only 2k ?

I'm sure it's 2M resistor, I checked it. You can see the element from the attachment.



Can you give us the URL with specs?
Did you test it with a volt meter?

Sounds like you have a sketch running. Can you format it and show it in the program tags (# button on the forum editor)?

So you are saying, it is basicly working, but not up to your expectations?


The code is from here http://www.arduino.cc/en/Tutorial/KnockSensor
I'm not quite sure what you would like to see with the volt meter. I got 0 - 150 mV when metering from the resistors legs, and tapping directly the element. All connections should be good.

And yes, basically it's working but not as I have seen it working, like in the youtube video below.
They are tapping the surface where it is attached. I have to tap directly to the element to get any reasonable readings.

Code: (I had to but it like this so you can go straight to the part where it is shown how it should work. Obviously there is more sophisticated code involved in there but the principle is the same) [Select]
www.youtube.com/watch?v=8kRTpmswgFk&t=4m25s

Code: [Select]
// these constants won't change:
const int ledPin = 7;      // led connected to digital pin 13
const int knockSensor = 0; // the piezo is connected to analog pin 0
const int threshold = 100;  // threshold value to decide when the detected sound is a knock or not


// these variables will change:
int sensorReading = 0;      // variable to store the value read from the sensor pin
int ledState = LOW;         // variable used to store the last LED status, to toggle the light

void setup() {
pinMode(ledPin, OUTPUT); // declare the ledPin as as OUTPUT
Serial.begin(9600);       // use the serial port
}

void loop() {
 

  sensorReading = analogRead(knockSensor);  // read the sensor and store it in the variable sensorReading:
 
Serial.println(sensorReading); 
 
  // if the sensor reading is greater than the threshold:
  if (sensorReading >= threshold) { // toggle the status of the ledPin:
 
    ledState = !ledState;    // update the LED pin itself:   
   
    digitalWrite(ledPin, ledState);   // send the string "Knock!" back to the computer, followed by newline
   
    Serial.println("Knock!");         
  }
  delay(100);  // delay to avoid overloading the serial port buffer
}


jack wp

Code: [Select]
const int threshold = 100;
What do you get if you reduce the threshold, say at 50, 25, 10, 3 ?

Erdin

#5
Sep 08, 2013, 03:23 pm Last Edit: Sep 08, 2013, 03:25 pm by Erdin Reason: 1
Thank you for the photo and the information.

I think you have done the sketch and electronics right. It could be the acoustics and perhaps the polarity.

In the video they have wood not as thick as your table, and they have the plastic case around the piezo. That makes a big difference.
You have attached the piezo to the table with tape, and it looks like a good table. Perhaps with MDF or LDF inside.

The piezo need to be firmly attach to something, or use the plastic case as in the video to concentrate the sound. To firmly attach the piezo element, it is best to use glue that gets very hard, like epoxy glue and not the flexible rubber-like glue. When you glue it directly to a thin piece of plywood, I'm sure it will give a strong pulse.

A thin solid piece of wood, or plywood, will transfer the 'knock' a lot better than a MDF or LDF (compressed wood chips) table.

The piezo has a polarity, depending on how it is bended. A 'knock' should give a positive pulse, so perhaps you have to exchange the wires.

Go Up