Back to Sensors & Actuators Series

Piezo Vibration Sensor

April 10, 2026 Wasil Zafar 8 min read

Piezo vibration sensor deep dive — piezoelectric physics, voltage clamping, knock detection, Arduino code, and musical/industrial applications.

Contents

  1. Working Principle
  2. Electrical Characteristics
  3. Interfacing with MCU
  4. Calibration
  5. Code Example
  6. Real-World Applications
  7. Limitations

Working Principle

A piezoelectric vibration sensor (often a PZT ceramic disc or PVDF film) generates a voltage when mechanically deformed — the direct piezoelectric effect. When vibration, shock, or flex causes the element to bend, the crystal lattice distortion produces a charge proportional to the applied strain. This charge appears as a voltage across the element’s electrodes.

Piezo sensors are AC-coupled by nature — they respond to changes in force, not static loads. A constant pressing force produces a transient voltage spike that decays. This makes them ideal for detecting vibration, taps, knocks, and impacts.

Electrical Characteristics

ParameterTypical (PZT Disc)
Output TypeAC voltage (proportional to vibration)
Open-Circuit VoltageUp to ±50 V (sharp impacts)
Frequency Response1 Hz – 10 kHz+
SensitivityVaries by geometry; ~1–20 mV/g typical
ImpedanceVery high (>1 MΩ at low frequency)
Static Force ResponseNone (AC-coupled, transient only)
Temperature Range−20 to +70 °C (PZT), −40 to +80 °C (PVDF)
CostVery low (~$0.10–$0.50)

Interfacing with an MCU

Connect one electrode to an ADC input and the other to GND. Critical: Clamp the voltage to protect the ADC:

  • Place a 1 MΩ resistor in parallel to bleed charge and prevent floating voltages
  • Add two Schottky diodes (BAT54S) from signal to VCC and GND to clamp spikes
  • Alternatively, use a 5.1 V Zener diode for simple overvoltage protection
Warning: Sharp impacts on piezo elements can generate 50 V+ spikes. Always add clamping diodes or a Zener before connecting to an MCU ADC pin.

Calibration

  • Threshold tuning: Tap the sensor at your desired trigger strength and note the ADC peak; set threshold slightly below
  • Debouncing: After detecting a hit, ignore readings for 20–50 ms to avoid multi-triggering from ringing
  • Velocity sensitivity (MIDI): Map the peak ADC value to a 0–127 MIDI velocity range for musical applications

Code Example

/*
 * Piezo Vibration / Knock Sensor — Arduino
 * Wiring: Piezo(+) → A0, Piezo(-) → GND
 *         1M resistor A0–GND, Zener 5.1V A0–GND
 */
#define PIEZO_PIN A0
#define THRESHOLD 50      /* ADC threshold for knock detect */
#define DEBOUNCE_MS 50    /* Ignore ringing after hit */

unsigned long lastKnock = 0;

void setup() {
    Serial.begin(9600);
    Serial.println("Piezo Knock Sensor Ready");
}

void loop() {
    int val = analogRead(PIEZO_PIN);

    if (val > THRESHOLD &&
        (millis() - lastKnock) > DEBOUNCE_MS) {
        lastKnock = millis();
        Serial.print("KNOCK detected! Intensity: ");
        Serial.println(val);
    }
    delay(1);  /* Fast polling for peak capture */
}

Real-World Applications

Musical Instruments & Predictive Maintenance

Piezo sensors are the standard trigger element in electronic drum pads and MIDI controllers, converting strike intensity to velocity. In industrial IoT, they detect bearing vibration signatures to predict motor failures before they occur. Other uses include knock-detection for door locks, seismic monitoring, and tap-to-wake interfaces.

Music/MIDIVibration MonitoringKnock DetectionIIoT

Limitations

  • No static measurement: Cannot measure constant force or weight (use FSR or load cell instead).
  • High output impedance: Requires high-impedance input; loading the sensor reduces output voltage.
  • Voltage spikes: Can produce dangerous voltages without clamping protection on MCU pins.
  • Frequency dependent: Sensitivity varies with frequency — not a calibrated accelerometer.
  • Fragile: PZT ceramic discs crack under extreme bending; PVDF film is more flexible.