Sound & Knock sensor problem

Hello all,

I just got two new sensors: a sound sensor and a knock sensor. In the attachment I've uploaded some photos of the setup (sorry for the quality). The problem I have is that the two sensors are only returning the value 1023 and don't react on differences in the input.

This is the code I use (just to check if everything is working allright):

const int knockPin = A1;
const int soundPin = A0;
int knockVal = 0;
int soundVal = 0;
void setup () {
Serial.begin(9600);
}
void loop (){
knockVal = analogRead(knockPin);
Serial.print ("Knock Value: ");
Serial.print (knockVal);
soundVal = analogRead(soundPin);
Serial.print (",Sound Value: ");
Serial.println (soundVal);
delay(10);
}

These are the sensors (the language is dutch btw)

The knock_sensor seems to be digital.
Try connecting it to an interrupt pin.

That sound detector.. Hmmm. Also best suited to trig at a set level -> digital input

Does it help if you select the input mode on the setup?

pinMode(knockPin ,INPUT);
pinMode(soundPin ,INPUT);

Thanks for the replies guys!

@knut what do you mean with and interrupt pin, is that PWM?

I've tried to connect to digital PWM pin but then I only get '1' from both sensor, but I assume this is because a digital pin can only have two values right?

I've also tried to add the pinMode statement, but that doesn't make a difference.

Have you checked out the examples of the knock sensor in the arduino ide?

kevintutor74:
Have you checked out the examples of the knock sensor in the arduino ide?

http://www.arduino.cc/en/Tutorial/Knock

Yes I did but that example is with a piezo. I've tried using a 1 meg-ohm resistor between the knock sensor and ground, but that doesn't make a difference.

It's quite frustrating. Does anyone can tell me what I'm completely missing here?