I would like to hook up a piezoelectric sensor to my ATmega8 microcontroller via its ADC.

The reason being is that I would like to use the sensor as a force sensor. I noticed that the harder I press it, the higher a voltage it delivers (but for a very short time). This is expected behavior, of course.

What I am wondering is how I would connect it to the ADC. I mean, when I press it really hard, the piezo registers upward of 10 V. When I press it softly, it usually gives me around 1.3 V.

As I understand it, the micrcontroller cannot take anything more than 5V, or else I run the risk of damaging it. Is this correct? I mean, I am guessing the current coming out from the piezo is extremely small, though I don't know if that changes the situation.

Essentially, I would like to know if it is possible to hook up this piezoelectric sensor to my AVR microcontroller to take analog readings.

  • 2
    \$\begingroup\$ Depending on the pressure area-of-interest: If the low to moderate pressures are important, and high and higher are not, then a clipping circuit (zener shunt) or combination of voltage divider and clipping, might yield more relevant results. Basically, anything over a certain force will be a flat "high" value, while lower than that force will result in a nice analog value range. Also see this question for a similar application. \$\endgroup\$ – Anindo Ghosh Mar 3 '13 at 4:48
  • 1
    \$\begingroup\$ @AnindoGhosh That's a really, really great idea. Please leave it as an answer if you have a moment. Superb idea. \$\endgroup\$ – capcom Mar 3 '13 at 5:03
  • \$\begingroup\$ OK, I will, when I get back to a computer later today. Thanks. \$\endgroup\$ – Anindo Ghosh Mar 3 '13 at 5:49

A quick experiment with a piezoelectric bender shows the following voltages:

  • No pressure: 0.12 Volts (probably drift / noise / breeze)
  • Mild pressure: 1.72 Volts
  • Firm pressure: 4.21 Volts
  • Fingernail tap: 6.29 Volts (spike)
  • Knock on table: 11.74 Volts (spike)

Assuming the area of interest spans the first 4 levels of signal, and any reading higher than 10 Volts can be generalized to an arbitrary "Out-of-Range" reading, the following implementation should serve for the purposes of question:


simulate this circuit – Schematic created using CircuitLab

The diode D1 shunts the negative portion of the signal that the peizo bender will generate on knocks or release of pressure. To be extra-cautious, this can be substituted by a Schottky diode to cope with very fast spikes, or for tighter clipping to ground rail (~ 0.3 Volts instead of ~0.7 Volts), a germanium diode.

The Zener diode is intentionally selected as 4.7 Volts, in order to ensure that the output voltage does not overshoot 5 Volts under any circumstances.

The op-amp buffer ensures that the voltage divider is not significantly loaded by the ADC pin, hence the voltage divider resistance computation is simplified.

This circuit will output half the positive voltage generated by the piezoelectric pressure sensor until the voltage reaches approximately 4.7 Volts, then clamp at that voltage for any higher pressures applied. Any negative voltage generated due to knocks or sensor bounce-back, will be shunted across the diode D1, protecting the op-amp (or the ADC if directly connected) from negative voltages.

| improve this answer | |
  • \$\begingroup\$ What load did you have across the piezo when you did the voltage tests? If unloaded, it might be instructive to try 200 kilohms as drawn and re-check those voltages... \$\endgroup\$ – Brian Drummond Mar 3 '13 at 13:38
  • \$\begingroup\$ Neat answer. Though do you think you could explain the need for the op-amp a little more, please? I am not quite sure I understand why I need it. I understand the entire circuit otherwise. Many thanks. \$\endgroup\$ – capcom Mar 3 '13 at 13:52
  • \$\begingroup\$ @BrianDrummond I'm lazy: I had shunted the DSO lead with 220k, and that's why I kept those 100k values for the resistors, close enough and saved me calculating stuff :-) \$\endgroup\$ – Anindo Ghosh Mar 3 '13 at 14:17
  • \$\begingroup\$ @capcom The input impedance of the ATmega8 ADC pins is nominally 10 kOhms. If you were to apply said 10k across the voltage divider, it would throw the voltage divider off quite a bit. The final computations in Chetan Bhargava's answer would then apply, except that the actual input impedance of the pin is not constant nor precisely 10 kOhms. Using the buffer op-amp avoids this issue by presenting a very high effective input impedance to the voltage divider, while providing an output impedance much much lower than 10 kOhms to the ADC. \$\endgroup\$ – Anindo Ghosh Mar 3 '13 at 14:23
  • 1
    \$\begingroup\$ If you go to the data sheet for the microcontroller you're using, the Absolute Maximum Rating for Voltage on any pin is Vcc + 0.5V. If you exceed that, the manufacturer does not guarantee that the chip will ever work again -- by definition. If it still works, it still works, but don't be surprised if it doesn't. \$\endgroup\$ – Scott Seidman Mar 3 '13 at 21:32

You can use a resistor divider to scale the input voltage. The divider is simply based on Ohms Law.


Above circuit is taken from wikipedia article on the subject. In the above case Vin should be connected to the piezoelectric sensor and Vout should be connected to your ADC input.


The above circuit is taken from the divider calculator. You can use the calculator here to calculate the values of resistors.

| improve this answer | |
  • \$\begingroup\$ How could I have been so stupid? Wow, thanks. I think I need to sleep now. \$\endgroup\$ – capcom Mar 3 '13 at 4:20
  • \$\begingroup\$ @capcom If you're interested in a voltage divider calculator that uses standard values instead of hypothetical ones, check this out. \$\endgroup\$ – TimH - Codidact Mar 26 '15 at 19:12

You can connect the clipper circuit with piezo element. Because, piezo element has generate the ac signal so may be it can reach maximum level at positive side or at negative side and we can able to detect at which impact it can rich the maximum level of voltage. So you can connect the clipper circuit and in that clipper circuit you can use germanium diode (0.3v clip) or silicon diode (0.7v clip), which is clipping the signal at negative and positive. So you can clip the signal and protect you controller.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.