Forum Rule: Always post complete source code & details to reproduce any issue!
Page 1 of 2 1 2 LastLast
Results 1 to 25 of 32

Thread: Recommendation for piezo buffer op-amp

  1. #1
    Senior Member
    Join Date
    Jun 2013
    Posts
    311

    Recommendation for piezo buffer op-amp

    Hi all,

    I'm working on building a MIDI drum brain. I have a working prototype with 20 inputs, but I'm finding that the data from the piezo isn't as precise as I would like. I suspect this is because the impedance of the piezos it too high, so I would like to test to see if building a circuit with an op-amp buffer can provide better results.

    So my question is, can anyone recommend an appropriate op-amp that can run on either the 5V supplied by USB or the 3.3v supplied by the Teensy voltage regulator? Thank-you in advance for an information you can provide.

    Rob

  2. #2
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,504
    Quote Originally Posted by yeahtuna View Post
    Hi all,

    I'm working on building a MIDI drum brain. I have a working prototype with 20 inputs, but I'm finding that the data from the piezo isn't as precise as I would like. I suspect this is because the impedance of the piezos it too high, so I would like to test to see if building a circuit with an op-amp buffer can provide better results.

    So my question is, can anyone recommend an appropriate op-amp that can run on either the 5V supplied by USB or the 3.3v supplied by the Teensy voltage regulator? Thank-you in advance for an information you can provide.

    Rob
    use a simple FET for impedance transformation. you ma consider antiparallel diodes cross piezo to protect electronics.

  3. #3
    Senior Member
    Join Date
    Jun 2013
    Posts
    311
    That sounds like a good idea. I will look for an appropriate FET. But I still want to find an appropriate op-amp. Especially on that I can use to turn the AC current into DC with a center bias of 3.3V / 2. I'm not very good at electronics, and I've been killing my brain trying to learn everything I need to know to design a top notch input stage for drum piezos. The design I have now is simple and it's works okay, but there's not a whole lot of information I pull out the data because it's so noisy and I've missing half the signal.

  4. #4
    Senior Member
    Join Date
    Jun 2013
    Posts
    311
    I'm going to try this op-amp.

    http://www.ee.ic.ac.uk/pcheung/teach...ent/MCP604.pdf

    Any recommendations of a FET?

  5. #5
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,504
    Quote Originally Posted by yeahtuna View Post
    I'm going to try this op-amp.

    http://www.ee.ic.ac.uk/pcheung/teach...ent/MCP604.pdf

    Any recommendations of a FET?
    I'm using a BF862 with BAV199 protection diodes for piezo ceramics.

  6. #6
    I'm currently working on a project where I use TLV277x op amps to buffer piezos. I used these amps because I had them on hand. I power them with a 3.3V single side supply and seems to work okay. This op amp has a higher slew rate than the MCP604 mentioned above, if that matters to you. Depends on your application. The MCP604 looks like a decent choice, and appears to be cheaper than the TI chip, as well as lower power. I'm going to look into these. However, I was not successful before in using slower chips. The piezo signal was definitely slew-rate limited.

    For powering the op amps, I've tried using an external 3.3V supply as well as just using the Teensy's 3.3V output. Both ways seem to work fine. The latter of course is less complicated. I use a 100 ohm/10uF low pass filter on the power going into the op amp to keep out high frequency trash. The piezos are passed through a diode compression network before the op amp that centers a zero signal at Vcc/2 so all of the piezo signal is captured. A low pass filter is used after the diode network to keep out high frequency trash from the piezo cable, etc. I also use a low pass filter just before the ADC pin, on the op amp output. Haven't determined yet if both signal low pass filters are actually needed, but I'm pretty sure at least one is.

  7. #7
    Senior Member
    Join Date
    Jun 2013
    Posts
    311
    Quote Originally Posted by Bryan42 View Post
    For powering the op amps, I've tried using an external 3.3V supply as well as just using the Teensy's 3.3V output. Both ways seem to work fine. The latter of course is less complicated. I use a 100 ohm/10uF low pass filter on the power going into the op amp to keep out high frequency trash.
    I will try this to see if it gives me cleaning data.

    Quote Originally Posted by Bryan42 View Post
    The piezos are passed through a diode compression network before the op amp that centers a zero signal at Vcc/2 so all of the piezo signal is captured.
    Diode compression network...That's something I'm going to have to research. How does it work? I'm currently trying to figure out how to keep my piezo signal from going below -1.65v or above 1.65v.

    Quote Originally Posted by Bryan42 View Post
    A low pass filter is used after the diode network to keep out high frequency trash from the piezo cable, etc. I also use a low pass filter just before the ADC pin, on the op amp output. Haven't determined yet if both signal low pass filters are actually needed, but I'm pretty sure at least one is.
    Is it safe to assume I don't need any protection diodes between the op-amp and the ADC. The op-amp can't output voltage outside of the range of the two supply voltages, can it?

    You can't be sure if you need all that filtering? I've basically turned a Teensy 3.2 into a digital scope and I send transient data to an application I coded and display the waveform on my screen. Here's a sample of a transient from a mesh drum pad. The signal is sampled every 50 microseconds.
    Click image for larger version. 

Name:	trans.png 
Views:	18 
Size:	11.6 KB 
ID:	15049
    Last edited by yeahtuna; 10-29-2018 at 10:12 AM.

  8. #8
    Senior Member
    Join Date
    Jun 2013
    Posts
    311
    I tried putting a low pass filter on the my 1.65v supply, and I found 100ohm / 10nF to work very well.

  9. #9

    Simple diode compression circuit for piezo

    Quote Originally Posted by yeahtuna View Post
    I will try this to see if it gives me cleaning data.


    Diode compression network...That's something I'm going to have to research. How does it work? I'm currently trying to figure out how to keep my piezo signal from going below -1.65v or above 1.65v.



    Is it safe to assume I don't need any protection diodes between the op-amp and the ADC. The op-amp can't output voltage outside of the range of the two supply voltages, can it?

    You can't be sure if you need all that filtering? I've basically turned a Teensy 3.2 into a digital scope and I send transient data to an application I coded and display the waveform on my screen. Here's a sample of a transient from a mesh drum pad. The signal is sampled every 50 microseconds.
    Click image for larger version. 

Name:	trans.png 
Views:	18 
Size:	11.6 KB 
ID:	15049

    If you power your op-amp with 3.3V, perhaps straight from Teensy's 3.3V pin -- well some supply filtering as suggested would be good -- you won't have to worry about having voltages outside of range of the ADC pins on the teensy, regardless of what comes in as a signal to the op-amp. Of course, you'll have to restrict the signal range coming into the op-amp to whatever voltages it's spec'ed to handle. That's what the diode compression network is for.

    Enclosed below is a basic sketch of a simple diode compression piezo conditioning circuit that centers the signal around Vcc/2.

    Click image for larger version. 

Name:	Simplified compression network.jpg 
Views:	41 
Size:	25.8 KB 
ID:	15059

    R1 & R2 should be set to the same value (say 1K) to get that halfway point. The piezo base (the brass plate) is attached to the centerline voltage point. R3 should be something like 100K. This resistor helps establish a DC bias path for that center voltage. The R4 resistor sets the "looseness" or "tightness" of the diode compression. If you set R4 to 0 ohms, then the voltage swings coming in from the op-amp are clamped to -0.7/+0.7 around the centerline (depending on the type of diodes used.) If you set R4 to something higher, say 22 ohms, then it loosens up the swings to higher voltages, and clamps really high stuff to within +/- 1.65V (EDIT: around the centerline, so the voltage range is really 0 to 3.3V with 1.65V being the centerline). You can adjust the resistor higher to give higher swing ranges. Too loose and high voltages get through. You have some leeway if you have a series resistor after the network (like we show), which helps in the case of the piezo voltages, which are short-lived and have very little oompf to them.

    Best to simulate this circuit to get a feel for what it does, and also try it out on a breadboard and set the resistors as needed for your situation. More sophisticated approaches can be used (which I use but am not at liberty to show) to yield more nuanced and versatile compression behavior. The simple circuit shown here is not optimum, but might be satisfactory as a piezo drum trigger circuit.

    I show a lowpass filter after the compression network. Best to have something to get rid of high frequency noise coming from piezo cable so the op-amp doesn't have to deal with it. The series resistor also adds some protection as mentioned earlier.

    You might also have a lowpass filter just before the ADC pin to get rid of any other trash picked up in the circuit and/or to serve as anti-alias filter. In my experience, keep the impedance low coming into the ADC, (say, less than 5K resistance for example -- lower is better) otherwise the Teensy ADC may not be a happy camper and you'll get weird bias voltages building up on the ADC pin (that's been my experience anyway. I've not had anyone explain what's going on there.) The buffer helps greatly in this regard, and so does using a modest resistor value for the final low pass filter.

  10. #10
    Senior Member
    Join Date
    Jun 2013
    Posts
    311
    Your circuit is very nice and produces really clean data. Thank-you so much. I spent an hour this evening playing around with it. I followed most of your recommendations and then explored a bit to find values for the low pass RC filter. I think I used 0.1 uF for the cap and 7 k for the resistor (R5).

    I used BAT 85s for that clamping circuit. Is that a bad idea? I already had them on my breadboard, so that's what I used. I ended up needing to use a 3k resistor to tune the amount of clamping (R4), which is a lot higher than the 22 ohms you had mentioned.

    I also have 0.1uF caps on both supply voltages of the opamp, but I'm not really sure if both of those are necessary. Thank-you again for your help. I'll play around with the circuit some more tomorrow, but it's already looking very nice. I need to think more about how the various resistors affect the circuit and influence each other.

    Regards,
    Rob

  11. #11
    Quote Originally Posted by yeahtuna View Post
    Your circuit is very nice and produces really clean data. Thank-you so much. I spent an hour this evening playing around with it. I followed most of your recommendations and then explored a bit to find values for the low pass RC filter. I think I used 0.1 uF for the cap and 7 k for the resistor (R5).
    You're welcome.

    Quote Originally Posted by yeahtuna View Post
    I used BAT 85s for that clamping circuit. Is that a bad idea? I already had them on my breadboard, so that's what I used. I ended up needing to use a 3k resistor to tune the amount of clamping (R4), which is a lot higher than the 22 ohms you had mentioned.
    As I understand it, your BAT 85s are Schottky's so their clamping voltage is tighter than the 1N4148s I had in mind, so that means you need a higher resistance to make the clamping "looser".

    Bryan

  12. #12
    Senior Member oddson's Avatar
    Join Date
    Feb 2013
    Location
    Isle in the Salish Sea
    Posts
    1,286
    I was wondering if adding the bias is benificial for a midi trigger since you are really only interested in the envelope of the signal.

  13. #13
    Quote Originally Posted by oddson View Post
    I was wondering if adding the bias is benificial for a midi trigger since you are really only interested in the envelope of the signal.
    It depends how sophisticated you want to be. I know most piezo trigger circuits you'll see on the web just toss the negative swing information away. I consider the distinction between positive and negative swings to BE part of the envelope.

  14. #14
    Senior Member oddson's Avatar
    Join Date
    Feb 2013
    Location
    Isle in the Salish Sea
    Posts
    1,286
    ...I consider the distinction between positive and negative swings to BE part of the envelope.
    Ok, but it's not used here as it still represents values below average and so cannot be used in calculating the velocity value and potentially will zero out with low cutoff lowpass.

    But if it works anyway then no problem... but as the number of sensors increase it may become one.

  15. #15
    Senior Member
    Join Date
    Jun 2013
    Posts
    311
    Quote Originally Posted by oddson View Post
    ... but as the number of sensors increase it may become one.
    In terms of processing?

  16. #16
    Senior Member oddson's Avatar
    Join Date
    Feb 2013
    Location
    Isle in the Salish Sea
    Posts
    1,286
    Less frequent readings from each sensor means your code may find fewer during the positive phase.

    To actually use the negative portion you would have to convert to a full wave rectified signal and then lowpass.

  17. #17
    Senior Member
    Join Date
    Jun 2013
    Posts
    311
    Quote Originally Posted by oddson View Post
    Less frequent readings from each sensor means your code may find fewer during the positive phase.

    To actually use the negative portion you would have to convert to a full wave rectified signal and then lowpass.

    Weather the value is negative or zero, because it is rectified it in the circuit, doesn't have much bearing on your ability to catch the peaks. Being able to measure the phase of the signal, however, is one of the advantages of using an AC circuit.

    I have however come across a pretty significant issue with using the AC signal. I haven't found a way to make the circuit compatible with a switch, making the circuit incompatible with peizo/switch pads.

  18. #18
    Senior Member oddson's Avatar
    Join Date
    Feb 2013
    Location
    Isle in the Salish Sea
    Posts
    1,286
    It's more than possible this is entirely irrelevant with the speed of a Teensy. You can scan an audio signal directly even with mux'd inputs... I don't know.

  19. #19
    Quote Originally Posted by yeahtuna View Post
    Weather the value is negative or zero, because it is rectified it in the circuit, doesn't have much bearing on your ability to catch the peaks. Being able to measure the phase of the signal, however, is one of the advantages of using an AC circuit.

    I have however come across a pretty significant issue with using the AC signal. I haven't found a way to make the circuit compatible with a switch, making the circuit incompatible with peizo/switch pads.
    Are you now rectifying the signal somehow? The circuit I showed you does not do that. As far as the AC signal "not being compatible with piezo/switch pads" I'm not sure what you mean. Do you mean the AC signal centered at Vcc/2, and a commercial drum trigger / sequencer module? I doubt the centered AC signal is compatible, although I'm not really familiar with the details of those commercial modules.

    I'm a bit puzzled why you want to use a commercial drum trigger (meaning HW that takes a piezo signal and turns it into MIDI) anyway since I assumed that's what you were using the Teensy for, (and IMHO the Teensy makes for a great drum trigger module. Well, as long as you don't get carried away with too many sensors.)

  20. #20
    Senior Member
    Join Date
    Jun 2013
    Posts
    311
    I managed to find a solution for detecting the 'bell' and 'edge' switches, and project is progressing nicely. I'm not rectifying the data. Thanks again for your help.

  21. #21
    Senior Member
    Join Date
    Jun 2013
    Posts
    311
    Hi Bryan,

    Thanks again for all your help. I've managed to get 12 of those circuits together and have been able to wire up my entire e-drum kit to my breadboard module. The circuitry is performing exceptionally well, but I'm starting to see some noise issues. When I play very softly on one drum pad, it can produce small voltage spikes on some of the other inputs leading to false triggers. I'm playing incredibly softly, so I know it's not vibrations causing the issue.

    I've added some more capacitors and it seems the have improved the situation, but I have on idea how to actually calculate what capacitors I actually need. Currently I have 2 x 0.1uF caps on the V+ of each opamp. I also have a 0.1 uF on each 1.65V voltage divider for each input. Any suggestions? Also I've read that I could be getting some interference and that a ferrite bead might help. Any thoughts on that?

  22. #22
    Senior Member
    Join Date
    Jun 2013
    Posts
    311
    Here's a diagram of an 8 - input circuit, showing the location of capcitors.Click image for larger version. 

Name:	circuit.jpg 
Views:	28 
Size:	89.1 KB 
ID:	15211

  23. #23
    Senior Member
    Join Date
    Jun 2013
    Posts
    311
    I resolved the issue. It had nothing to do with the trigger circuits. The culprit was my MIDI Out DIN. I had the port grounded to AGND. I connected it to the digital GND and the voltage spikes are gone! I guess that's precisely why there are two grounds.

  24. #24
    Junior Member
    Join Date
    Feb 2020
    Posts
    4
    Quote Originally Posted by yeahtuna View Post
    Your circuit is very nice and produces really clean data. Thank-you so much. I spent an hour this evening playing around with it. I followed most of your recommendations and then explored a bit to find values for the low pass RC filter. I think I used 0.1 uF for the cap and 7 k for the resistor (R5).

    I used BAT 85s for that clamping circuit. Is that a bad idea? I already had them on my breadboard, so that's what I used. I ended up needing to use a 3k resistor to tune the amount of clamping (R4), which is a lot higher than the 22 ohms you had mentioned.

    I also have 0.1uF caps on both supply voltages of the opamp, but I'm not really sure if both of those are necessary. Thank-you again for your help. I'll play around with the circuit some more tomorrow, but it's already looking very nice. I need to think more about how the various resistors affect the circuit and influence each other.

    Regards,
    Rob
    Hi, @yeahtuna! Would you mind sharing the result circuit? I don't interested in universal piezo/switch inputs with autodetection and stuff, just what op amp you have chosen and R1-R5, C1 nominals and diode model. I have build teensy-based drum module for myself, and it works in general, but analog part (peak detector with two op amps per channel) is not as great as yours, so just looking for better solutions to bring my project to finished state. By the way I bought eDrumIn and it awesome! I wish I knew about it before I even started building my module
    Last edited by arkserg; 02-12-2020 at 08:25 AM. Reason: add mention to yeahtuna

  25. #25
    Senior Member
    Join Date
    Jun 2013
    Posts
    311
    You have the device, so I can't stop you from opening it up and taking a look. There are many combinations of components that will give you good results, but the real magic is in the firmware. You need things to run as fast as possible to get good results. You need to be reading each piezo at least 5 times / millisecond. I currently manage about 9 times / millisecond on eDRUMin devices. Good luck

Posting Permissions

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