Piezo and led works, how about opto-isolator?

It does take a definite tap on a cheap piezo disk to make a led blink and doesn't seem to harm it. Connect a led directly to the piezo wires and tap the disk, the led flashes. It also works with led through a diode bridge then a cap to flatten the spike, flashes twice and shines longer.

The tap on the piezo can exceed 5V for a short time. The led/circuit eats the spike and makes light that the Arduino can detect safely with few parts.

I'm wondering if opto-isolator leds can take it. Connect the other side to digital pins and time the HIGH pulse = strength of tap totally pin safe. Will signal slowly eat the chip?

I would expect that the power of the piezoelectric would be so low as not to cause any problem. This however only a gut feeling.

The forward voltage of the LED would quickly drop the output voltage and the piezo has high impedance so low current.


LED or opto-isolator - I would be more concerned about the reverse voltage spikes unless you are using the bridge.

I was measuring some piezo sensors the other day on a scope and I did not see any reverse voltage spike. The peak voltage was about 45V with a flick from my finger to the back that is the larger plate of the sensor. A 1M parallel resistor across it produced about 6V.

Piezo's are basically current sources so can generate large voltages if you present a high impedance load.

The LED in an opto isolator will happily carry forward current with high voltage, but in the reverse direct it will risk get zapped (-5V reverse voltage rating is common for LEDs)

So you either need an AC opto coupler (these have back-to-back LEDs in the input side), or rethink.

The magnitude of the current from a piezo is fairly small though, this works to mitigate the risk.

The usual way to tame them is just put a resistor in parallel to turn current to sensible voltage levels. Try 100k or so to start with. Usually you can rely on the input protection diodes to handle any excess voltage/current from a small piezo element - you can add schottky diodes to back them up if you like.

That 45V was with the 'scopes input inpedance of 10M loading the piezo, so you'd expect to see a ten-fold reduction adding the 1M.

The currents are small, but they are larger with faster mechnical deformation - so percussive strikes will produce larger currents/voltages (although eventually the sensor will shatter if you take this too far).

If you tap a piezo, it could produce a positive spike or a negative spike. Depending what side you tap it, and what side of the piezo has been glued onto the copper. Current won't be a problem, but LEDs don't like reverse voltages. Wise to use a reverse protection diode across the LED, or use a bi-coloured LED. Leo..

Putting diodes on the piezo is more parts but otherwise no problem. I have used such a circuit with even more parts.

Resistor is better than a cap for softening the spikes? I figured the cap would turn voltage into time sort of, a longer pulse.

In my older sensor circuit I connected the 4 bridge diodes to sense press on one pin and release on another. Without a diode, press and release do make AC.

And I forgot to mention, I got 10 bags of 10 12mm piezo discs for $10.30 some time ago.

An Arduino-safe piezo sensor could be a 10 cent piezo disk and a few cents for IR led and detector.

Flicking a sensor with the finger nail.

Notice the complete absence of any reverse voltage spike.

How do you have it hooked up?

I used 2 diodes per piezo lead before and transistors, I could read press and release even after holding the press for seconds. It happens as fast as you let up the strain on the crystal, what was + and - return to equal, current tends to flow back.

Grumpy_Mike: Flicking a sensor with the finger nail.

Notice the complete absence of any reverse voltage spike.

Did you flick it from both sides? As it is possible to reverse connect or reverse flick, I thing the reverse voltage protection may be worthwhile.


The piezo device is a capacitor. It cannot generate any DC voltage. If it produces a positive spike, then there must by definition be a compensatory negative impulse.

The impulse is however, a representation of the acceleration applied to the piezo. If the forward acceleration (such as a tap) is rapid but the rebound is slower, then the negative impulse will be correspondingly smaller (and longer of course).

But there will be a negative impulse.

So why is there not one on the scope trace?

The sensor had a red and black wire and was connected simply across the scope lead.

Has any one else measured this?

You are measuring voltage where current can't flow?

If you put 2 leds across the piezo leads so that current can flow through one or the other then put a divider between the leds so you can only see one flash, a tap and release should get both to light.

You are measuring voltage where current can't flow?

No idea what you mean. I am measuring the voltage across the sensor into a 10M scope probe.

I notice that I get a negative voltage spike if I flick the "other side" of the sensor but I was only making a foot tap sensor so that wouldn't apply.

See a video of my project here:- MagPi Magazine No.35