Skip to content

Instantly share code, notes, and snippets.

@ericfont
Created December 3, 2025 19:29
Show Gist options
  • Select an option

  • Save ericfont/c66ef20f7de7867b000dddc61e857305 to your computer and use it in GitHub Desktop.

Select an option

Save ericfont/c66ef20f7de7867b000dddc61e857305 to your computer and use it in GitHub Desktop.
passive combo RC lowpass with RLC notch for reconstruction
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ericfont
Copy link
Author

ericfont commented Dec 3, 2025

sim

@ericfont
Copy link
Author

ericfont commented Dec 3, 2025

image

@ericfont
Copy link
Author

ericfont commented Dec 3, 2025

although the sim looks fine, in reality trying to do it on a breadboard and tweaking variable capacitor values doesn't seem to actually work to null the oscillation.

Maybe a better way would be to send a delayed negative version of the PWM and add it to the original pwm (i.e. do a comb filter) would could precisely target a specific frequency.

@ericfont
Copy link
Author

ericfont commented Dec 4, 2025

adding a delayed version of waveform that is 1/2 of the oscillation period seems to work well to null most of the oscillation frequency, while not really delaying or distorting much...here is 1kHz 1V(peak) input:

image

and here is 10kHz 1V(peak) input:

image

@ericfont
Copy link
Author

ericfont commented Dec 4, 2025

@ericfont
Copy link
Author

ericfont commented Dec 4, 2025

@ericfont
Copy link
Author

ericfont commented Dec 7, 2025

Nothe: the RC lowpasses are unnecessary for reconstruction, or their cutoff freq could even be made lower closer to 20kHz if desired for smoothness. The integrator is the one crucial part.

And for feedback, the RC cutoff is the main thing that influences the oscillation frequency (other than other circuit dealys). Thus, a Potentiometer could be used for the resistor to tweak the oscillation frequency to be exactly 96kHz.

@ericfont
Copy link
Author

ericfont commented Dec 8, 2025

tweaks

maybe there is some other way to encode 2nd derivative other than just using 1st derivative as input or mix it in with some CR network when combining with feedback result.

@ericfont
Copy link
Author

ericfont commented Dec 9, 2025

image

@ericfont
Copy link
Author

ericfont commented Dec 9, 2025

Above was output of adding RC-lowpassed both Q and delayed Q summed and integrated.

Below is just Q's output:

image

Below is the integrator's output:

image

@ericfont
Copy link
Author

ericfont commented Dec 9, 2025

sim with tighter integral output compared to input

Q out:
image

integrated out:
image

doesn't seem better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment