Lowpass filter comparison (LM358)

Passive lowpass (1st order)

These are the component values I will be using. The percentages indicate the expected voltage at each frequency.

| | 10Hz | 100H | | ----------- | ---- | ---- | | 150000-33nF | 95% | 31% |

How did I pick these values? By using my MySQL database which I filled with all values that are currently in my inventory, and utilizing this SQL query:

-- 1st order R-C lowpass combinations with the desired Vout at specific frequencies.
SET @vin = 1;
WITH cte1 AS (
    -- Calculate Vout for all R-C combinations (excluding some component values).
    SELECT concat(RES.R, '-', CAP.label) AS name, F.num, 
    @vin*((1/(2*pi()*F.num*C))/sqrt(power(R,2)+power(1/(2*pi()*F.num*C),2))) AS Vout
    FROM electronics_capacitors_ceramic CAP
    JOIN electronics_resistors RES
    JOIN electronics_factors F
    WHERE (F.num = 10 OR F.num = 100) -- Make the query faster BY pre-selecting interesting frequencies.
    AND RES.R < 1000000 -- Very high resistors introduce noise.
    AND RES.R > 1000 -- NOT too low resistors.
)
SELECT A.name, A.Vout AS Vout_A, B.Vout AS Vout_B
FROM cte1 A
JOIN cte1 B USING (name) 
WHERE (A.num = 10 AND A.Vout > 0.95) -- At frequency X I want the voltage TO be AT least Y.
AND (B.num = 100 AND B.Vout < 0.5) -- At frequency X I want the voltage TO be AT most Y.
ORDER BY name

image-20230128105309781

| Result | 10Hz | 100Hz | | ------ | ----- | ----- | | V-IN | 0.992 | 0.992 | | V-OUT | 0.928 | 0.576 |

Active lowpass (1st order)

The circuit I will be using (source):

image-20230128094951961

![opamp-lowpass_1nd_bb (1)](opamp-lowpass_1nd_bb (1).png)

Problem! The output voltage measures -4 V DC. How do I solve this?

Shouldn't the output-to-negative-input path also contain a resistor to balance out R?

I broke my IC...probably due to static I suppose but I cannot say for certain. I will continue with an TL072.

Next steps:

  1. Simulate in LTSpice to be certain I am not doing something very wrong.

  2. Create an amplifier with 1x amplification but with resistors in the input and feedback. Is the outcome different?

Result:

image-20230129115419276

(doesn't this schema contain an error, should'nt R_load be to GND instead of -5V?)

image-20230211092142746

That looks better.

image-20230211093219020

image-20230129115517529

After this I also tested on the breadboard and it is working great. Then I added the lowpass filter (only the capacitor had to be added before the positive opamp input) and that also works good.

| Result | 10Hz | 100Hz | | ------ | ----- | ----- | | V-IN | 0.992 | 1.01 | | V-OUT | 0.976 | 0.368 |

Active lowpass (2nd order, butterworth)

image-20230127192923576

What values to use for the components?

$frequency = {\sqrt(2) \over {4 * \pi * R_1 * C_2} }$

The calculator on this webpage gives me these results when I input a 50Hz cutoff frequency: R1 and R2 10K, C1 450nF and C2 225nF. This is the circuit on the page:

![8e93dee8-ecc0-11e9-80df-00163e0618d6_m (1)](8e93dee8-ecc0-11e9-80df-00163e0618d6_m (1).jpg)

Let's try it out! I will use 100K for both R3 and R4 and 1uF for Cin.

image-20230129121925120

Side note: I set DC2 to 7 V to see if it has any bad effect if the DC supply voltages are uneven (it does not).

This circuit contains an error! R_load is connected to -5V where it should be to ground! After correcting, the sine wave is +/- 800 mV @ 10 Hz and +/- 550 mV @ 50 Hz.

The simulation shows me a Vout between 0.4 and 1.6 V or so; not good! The frequency-decibel chart (different simulation than in the image) looks pretty normal though, slowly tapering off as the frequency increases.

Perhaps I just have to add some AC-coupling at the output? No, now the output voltage swings between -4.4 and -5.7V.

I found this circuit online (source, dead link) which looks very much like mine. Let's simulate this one and see if the result looks better.

JBBUW

That did not help me very much. The 'ideal' opamp used in this way behaves oddly for me.

Okay, back to this circuit which simulates quite well now:

image-20230129173113062

But I just notice...the image above uses a single supply! Let's simulate and see if that would work...

image-20230129173807587

Not quite, the output is between +4.5 and +5.5V. Let's try some AC-coupling...

image-20230129174030515

Well that did it (for the simulation at least); output is +/- 0.5V at the peaks. To the breadboard! After some extra experimenting in Ltspice I notice the coupling capacitors have a pretty big effect on the output. I have to learn more about why.

opamp-lm358-butterworth-50hz-lowpass_bb

I built the circuit but is it not the result I hoped for. For some reason it works more like a high-pass filter now. Next steps:

  1. Do more research in determining the correct component values. Problem: I have no idea how to do this.
  2. Try something simpler first (a 'regular' 2nd order circuit and not this 'butterworth' layout). Will do after I do some more experimenting on this circuit.

In think it may have something to do with the size of the AC-coupling resistors. With the 1uF they are much bigger then the ones used in the filters, so I think it is likely they will have an effect on it.

What I will do:

  1. Connect a scope to the left part of the circuit and see the effect of C3 and the two 100k resistors on the signal.
  2. Try different sizes of C values for C3 and C4.