Author Topic: Getting wrong output for Amplifier and low pass filter circuit simulation  (Read 3717 times)

0 Members and 1 Guest are viewing this topic.

Offline SohTopic starter

  • Newbie
  • Posts: 6
  • Country: lk
Hello,
I’m trying to make an amplifier and filter circuit for acquiring heart sounds via an electret and transmitting them to a microcontroller. This is the total circuit diagram for it (got it from a similar project). However, I am having trouble getting the right graph output when simulating it in Proteus.
" alt="" class="bbc_img" />

For the amplifier, using the unity gain NE5532 op amp, The two signals are shifted high and low instead of intersecting with one another.



Then, the filter circuit consists of 2 Sallen Key filters to make a low pass 4th order Butterworth with a cut-off frequency of 200Hz. When simulating the circuit, I end up with a graph that resembles a Band-pass filter or high-pass response rather than a low pass filter response:



Then I realized I didn't connect the inverting terminal with the output terminal, but when I corrected it, I got a different graph altogether:



Just to check, I tried simulating a different amplifier circuit just to check and got the expected output (below):



I am planning on making a PCB of this circuit but every time I run the simulation I get different outputs and I don’t know whether the problem is with the capacitors and resistor values or software. Could someone please tell me what is causing the above simulation results and how I can correct it? Is there a problem with the original circuit diagram? Thank you.
« Last Edit: June 23, 2023, 10:45:24 am by Soh »
 

Offline ArdWar

  • Frequent Contributor
  • **
  • Posts: 730
  • Country: sc
Well for starter please simulate using your actual OpAmp. 741 being so old and slow won't help you here.

The 6dB/octave per opamp "bounce" in your frequency response is expected for Sallen Key filter. It's caused by the OpAmp not fast enough to "handle" input at that frequency, making the feedback capacitor a direct bypass to the output instead.

It should still be fine for your purpose tho. It happens at ultrasonic range, and the attenuation is still decent at the desired frequency. If you really don't want it you can use MFB topology instead of SK (it'll flatten instead of coming back up) and/or use faster OpAmp (it'll come back at higher frequency)
In real circuit you'll hit another weirdness caused by capacitor's ESL well before the "bounce" becomes a problem tbf

Why do you need such steep filter anyway?
« Last Edit: June 23, 2023, 11:30:19 am by ArdWar »
 
The following users thanked this post: Soh

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 22257
  • Country: gb
  • 0999
Sallen Key topology requires a passive pre-filter, to account for the fact op-amps have a limited bandwidth.

The LM358 has a lot of crossover distortion, which might be an issue.

Cheap op-amps such as the LM358 and 741 are noisy.

What sort of microphone are you using? The TL072 or NE5532 might be better, depending on its impedance. The TL072 is J-FET input with a low current noise but higher volage noise and is optimal for a high source impedance, whilst the BJT input has a lower volage noise and is optimal for a low source impedance.
 
The following users thanked this post: Soh

Offline SohTopic starter

  • Newbie
  • Posts: 6
  • Country: lk
I accidently deleted my first reply for ArdWar:

Thank you so much for clearing it up. I didn't know this frequency response is expected, I thought I did something horribly wrong to get a graph like that.

I was actually planning on using the LM741  :-[ . [I went with this exact circuit diagram from a similar project since I wasn't sure how to design it from scratch myself]. I  will change the OpAmp as you suggested,

I did some more research and it says here https://ww1.microchip.com/downloads/en/DeviceDoc/adn003.pdf that the Gain Bandwidth Product (GBWP) of my amplifier should be equal to or greater than 100fC. So because I need a cut-off of 200Hz, I should get an amplifier with a GBWP of 20kHz ? Depending on what is available in my country, I thought of switching to either an LM358 (has a GBW of 0.7MHz and typical slew rate of 0.3V/us) or The TL072 (GBW of 3MHz and slew rate of 13V/us). Would these be okay?

And since I'm trying to make a real circuit, will the capacitor's ESL cause problems when acquiring the signal? If so, is there a way I can avoid it, maybe by changing the capacitance values?

I will try changing the topology too, I was wondering why there were so many different implementations of the same filter.

I need a steep filter since I want to acquire fetal heart sounds without the external noise so I read that by cascading 2 SKs , we get closer to the ideal filter response and the signal of the heartbeat is increased relative to the noise. Also, by keeping the input freq in this range, we can sample the signal according to the Nyquist theorem without the danger of aliasing.

Could you also please explain the output of the amplifier circuit as well, as in why are the waveforms so far apart? Thank you.
 

Offline SohTopic starter

  • Newbie
  • Posts: 6
  • Country: lk
Thanks so much Zero999. I am already using the NE5332 for the amplification stage, so is it alright if I use it for the filtering stage as well (as in 3 different op-amps) since I'm connecting it all together?
I'm using an omnidirectional electret condenser microphone, here are its specs:
  • Sensitivity: -38 ± 3dB
    Impedance: 2.2kΩ (max)
    S/N ratio (a weighted network): 60dB (min)
    Maximum input sound pressure level: 110dB
    Standard operating voltage: 2.0VDC
    Operating voltage range: 1.0 - 10.0VDC
    Decrease voltage characteristics (Vs=2.0 to 1.5VDC): -3dB (Max)
    Current consumption: 500μA (max)

which op-amp do you suggest for this purpose? Thank you.
« Last Edit: June 23, 2023, 01:34:03 pm by Soh »
 

Online Benta

  • Super Contributor
  • ***
  • Posts: 7059
  • Country: de
The 50 uF cap is connected incorrectly, it should be across the supply lines.
Otherwise your plots are correct (except for the second one, but you already fixed that).
The high-pass behaviour is typical of Sallen-Key filters and a reason I avoid them.

EDIT: this document is very good:
https://www.ti.com/lit/an/sloa049d/sloa049d.pdf

Check page 14.
« Last Edit: June 23, 2023, 01:50:26 pm by Benta »
 
The following users thanked this post: Soh

Offline SohTopic starter

  • Newbie
  • Posts: 6
  • Country: lk
Wow, thank you so much, that document is very helpful @Benta.
I just fixed the 50uF decoupling capacitor. Is there a reason why the waveforms don't oscillate around the same horizontal line in my first amplifier graph?
I feel like avoiding these Sallen-Keys myself but, unfortunately I have no option but to include 2 of them. At least I know they will work okay for this application since a few others used this method and were able to get fairly accurate results.
 

Offline ArdWar

  • Frequent Contributor
  • **
  • Posts: 730
  • Country: sc
Would these be okay?
TL072 is decent amp. It's also cheaper than 741 in most places.

And since I'm trying to make a real circuit, will the capacitor's ESL cause problems when acquiring the signal? If so, is there a way I can avoid it, maybe by changing the capacitance values?
Don't worry about it, the weird things only happen at very high frequencies.
Do change the values however. Where do you even plan to find 1360nF caps? For designing filters you usually first pick the capacitors into few predetermined common values and change the resistors accordingly. There are more resistor values variation in the market than capacitor values, and resistors are usually much cheaper too. You can also put two resistors in series/parallel if you want exact values that aren't available in the market.

Could you also please explain the output of the amplifier circuit as well, as in why are the waveforms so far apart? Thank you.
That's because you bias the whole thing to 5V. I'm surprised it didn't clip. I think you meant to put the lower "trace" into GND instead of floating like that.
« Last Edit: June 23, 2023, 02:33:11 pm by ArdWar »
 

Online Benta

  • Super Contributor
  • ***
  • Posts: 7059
  • Country: de
Is there a reason why the waveforms don't oscillate around the same horizontal line in my first amplifier graph?
The input is DC biased to +5 V. The output is DC biased to ground. The plots are completely correct.
If you measure after the input cap and before the output cap, you'll see what you expected.
 
The following users thanked this post: Soh

Offline SohTopic starter

  • Newbie
  • Posts: 6
  • Country: lk
For designing filters you usually first pick the capacitors into few predetermined common values and change the resistors accordingly.

I took some time to try and calculate it like this (This is my first time trying to calculate values for a 4th order Butterworth LPF, so far I'm only familiar with calculating first order LPFs like these, with the Rf ) :

I followed another LPF designed for the same fc by someone else : 1812637-1
I just don't understand how they were able to calculate different values for both resistors and capacitors.

I went by this diagram [ Specified attachment is not available ]
Made c1=c2= 470nF, and then got R1=R2= 1.69K for both (using equation of fc and fc=200Hz)
This didn't seem right so,
I referred this doc
https://www.ti.com/lit/an/sloa049d/sloa049d.pdf
where it says on pg 19, under Sallen-Key Design Simplifications that we can "Set Resistors as Ratios and Capacitors Equal" as you suggested.

I searched around and found that Q for the first stage =0.54 and for the 2nd stage=1.31 while Gain(k) = 1.152 (1st stage) and 2.235 (2nd stage) for 4th order Butterworth filters to get the best response . Also referred this page : https://circuitcellar.com/resources/quickbits/sallen-n-key-filter/#:~:text=The%20Sallen%20%26%20Key%20circuit%20is,pass%20or%20high%2Dpass%20filter.
But then I got m=1 which means that the resistor values become the same again.

Could you please provide a link or please explain how I can calculate the R and C values for the 2 SKs? Then I will be able to change the values accordingly depending on the availability of the ceramic n electrolytic caps.
Thank you.
« Last Edit: June 24, 2023, 11:22:51 am by Soh »
 

Offline SohTopic starter

  • Newbie
  • Posts: 6
  • Country: lk
If you measure after the input cap and before the output cap, you'll see what you expected.

This worked, Thank you!
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf