Piezo's and MaxMSP

Hi guys,

I am using the new "Arduino2Max" patch and I have 3 piezo elements being read successfully through the analogue ports.

However, in MaxMSP the values that are being picked up fluctuate dramatically even when I am not 'setting them off'. When I do interact with the piezo elements there is no consistency with the results. I have tried using resistors as well but to no avail.

Does anybody know the best way to handle piezo data in MaxMSP?

Any help would be greatly appreciated.

Thank you.


what is it exactly you want to sense-- a trigger, or a successive series of values?
You can use the > 50 (or similar value) math object in MAX to just sense a trigger. A sequence of values is probably goign to be difficult to do quickly, since the Atmega chip is scanning through differrent pins, and also because considerable time is taken up by the serial communication between the Arduino and the host computer. Which is all to say, you can count on a number of samples per second from the Arduino, but in between the time that the Atmega samples the piezo pin and the next time it does it, the piezo value has probably already changed significantly. One thing you might do to speed up sampling rates is disable the sampling of pins you aren't using in the Arduino code.

Todbot has a post and project on his blog describing the piezo's response: Spooky Arduino Projects #4 – Musical Arduino – todbot blog

And here is someone else's schematic for a pizo charge amplifier, although I have a feeling it is destined for audio purposes, judging from the capacitor on the output: http://www.scopeboy.com/elec/chargeamp.gif

And here is a preamplifier for 8 piezo's, with schematic...

Hope this helps


Hi Daniel

Thank you very much for your response I will be sure to look into the links you provide. Basically, I need to pick up the vibration of piano keys on a 'thumb piano' when they are struck so I need a successive series of values.

Thank you for your explaination into the Atmega and the Piezo this makes sense. I have already disabled the pins that are not used.

What I am concerned about is that sometimes it does pick up the vibrations and sometimes it appears not to. Also, sometimes it gets stuck on a number usually the highest value (1024).

Thank you again.

if it's stuck on 1024 for a short time and then drops back to zero shortly therafter, then it's probably clipping: the piezo is putting out enough voltage to saturate the clipping diodes inside the Atmega8, and keeing the value read at 5V. That's one theory at least. Do you have a picture of the circuit? IS this a Zimbabwean thumb-piano kind of thing? We might be able to help more by seeing what this thing looks like.

Hi Daniel

Thanks again for your response.

I have redone my circuit now and it appears to be working better. One reason is that the values being output are 0 until you 'knock it'. However, I don't seem to get values above '34' now. This all means that the problem of it getting stuck on a number has stopped now and it returns to a value of 0 instantly on most occasions.

I will post a picture of my circuit when I get chance but basically it looks like the circuit in "arduino_spooky_projects_class4.pdf" on page 19 except I have 3 piezo speakers connected all using the same "ground". However, I think there is something wrong with this as I don't get as strong a signal on the 2nd and 3rd piezo's as I do on the first. http://todbot.com/blog/wp-content/uploads/2006/10/arduino_spooky_projects_class4.pdf

Yes it is a Zimbabwean thumb piano! Here is a link to the thumb piano I have: http://www.musicroom.com/imagezoom.aspx?product_id=332815

I plan to stick piezo elements to the bottom of it to measure the vibration of the keys!



that's excellent that you got it working. I know those pianos-- the keys run into a central point. It may be difficult to sense separate key values, as the whole area is vibrating with almost the same signal.

One other thing you might try is putting force sensitive resistors on the keys, whcih should be bending just right to make a change in the FSR's value.
Check out this entry in the SensorWiki. (Holy Smokes, a SensorWiki!)


Hi Daniel

Thank you for your suggestion. Only thing is that I am having difficulty finding a company that sells FSR's here in the UK. I have found a company that do a similar component called a 'Strain Gauge' and I was wondering if this component would work? They are quite expensive so I wanted to be sure before I ordered any!

I have also found a component called a Bimorph vibration element which is cheaper and will fit over the pinao keys nicely.

Thanks in advance.

unfortunately those links don't work...

I don't know a lot about strain guages, but form what I can see, they're just FSR's, used for engineering/industrial measurement of mechanical strains. As such, there's an emphasis on measurement precision. Here's a link to an introductory explanation of strain guages. The big difference between FSR's and strain guages seems to be that FSR's will vary their value significantly, in an easy-to-measure way, while strain guages might have millivolt changes. that means you'll need a Wheatstone bridge type setup with sensitive op ams to amplify this change. (hey, Wheatstone was English... maybe you should look him up. :slight_smile: )

That said, maybe we have an engineer in here who can actualy has expereince or knowledge about strain gauges?

Regarding FSR's, in europe you can get them from Conrad (search for pressure sensors, or FSR-149AS). I would also bet that such a small item would be easy to order from the States

Or you could try making your own! See the fluidforms tutorial here. Might be tricky in such a small space, but worth a look...

Another thought is making a five-coil pickup, a-la guitar, yourself. Here's a set of DIY instructions. the downside to this is that you would need some isolation circuitry between the pickup and the Arduino, but that would probably be easy to figure out, since there are millions of guitar pickups out there...

Two other sensing methods come to mind. One is kinotex.. basically fiber-optic fabric that detects deflection or bending very accurately. It's made by Tactex.

The other is the optical solution-- pressing the piano key metal deflects a beam of infrared, and you measure the light changes. That might work just by bouncing infrared off the metal key, and measuring the change.

Also, those old nintendo power Gloves come to mind... do a google search for those, and for sensor gloves, and you'll come up with stuff like this.


I'm an aeronautical engineer, and my experience has been that strain guages are a pain in the arse to use. we actually did 3 day courses to learn how to properly apply them. It's a pretty complex process to get right.

I would say that they are pretty expensive to use in a hobby project where you have a reasonable chance of stuffing up, plus they need a signal amplifier.

That said, go for it if you think you can do it!