Piezo knock sensor

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
walker
 
Posts: 77
Joined: Sat Aug 04, 2012 8:40 am

Re: Piezo knock sensor

Post by walker »

Okay, I think I've got it... and you were right Mike. The problem was some kind of contamination on the board causing high impedence connectivity from the 12v rail to the cap. After cleaning it up the problem seems to have gone away... except for a few channels that I need to investigate. The 12v rail does run close by the envelope detector circuit on two of the rows of connectors.

User avatar
walker
 
Posts: 77
Joined: Sat Aug 04, 2012 8:40 am

Re: Piezo knock sensor

Post by walker »

I had hoped that once I had the leak fixed that I would see the effect of this code draining the capacitor.

Code: Select all

      pinMode( activeTarget, OUTPUT );
      digitalWrite( activeTarget, LOW );
      pinMode( activeTarget, INPUT );
But unfortunately I'm not seeing a difference in the capacitor decay when using this. My tests with a 150pf cap show between 160ms and 200ms. (There's some variability with how hard I hit the target and also probably where the loop falls in the signal cycle.) I've even tried putting a delay(100) after the digitalWrite just to give it some time to take effect. Any ideas why this isn't working?

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Piezo knock sensor

Post by adafruit_support_mike »

According to everything I know about the Arduino, that should work. The datasheet explicitly states that the ADC pins can be used for GPIO, and that all GPIO pins can sink current.

The decay curve you're seeing lasts 160-200 milliseconds? To make a 150pF cap hold charge that long you need resistance in the gigohms. Reverse leakage through the diode should drain the thing faster than that.

Try connecting a resistor and LED between VCC and the ADC pin and doing the digitalWrite(pin, LOW) thing. If the LED lights up when the pin is LOW, the pin is sinking current.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”