user10878: I have a piezoelectric sensor. Both pins are the same length. I have one like this: Piezo picture. On the Piezo it's written muRata and 01P. How do I know which do I send to the digital pins and which to the ground? I have an Arduino Uno.

user14317: If you're using just one or sound quality doesn't matter: it doesn't matter.
Otherwise you need to figure it out with a scope like this:

Connect both poles of the connector of the PZT to an oscilloscope (time base approx. 50ms/div, y-axis 200mV/div).
Slightly tap the head of the PZT with your finger. As a result you should get a voltage pulse on the oscilloscope.  
Positive Amplitude  -> + pole of the piezo is connected to the inner conductor of the oscilloscope BNC connector. 
Negative Amplitude -> + pole of the piezo is connected to the outer conductor of the oscilloscope BNC connector.


user313: On the one I have, the shorter pin is ground. I discovered that empirically - a scientific word for "I tried it the wrong way round the first time but the magic smoke stayed inside." Afterwards I inspected it more carefully, I found a '+' embossed in the top surface nearer one side. :-o

10878: <p>I have a piezoelectric sensor. Both pins are the same length. I have one like this: <a href="https://cdn.solarbotics.com/products/photos/93c51bd69dcc15a0f60bb6bb4c96d4df/lrg/17855-dscn3894.JPG" rel="nofollow">Piezo picture</a>. On the Piezo it's written <em>muRata</em> and <em>01P</em>. How do I know which do I send to the digital pins and which to the ground? I have an Arduino Uno.</p>
 14317: <p>If you're using just one or sound quality doesn't matter: it doesn't matter.</p>

<p>Otherwise you need to figure it out with a scope like <a href="http://service.toptica.com/index.php?pg=kb.page&amp;id=7" rel="nofollow">this</a>:</p>

<ul>
<li>Connect both poles of the connector of the PZT to an oscilloscope (time base approx. 50ms/div, y-axis 200mV/div).</li>
<li>Slightly tap the head of the PZT with your finger. As a result you should get a voltage pulse on the oscilloscope.  </li>
<li>Positive Amplitude  -> + pole of the piezo is connected to the inner conductor of the oscilloscope BNC connector. </li>
<li>Negative Amplitude -> + pole of the piezo is connected to the outer conductor of the oscilloscope BNC connector.</li>
</ul>
 313: <p>On the one I have, the shorter pin is ground. I discovered that empirically - a scientific word for "I tried it the wrong way round the first time but the magic smoke stayed inside." Afterwards I inspected it more carefully, I found a '+' embossed in the top surface nearer one side. :-o</p>
