Ne5532 op amp peak detector

crutschow

Joined Mar 14, 2008
34,468
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?
I would like to use just one of the ne5532s op amps since I already have them.
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.
 

Thread Starter

seayaker

Joined Jan 27, 2009
74
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:
View attachment 156000
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.
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?
 

crutschow

Joined Mar 14, 2008
34,468
The output goes to the micro controller
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:
 

Thread Starter

seayaker

Joined Jan 27, 2009
74
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:
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
 

crutschow

Joined Mar 14, 2008
34,468
if I get some lm324s what would the circuit look like?
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
 

Alec_t

Joined Sep 17, 2013
14,335
each piezo is connected to one of the 24 analog inputs
: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.
 

crutschow

Joined Mar 14, 2008
34,468
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.
 

Thread Starter

seayaker

Joined Jan 27, 2009
74
: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.
the board has 25 analog inputs
 

mtripoli3

Joined Mar 1, 2016
35
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:
Top