piezo sensor/How it works/05. How high it goes
How it works · 05 of 9

How high it goes

Nothing on this block holds SIGNAL below 3.3 V. The diode stops only the negative half; the 100 nF keeps an ordinary tap to a volt or two, and the 1 kΩ limits the current if a hard blow goes further. On an ESP32 the reading tops out near 3.1 V first; past about 3.6 V the pin is outside its rating.

One clamp, the other way

A bare piezo disc hit hard can make tens of volts across its leads, for a moment. The page this book replaces said the block's clamp takes care of that. It does half of it. D2 stops the disc's node going more than a few tenths of a volt below GND. Above GND it does nothing: it is a 40 V diode facing the other way. There is no second diode to a supply, because the block has no supply.

What keeps an ordinary tap small is the 100 nF. It takes most of the disc's charge, so SIGNAL is a fraction of what the bare disc would show. The owner's bench log on an Uno read finger taps at up to 1.8 V. That is a floor, not a ceiling: the sketch read once every 100 ms, so it caught each tap somewhere on the way down.

How high it goes
Your board
Top of the hump1.8 V
Reads
2378 of 4095
Clamp on the board
below 0 V only
Pin's limit
3.6 V
1.8 V is inside everything: the ESP32-S3 reads about 2378 of 4095, in proportion to the hump. The bench's highest reading on an Uno was 1.8 V, from a finger tap read at a random instant, so real taps go higher than that.

Slide the top of the hump and pick your board. The slider is not calibrated to how hard you hit: nobody has measured that for this block.

Three levels

  • The reading's full scale. An Uno reads up to 5 V, a Pico up to 3.3 V, an ESP32 or ESP32-S3 up to about 3.1 V at the Arduino core's default setting. Past it, analogRead gives its largest number however hard you hit. Nothing is harmed; the reading has run out of numbers.
  • The pin's limit. A 3.3 V board's pin is rated up to about 0.3 V over its supply: Espressif gives VDD + 0.3 V as the highest input level. Past that the chip is outside its rating, and a little further on its own protection diode starts to carry current from the pin into its supply.
  • Above it, nothing on the block holds SIGNAL down. The 1 kΩ limits how much current flows into that protection diode; it does not limit the voltage. It usually survives a tap. The datasheet does not promise it.

If it will be hit hard

For a drum pad, a door that slams, anything struck with a tool: add a small Schottky diode (a 1N5817, or a BAT54) from SIGNAL to your board's 3V3, stripe to 3V3. It starts to conduct at a lower voltage than the chip's own diode, so it takes the current instead, and it does nothing to readings below 3.3 V. On an Uno the same diode goes to 5V, and is rarely needed.

When it does not work

Can a tap damage my ESP32?

An ordinary finger tap is very unlikely to: the owner's Uno log shows taps read at up to 1.8 V. A hard blow can go further, and nothing on the block stops it. Past about 3.6 V the pin's own protection diode carries the excess through the 1 kΩ, which usually survives but is outside the chip's rating. For blows, add the Schottky clamp this article describes.

My ESP32 reads 4095 on every firm tap.

Its ADC tops out at about 3.1 V at the default range, and a firm tap passes that. The reading has run out of numbers; the pin is not yet outside its rating. Tap more lightly, move the disc so it is struck less directly, or treat 4095 as at least this hard.

Is the Uno safer than an ESP32 here?

It has more room: it reads up to 5 V, and its pins take a little more than that. The same hard blow that clips an ESP32 can still read in proportion on an Uno. The block is the same on both; only the board's range differs.

Where this goes next

Two wires and a sketch that prints each tap.

The first reading →

Edit this page — content/books/piezo-sensor/how-high-it-goes.mdx

Community

Questions about this product

See what other owners have asked, and read their solutions.

Ask a question ↗

Piezo-Ceramic Sensor

Loading discussions…

Discuss this article

Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.

Browse Modules and blocks on the forum →