Ne5532 op amp peak detector

Discussion in 'Analog & Mixed-Signal Design' started by seayaker, Jul 9, 2018.

  1. crutschow

    Expert

    Mar 14, 2008
    19,090
    5,331
    So what exactly will the peak circuit output be going to?
    If it goes directly to an A/D converter input, what's the model?
    The minimum supply voltages recommended for the NE5532 are plus and minus 5V.
    From the data sheet:
    upload_2018-7-10_22-14-49.png
    It won't work with a single 5v supply.

    If you want to use a single supply, then you need an op amp designed for a single supply, such as the LM324.
     
    absf and Sensacell like this.
  2. seayaker

    Thread Starter Active Member

    Jan 27, 2009
    36
    0
    The output goes to the micro controller, I have no idea what AD converter it uses. So if I get some lm324s what would the circuit look like?
     
  3. crutschow

    Expert

    Mar 14, 2008
    19,090
    5,331
    Do you have one microcontroller for each output or are they summed together somehow to one microcontroller?

    What is the model of the microcontroller?

    You need to show a schematic or block diagram of the complete circuit you will have so we don't have to do twenty questions to determine that. :rolleyes:
     
  4. seayaker

    Thread Starter Active Member

    Jan 27, 2009
    36
    0
    each piezo is connected to one of the 24 analog inputs with a 10k parallel resistor. The board converts the signal to a velocity sensitive midi note and sends it to the software program through USB. All I need to do is improve the analog signal from the piezo so that it can be read more accurately.

    9324f74ab3b000e9a1e6278471200736_original.png
     
  5. crutschow

    Expert

    Mar 14, 2008
    19,090
    5,331
    For minimum parts count you could use one LM324 per channel, as shown below.

    There are 4 op amps in an LM324 package so it would require 6 op amp packages for your 24 channels.

    R4 is just to provide a bias current path to ground for the op amp input, assuming the piezo source looks like a capacitor, and its value is somewhat arbitrary.

    The 10kΩ resistor to ground, Rin, is the resistor you stated was at each analog input.

    You can change the value of C1 to change the filter decay time-constant.
    The simulated signal decay time is similar to the signal shown in your website reference.

    upload_2018-7-11_10-59-1.png
     
  6. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    8,335
    1,877
    :confused: Your board has only 21 analog inputs.
    How will the MCU know if a piezo has been hit? Will it be polling all the analog pins continuously?
    Would it be able to capture all 24 inputs before any one of the peak detector caps discharges?
    You may find you'll need a sample-and-hold arrangement, in which the analog pins are all read and then the MCU discharges all the caps.
     
  7. crutschow

    Expert

    Mar 14, 2008
    19,090
    5,331
    Alternately, what about connecting all the op amp diode outputs in parallel with one capacitor and one resistor?
    That should work as long as no more than one drum is struck at a time.
     
  8. seayaker

    Thread Starter Active Member

    Jan 27, 2009
    36
    0
    the board has 25 analog inputs
     
  9. seayaker

    Thread Starter Active Member

    Jan 27, 2009
    36
    0
    I don't think you can help me
     
  10. bertus

    Administrator

    Apr 5, 2008
    18,118
    3,447
    Hello,

    I only count 21 analog inputs A0-A9 and A12-A22 on the given picture.
    @Alec_t , I found the other inputs on the backside of the board:

    Teensy36_back.png

    Bertus
     
  11. seayaker

    Thread Starter Active Member

    Jan 27, 2009
    36
    0
    Does anyone actually read what the issue is and offer a solution?
     
  12. crutschow

    Expert

    Mar 14, 2008
    19,090
    5,331
    Yes, we understand the problem and offered solutions but you seem to be unable to understand them.
    That's your problem not ours. :rolleyes:
     
  13. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    8,335
    1,877
    Ah. That explains things. Thanks, Bertus.
     
  14. mtripoli3

    Member

    Mar 1, 2016
    32
    13
    I scanned through this post, slightly interested as I've done this before...

    The first question so that I'm clear on what you're asking; are you looking for an actual analog level based on the force in which the pad is struck, or simply that the pad was struck? Otherwise, why the sample and hold? Getting an analog level is possible, though impractical. What you really want is the piezo strike to generate a "square" pulse which can be read by any digital pin (no need for analog at all).

    A single transistor COMPARATOR (or IC based one) is all you need. You want to use the "reference" (usually a pot) control of the comparator circuit to set the "threshold" at which the device outputs a pulse. In this way, you can set it so the tiniest of "taps" will trigger the circuit, up to having to "whack" it very hard. Your biggest problem is going to be mechanical; how will you mount the piezo so that it doesn't crack over time?

    Usually the resulting pulse from a piezo being struck is very high in voltage; it can reach hundreds of volts. As such, you'll need some fast diodes on the input to the circuit to protect the following stages. This can all be done single-ended, 5V only.

    As for how the µC will "read" the inputs. There are a number of ways to do this. I'm going to refer to Microchip PIC devices now as these are virtually all I use. Many other devices have the same or better ways of handing input signals. Almost all PIC's (going back to the "beginning"), PORTB was designed to be used for keypad input. As such, even from sleep, it generates an "interrupt" when one of these port pins changes state (the state part is programmable). There are at least 8 inputs per device (maybe more on bigger devices). In this case, if you don't want the PIC doing anything else, the main program is "nothing", all you "need" is an interrupt routine. Once a PORTB pin changes state, it generates an interrupt and vectors to the interrupt routine location (done automatically). There, you read which pin generated the interrupt and do whatever it is you want (change state on another pin, blink an LED. etc.) This sounds a bit complicated, but honestly it is not. Note I've not mentioned doing this with a "board" like an Arduino; I simply don't know enough to know if the response time is fast enough for what you're doing.

    Here's a screen shot from LTSpice and the file:
    https://www.dropbox.com/home/AAC/PIEZO_COMPARATOR?preview=PIEZO_COMPARATOR_00.jpg

    https://www.dropbox.com/s/f8u1w1btcczn3ih/PIEZO_COMPARATOR_00.asc?dl=0

    Note the output pulse width changes with amplitude of the input signal. You may want to trigger of the "leading edge" of the pulse...

    Shoot me a PM if you'd like some suggestions...

    Mike Tripoli

    Good luck!
     
    Last edited by a moderator: Jul 16, 2018 at 10:07 PM
Loading...