1
\$\begingroup\$

I'm making a musical instrument, where you pluck "teeth" which have piezo disc sensors attached to them, and I want to get the output of the piezo into a microcontroller so I can interpret it and trigger musical notes:

enter image description here

I'm using a Teensy 4.0, which has 14 ADCs, and I'll have 13 parallel piezo circuits. I'm a software engineer, so once I get the signal into the microcontroller I think I know what to do, but the electrical engineering I'm less sure about.

Here's the idea I have for the circuit, though I've drawn it with only one piezo for simplicity:

circuit diagram

The idea is that the Teensy's ADC reads from 0V to whatever you put on the V_REF pin, so I'll send 5V to the V_REF and the use R1 and R2 to make a voltage divider to bias the piezo up by 2.5V. I've measured the piezo output, and they're just about in the right range, but if you hit it quite hard it can make very large (positive or negative voltages) which I think I need to protect the microcontroller from. So I've put a pair of diodes (D1, D2) on the other side of the piezo so that if the voltage goes above 5V or below 0V they send the excess out.

Before I build this and risk wrecking my Teensy if I got it wrong, does this look right? And are Schottky diodes a good choice for D1 and D2?

EDIT 2024-03-29: here's an updated schematic taking into account the feedback from Justme:

enter image description here

I've lowered the voltage reference to 3.3V, marked the R1 and R2 voltage divider resistors 10k, and added a 1M resistor in parallel with the piezo.

I'll try this circuit out feeding an oscilloscope before I try it with the Teensy.

EDIT 2024-03-31: I've made a new circuit to take into account that the diodes are not perfect. Now there's a margin, both positive and negative:

enter image description here

I also switched it from an external voltage reference to the microcontrollers 3.3 volt pin.

After testing with the oscilloscope I connected it to the microcontroller, and I'm getting good results! Here is the signal as observed by the ADC:

enter image description here

\$\endgroup\$
0

1 Answer 1

2
\$\begingroup\$

No, it does not look right.

You say you have a Teensy 4.0.

It does not have a 5V MCU, but a 3.3V MCU, so the analog reference and analog inputs are up to 3.3V only. 5V will damage it.

Also the analog voltage to MCU has no defined voltage. You might read any value depending on what the DC bias happens to settle due to leakage currents etc.

You might want to add maybe a 1 megaohm resistance over the piezo element. Then both sides of the piezo will idle at 1.65V half-supply when using a 3.3V reference.

The 10 ohm resistors are also quite absurdly low values, wasting few hundred milliamps into heat. Maybe use 1k or 10k resistors, and possibly a bypass capacitor to lower the AC impedance.

Also, as this circuit uses high impedance signals with, Schottky diodes may not be very suitable. They may have microamps of reverse bias leakage current which will bias your high impedance analog input. Standard diodes may be more suitable, but have higher forward voltage. You might want to put a series resistor of about 1kohm between diodes and MCU analog input.

If the source impedance is too high for the ADC input, you can always put an op-amp as a buffer to drive the high impedance piezo signal into MCU analog pin.

\$\endgroup\$
1
  • \$\begingroup\$ Thanks, especially for catching that the MCU is max 3.3v and not 5v! The 10 ohm resistors were intended to be 10k. \$\endgroup\$ Commented Mar 29 at 3:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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