Thank you, @holdred, for your consistently humble and clarifying questions on this. 3 months later I'm benefiting greatly from this thread.
I'm an Arduino noob and nominally hold a degree in electrical engineering, but I too had the initial reaction of "Is that right? Is that OK?" to connecting 5V "straight" to ground. It becomes clear that the answer is "yes" and "yes" when I look further at it.
Why is it right? By connecting two resistors of equal resistance in series, the voltage drops halfway in the middle. This is how Wawa/Leo is achieving the 2.5V offset (which seems great to me, for not losing valuable signal information).
Why is it OK? Because the resistors are 100kΩ each. Given the equation I = V/R — current equals voltage divided by the resistance — the result is 25 µA (micro-amps, not milliamps) flowing through that path. It is the tiniest trickle of power.
Thank you, @Wawa for your consistent input on this thread. I learned a lot from you.
FWIW, I spent a few days with the diagram from jremington seen in #4 (except that I sometimes used 2MΩ for R1 in order to increase the sensitivity), with this piezo vibration sensor mounted about 1cm below the surface of a drum skin. Reading the ADC pin once every loop() callback invoked around 100Hz and hitting the drum with my hand produced the results seen below.
The yellow regions very roughly indicate when I was hitting…but of course the piezo wasn't starting to vibrate before I hit, so it's really the start of variations indicating the hit. Some problems I ran into with this, and why I'm going to try switching to the accepted solution on this page and some of the sampling code:
- The nice big obvious spikes happen (very roughly) 30-50ms after the sensor starts giving values. For accurate timing (lights from drumming, not nerf dart turning off alarm) this is a noticeable lag.
- Further evidence preventing me from just looking at the "big spikes" is that double-taps with my hand (there are four after 21,000ms in the image) sometimes peaked at only 50 (~0.25V).
- However, just using a small threshold value to detect a hit would result in many detections occurring for a single real hit; as seen in the image the piezo would generate values for 200ms or more, with some secondary spikes reading over 100 (~0.5V).
I solved this using the non-biased circuit and my once-per-loop() reading by "debouncing" the signal, not accepting any more hits for a short period of time after I detected one. Not perfect, but easy to implement.
Anyhow, I'm not trying to hijack this thread, and have no questions requiring a response. Just wanted to share my thanks and bit of experience here.