Piezo Vibration Sensor Circuit

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
mschiff
 
Posts: 26
Joined: Tue Feb 02, 2010 3:35 pm

Piezo Vibration Sensor Circuit

Post by mschiff »

I am trying to set up a circuit using this sensor:

http://www.sparkfun.com/commerce/produc ... ts_id=9196

in such a way that I can read the movement of the sensor on my arduino analog pin.

I have tried connecting the positive end of the sensor directly to the analog pin and the negative end of the sensor directly to ground. With this method, when I flick the sensor the analog reading jumps up and then slowly falls back to zero.

I have seen on other tutorials involving piezo elements as knock sensors to connect a 1KOhm resistor between the positive and negative sides of the sensor. When I tried this, my analog readings were around zero, shifting slightly up when I flick the sensor.

I have also tried setting it up with the resistor in between the positive side of the sensor and the arduino pin with similar results to the previous scenario.

Does anyone know the correct circuit for this sensor??
-Michael-

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Re: Piezo Vibration Sensor Circuit

Post by adafruit »

it sounds like your first attempt worked fine, why not use that?

mschiff
 
Posts: 26
Joined: Tue Feb 02, 2010 3:35 pm

Re: Piezo Vibration Sensor Circuit

Post by mschiff »

well, tell me if im wrong, but I expected the digital interpretation of the created signal to oscillate up and down the way the piezo sensor is oscillating back and forth. Is this just not the way they work.

My goal is less the sensation of a vibration, and more the translation of these analog vibrations into digitally mapped vibrations.

Am I using the wrong sensor?
-Michael-

User avatar
zener
 
Posts: 4567
Joined: Sat Feb 21, 2009 2:38 am

Re: Piezo Vibration Sensor Circuit

Post by zener »

One concern is if it generates high voltages that could damage the analog input. But I have no idea if that could or not. That might be why they wanted to load it down with the resistor across it. I suppose it depends on the application and what kind of "jolts" it will experience. You could always put a zener across it to clamp any big voltages, i suppose.

However, your new question is quite different. What frequency are these waves going to be? Generally I would think the waveform from a "knock" would be in the KHz. Essentially in the audio range. I don't think the A/D converters in the Arduino are fast enough to do much with that. You might need to use an external A/D (at least). I could be wrong however...

User avatar
johngineer
 
Posts: 105
Joined: Fri Aug 14, 2009 6:05 pm

Re: Piezo Vibration Sensor Circuit

Post by johngineer »

mschiff wrote:well, tell me if im wrong, but I expected the digital interpretation of the created signal to oscillate up and down the way the piezo sensor is oscillating back and forth. Is this just not the way they work.

My goal is less the sensation of a vibration, and more the translation of these analog vibrations into digitally mapped vibrations.

Am I using the wrong sensor?
-Michael-
You do realize that the piezo is putting out up to 90v, right? Granted it's low current, but still you shouldn't ever be connecting a 90v output directly to any Arduino pin. You need to use a voltage divider to drop it down to a reasonable level. Further, the output of the piezo is swinging between positive and negative, while the Arduino analog inputs are only able to read positive values between 0 and Aref, so you need to introduce an offset if you want to read the whole range of values.

Further, Zener is absolutely correct about the frequency. The A/D's on the Arduino are not designed for sampling in the audio range. If memory serves, on the arduino, each read from an analog pin requires 10000us, which gives you a maximum sampling rate of 100hz. This is fine if you want to sense a dull thud, but not much use beyond that.

What are you going to be using this thing for? It might help us to know.

mschiff
 
Posts: 26
Joined: Tue Feb 02, 2010 3:35 pm

Re: Piezo Vibration Sensor Circuit

Post by mschiff »

I am trying to use the vibration sensor to act as a 'string' for a digital instrument. from what everyone is saying it sounds like that might be kinda difficult. Any ideas?

User avatar
johngineer
 
Posts: 105
Joined: Fri Aug 14, 2009 6:05 pm

Re: Piezo Vibration Sensor Circuit

Post by johngineer »

mschiff wrote:I am trying to use the vibration sensor to act as a 'string' for a digital instrument. from what everyone is saying it sounds like that might be kinda difficult. Any ideas?
that's only going to work if the sensor vibrates on it's own, or is attached to another vibrating mass. and you'll need either either an adjustable vibrating mass or multiple sensors to have more than one note, unless it's a drum.

mschiff
 
Posts: 26
Joined: Tue Feb 02, 2010 3:35 pm

Re: Piezo Vibration Sensor Circuit

Post by mschiff »

My plan is to eventually have a set of these vibration sensors:

http://www.sparkfun.com/commerce/produc ... ts_id=9199

they have a weight on them, and my plan is to pluck them like one would a stringed instrument to create the vibration/motion.

It is that motion, created by the finger strike that I want to observe with the arduino.

Do you know the appropriate circuit I would use. I also want to be able to observe the entire +/- oscillation of the wave. How do I do this considering the arduino's A/D converter operates between GND and 5V?
-Michael-

User avatar
johngineer
 
Posts: 105
Joined: Fri Aug 14, 2009 6:05 pm

Re: Piezo Vibration Sensor Circuit

Post by johngineer »

mschiff wrote:My plan is to eventually have a set of these vibration sensors:

http://www.sparkfun.com/commerce/produc ... ts_id=9199

they have a weight on them, and my plan is to pluck them like one would a stringed instrument to create the vibration/motion.

It is that motion, created by the finger strike that I want to observe with the arduino.

Do you know the appropriate circuit I would use. I also want to be able to observe the entire +/- oscillation of the wave. How do I do this considering the arduino's A/D converter operates between GND and 5V?
-Michael-
well... hmm... how do i say this... i think you're wrong about what you want to observe, though i may be wrong.

looking at the mass and size of these sensors, i'm willing to bet that they only physically oscillate at lower frequencies, unless they have some insane spring constant characteristics built into them, which i doubt.

you want to use these to trigger a musical note, right? and you want the note to fade out as the vibration in the sensor fades out? if that is the case, then all you need to measure is the envelope of the vibration and not the vibration itself. a google search for "envelope follower" or "envelope detector" will yield plenty of results.

You'd then take the output of this circuit and strap it to the A/D on the Arduino, though to be honest you might still get jittery results, because as I said the MAX sampling rate on the Arduino is about 100hz. With other code running it'll probably be about half that (or less).

Hope this helps.

Incidentally, all this musical talk has given me the urge to open up Reaktor and build something. Thanks for that! :)

mschiff
 
Posts: 26
Joined: Tue Feb 02, 2010 3:35 pm

Re: Piezo Vibration Sensor Circuit

Post by mschiff »

Im glad I could inspire you to make some music.

I think that I am going to go the route of laser/photo-resistor pairs as the strings in combination with some kind of soft-potetiometers for modulation.
-Michael-

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

Return to “General Project help”