Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: A few questions about Piezo triggers

  1. #1

    A few questions about Piezo triggers

    I was happy to find the Piezo MIDI drum example in Teensyduino especially the notes on how to wire up the Piezo. It’s quite different than any of the info I’ve found so far and this slight mod I did works GREAT!
    Click image for larger version. 

Name:	PiezoSchematic.jpg 
Views:	33 
Size:	138.9 KB 
ID:	13302 I have a 10k pot hooked up here which works well to adjust sensitivity on the fly for pads that I'm hitting with sticks. There’s a thread about using a Piezo with Teensy 3.6 that mentions putting a 470 Ohm resistor on the Piezo so I did that too. However, I'm using a 3.2 so my first question is…

    Could / should I use a different resistor value there for a Teensy that’s 5v tolerant?

    Does that even make sense? I mean I know that resistors limit current rather than voltage but after reading a bit about voltage dividers, clamping diodes and shunt regulators, I can’t quite understand what that diode connected to 3.3v is doing. (By the way, the example sketch doesn’t mention that resistor at all.) It’s mentioned in that same thread that hooking 20 Piezos up to a 3.6 might be pushing it. So, my second question is…

    Would I be pushing it to hook 10 Piezos up to a 3.2?

    Fast and accurate readings are pretty important to me. I also stumbled upon this peak-holder circuit but it’s from a while back and, since it only has 4 Piezos hooked up to it, it looks like I’d need to wire up about 3 of these if I wanted read 10 Piezos that way. That is unless a Teensy 3.2 can handle 10 without this peak-holder thing (please say yes).
    Last edited by joshnishikawa; 03-16-2018 at 08:04 AM. Reason: Added schematic

  2. #2
    Senior Member oddson's Avatar
    Join Date
    Feb 2013
    Isle in the Salish Sea
    I was hoping an EE type would give you a definitive answer... here's my hand-waiving-heavily-caveated answer:

    I believe the series 470 Ohm is added as the sole circuit protection in some online projects. It works by limiting the tiny current trying to fry your board at voltages outside the 3.3 v rails but provides limited over-voltage protection.

    I don't think you 'need' it but it will set some minimum attenuation in your circuit.

    Is your circuit supposed to show the pot's wiper carrying the signal to the uC pin (or is it wired as a rheostat)?

    If it is; it and the 470 combined are a voltage divider and the 470 become a limit preventing the divider from approaching unity by ensuring there is some resistance in the upper leg of the divider.

    You should check if you need to be able to attenuate the signals at all. If the over-voltage issue is handled then you don't need to worry about headroom and the peak detection will work better with more of the dynamic range of the system in use.

    (Paul's note indicates a fixed 1KOhm where you have the pot.)

    The D1 diode gives overvoltage signals a place to bleed off to. As a piezo has very high output impedance the voltage shouldn't be able to move the supply voltage and it's signal conditioning caps give the high-frequency component somewhere to go. (I'm very unsure of this part, but it's something like this.)

    Re 10 piezo... the guy doing 20 seemed to suggest it was working for him (but in early stages yet and on a T3.6). If your sketch is doing nothing but signal-to-MIDI I believe the example algorithm will provide reasonably accurate results.

    If the code you plan on using is the piezo example you should know it relies on Teensy's speed to poll an audio-rate signal enough times to get a representative maximum value that can act as a proxy for the envelope level of the signal.

    I believe there may be software approaches that will improve performance should the brute-force means of getting representative signals from all piezo start to become less accurate. But I don't believe you will need them with a T3.2 and 10 piezos.
    Last edited by oddson; 03-16-2018 at 06:08 PM.

  3. #3
    Thanks for the info.
    Quote Originally Posted by oddson View Post
    Is your circuit supposed to show the pot's wiper carrying the signal to the uC pin (or is it wired as a rheostat)?
    Yeah, I probably should have specified that the “pot” is actually wired as a rheostat. I read that the sensitivity could be adjusted by swapping out that resistor with different values so I figure why not just use a variable resistor. I should probably throw another 470 Ohm resistor in series with it so the Vout is never 0 when hitting the pad though.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts