Drum tutorial

Heya all
im new to the world of physical computing and im just experimenting with different sensors at the moment.

Im looking through this Drum tutorial for ways to use Piezo’s as input

http://todbot.com/blog/2006/10/29/spooky-arduino-projects-4-and-musical-arduino/

i have conected the +ve end of a 1.8khz piezo transducer element to the analog input 0 port on the arduino board and the -gve end to the grnd using a 10k resister and also (dangerously) tried without a resistor.

However when trying to read the input from this analog in im receiving ‘0’ (only when the Xducer is plugged in)

this is the code

int analogPin=5;
int analogValue=0;

void setup()
{
Serial.begin(9600);
pinMode(analogPin,INPUT);
}

void loop()
{
analogValue=analogRead(analogPin);
//analogValue= analogValue/4;
//Serial.print(1);
Serial.println(analogValue);
//Serial.println(‘a’);

}

Can anyone tell me why im receiving nothing but horrible 0’s?

Thanks

Nic

Almost sure it’s not this simple, but you mention that the piezo is connected to “analog input 0” and your code is reading “analogPin=5”.

Ah yeah im sorry about that, i was just trying different inputs on the analog just in case. i know that the problem isnt there

i have conected the +ve end of a 1.8khz piezo transducer element to the analog input 0 port on the arduino board and the -gve end to the grnd using a 10k resister and also (dangerously) tried without a resistor.

That's not what the tutorial says. You need a 1M resistor not a 10K and if you try it without the 5.1V zenner diode you will probably blow up your Arduino as these transducers can produce a lot of voltage. Also if you have tried this on other pins then you might have blown them up as well. There is a chance that the static protection diodes inside the processor chip has saved you.

Test out your analogue port by connecting the pin to 5V through your 10K resistor and also connecting the same pin to 0V through another 10K resistor you should then get a half scale reading if all is OK.

a question to add onto this, would it be alright to use a 12v zenner?

No. The zener is there to prevent the voltage ferom the piezo exceeding the AVR supply voltage.

Mike

Check out my site http://drummaster.thecave.homeunix.org - it has quite a bit of theory on how best to connect the piezos, as well as some code for reading the values. This project started months ago with me looking at Todbot's site, but evolved to a much more powerful circuit.

In theory (and I have tried this and it works, although I am not responsible for you destroying your Arduino!), you can connect the piezo directly to the Arduino's analog port and GND, without any resistors / diodes (normally the outer ring connects to GND, but it doesn't really matter), and you can get analog readings when the piezo is struck. This is not a good idea to use on a regular basis, but for testing you can at least see if things work at all.

Cheers