-
-
Save ericfont/a5cbebe84ebf81310eb8503693433d47 to your computer and use it in GitHub Desktop.
Screencast_20251129_021921.webm
green: original signal
brown: 1st-integral output
blue: 2nd-integral output (which includes a bit of first integral too)
yellow: lowpassed blue
Frequency of oscillations around 70kHz or so...
Todo: try to slew-rate limit the digital Q and Q' signals, so that they are guaranteed to be mostly within the bandwidth of the opamps and so they don't produce extra spikes. Hopefully this will also smooth the output a bit more. See https://www.ti.com/lit/ug/tidu026/tidu026.pdf for one possible method that uses two opamp stages to slew a digital input, though maybe there are simpler ways, such as just passing it through an opamp buffer whose specs have low slew.
I notice this particular setup fails at a 20kHz square wave (it just results in a 20kHz square wave for the PWM output).
The trapezia waveform is good for showing how it handles "slope overload" issue of delta modulation:
Buecause I'm actually encoding the 2nd derivative (plus a little of the 1st derivative), the resonstruction resembles the shape of a parabola (x^2) since that is the 2nd integral of a step. So as more time goes by the parabola gets steeper and steeper and so can better "catch up" to the occassional faster moving slope.
Screencast_20251129_024055.webm
Note about using slew limiting with opamp buffers: the MCP6004 is slow at .6 V/us, which means it could at best do around 60Khz for a 5Vpp triangle wave.
Oscillation is still around 70 kHz. So the 100ohm 470pF RC slewlimiter doesn't seem to cause slowdown of frequency.
can't seem to center the final output ...it jumps to either rail at a low frequency (like under 20Hz)...can't seem to filter it out. Maybe double integration is too much.
Instead maybe try extra high frequency lowpasses. Eg:
where two high freq 159kHz lowpasses overlap to have 180 degree intersect around 140 kHz:
which is where the oscillations would occur.











sim
not quite as good...

So it seems lowpassing at the end helps quite a bit.