The Piezoelectric Effect: How Mechanical Stress Becomes Voltage
When you bend, compress, or strike a piezoelectric material like Lead Zirconate Titanate (PZT) or PVDF film, the mechanical stress physically deforms its crystal lattice. This deformation displaces the positive and negative charge centers within the molecules, creating a dipole moment and generating a surface charge that is directly proportional to the applied mechanical force.
Unlike resistive sensors (like flex sensors or FSRs), a piezo element does not change its resistance. Instead, it acts as an active charge generator in parallel with an internal capacitor. Because it generates its own electrical potential from kinetic energy, it requires no external excitation voltage. However, its extremely high output impedance means it cannot drive a low-impedance load—like a microcontroller ADC—directly without signal conditioning to prevent the charge from bleeding off instantly.
What the Output Actually Is (And Why You Can't Just Wire It to an ADC)
The raw output of a piezoelectric disc is an analog AC voltage spike. It is not a steady DC level, and it is certainly not a digital HIGH/LOW signal. When you tap a bare PZT disc, it generates a bipolar voltage waveform: a sharp positive spike followed by a negative ringing oscillation that decays over a few milliseconds.
A common mistake in hobbyist circuits is conflating raw piezo discs with digital vibration switches (like the SW-420) or amplified piezo modules that include an LM393 comparator. A digital module only tells you if a vibration occurred, stripping away all data regarding how hard the impact was. To measure impact force, knock intensity, or acoustic amplitude, you must read the raw analog voltage.
Wiring, Pinout, and Signal Conditioning
To safely interface a raw piezo disc to a 3.3V microcontroller like the ESP32 DevKit v1, you need a high-value pull-down resistor to provide a DC return path for the ADC, and a Zener diode to clamp the voltage spikes. We recommend the SparkFun Piezo Vibration Sensor methodology for breadboard prototyping.
| Sensor Lead | MCU Destination | Conditioning Components | Supply Range |
|---|---|---|---|
| Red (+) Signal | ESP32 GPIO 34 (ADC1_CH6) | 1MΩ resistor to GND; 3.3V Zener Diode (Cathode to Signal, Anode to GND) | N/A (Self-generating) |
| Black (-) Ground | ESP32 GND | Direct connection | 0V Reference |
Numbered Build Steps
- Place the Zener Diode: Insert a 3.3V Zener diode into the breadboard. Connect the cathode (striped end) to the signal rail and the anode to the ground rail. This clamps any spike above 3.3V, protecting the ESP32.
- Add the Pull-Down: Place a 1MΩ resistor in parallel with the Zener diode (between the signal rail and ground). This drains the piezo's internal capacitance, resetting the baseline to 0V between taps.
- Wire the Sensor: Solder or clamp the piezo's red wire to the signal rail and the black wire to the ground rail. Keep these leads under 3 inches to minimize antenna effects.
- Connect to MCU: Run a jumper from the signal rail to ESP32 GPIO 34. (GPIO 34 is input-only and lacks internal pull-ups, making it ideal for sensitive analog reads).
The Math: Converting Raw ADC Readings to Physical Units
The ESP32's 12-bit ADC (0-4095) is notoriously non-linear at the extremes. Never use raw analogRead() values for physical calculations. Instead, use the ESP-IDF calibrated function analogReadMilliVolts() to get a linear voltage reading.
To convert this voltage into a physical unit like G-force (acceleration), you need the sensor's sensitivity. For a standard TE Connectivity LDT0-028K piezo film sensor with a standard test mass, the sensitivity is approximately 15 mV/g (0.015 V/g). For a bare PZT ceramic disc, sensitivity varies wildly based on the brass backing thickness and mounting method, requiring empirical calibration. Let's use the LDT0-028K baseline for our math.
Raw-to-Unit Conversion Formula
First, capture the peak voltage during the impact event by sampling at a high rate (e.g., 1 kHz) and storing the maximum value:
int rawMV = analogReadMilliVolts(34);
float V_peak = rawMV / 1000.0; // Convert millivolts to Volts
Next, apply the sensitivity factor to calculate the peak G-force:
const float SENSITIVITY = 0.015; // 15 mV/g for LDT0-028K
float peak_g_force = V_peak / SENSITIVITY;
Worked Example: You tap the sensor. The ESP32 reads a peak of 450 mV.
V_peak = 450 / 1000.0 = 0.45V
peak_g_force = 0.45 / 0.015 = 30g
The impact generated a 30g acceleration spike.
Note on Calibration: If you are using a generic, unbranded PZT disc from an online marketplace, the 0.015 V/g constant will be wrong. You must perform a drop-test calibration: drop a known mass from a known height onto the sensor, calculate the theoretical impact force, and solve for your specific SENSITIVITY constant. As detailed in Texas Instruments application notes on piezo interfacing, environmental temperature and mounting adhesive stiffness will also shift this baseline by up to 10%.
Decision Tree: Which Piezo Setup Should You Build?
Piezoelectric sensors are highly specialized. Use this decision path to select the exact component for your embedded project.
| Application Requirement | Sensor Technology | Verdict |
|---|---|---|
| Measure static weight or continuous pressing force | Force Sensitive Resistor (FSR) or Strain Gauge | STOP. Piezo only registers changes in force (AC). It cannot measure static load. |
| Capture high-fidelity acoustic audio or speech | Electret Condenser Microphone or MEMS Mic (I2S) | STOP. Piezo discs have terrible frequency response for air-borne audio. |
| Detect simple machine vibration (on/off state) | SW-420 Digital Vibration Switch | Use Digital. Save your ADC pins; use an interrupt-driven digital switch. |
| Measure knock intensity, impact force, or structural strain | PVDF Film or PZT Ceramic Disc | USE PIEZO. Proceed to component selection below. |
The Default Pick
If your project requires measuring impact or vibration amplitude on an ESP32 or Arduino, and you want reliable, repeatable data without designing a custom PCB with an op-amp charge amplifier, buy the TE Connectivity LDT0-028K (approx. $4.50). It comes pre-packaged in a flexible PET film with integrated crimped leads, eliminating the fragile solder joints that plague bare PZT ceramics. Pair it with the 1MΩ pull-down and 3.3V Zener clamp detailed above.
Common Interference Sources and How to Kill Them
Because a piezo sensor paired with a 1MΩ pull-down resistor creates an extremely high-impedance node, it acts as an excellent antenna for electromagnetic interference (EMI). If your ADC readings are jittery or show phantom spikes, check these three culprits:
- 50/60Hz Mains Hum: The high-impedance trace will capacitively couple to nearby AC wiring, resulting in a 50Hz or 60Hz sine wave superimposed on your signal. Fix: Keep the sensor leads under 3 inches. If you must run a long cable, use shielded coaxial cable (like RG174) and connect the shield to MCU ground at the microcontroller end only.
- Triboelectric Cable Noise: Standard jumper wires generate their own tiny voltage spikes when bent or vibrated, due to the dielectric rubbing against the copper strands. Fix: Secure the wires to the chassis with kapton tape or hot glue so they cannot move independently of the sensor.
- Acoustic Crosstalk: If mounted on a shared metal chassis, the piezo will pick up impacts from motors or relays mounted inches away. Fix: Isolate the sensor using a 2mm layer of Sorbothane or high-durometer silicone between the sensor and the mounting surface.
By properly clamping the voltage, using calibrated millivolt reads, and physically isolating the high-impedance node, you can turn a $4 piezo element into a highly accurate impact measurement tool for your next embedded system.






