Skip to content

Instantly share code, notes, and snippets.

@ericfont
Created December 2, 2025 20:41
Show Gist options
  • Select an option

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

Select an option

Save ericfont/0070bcbd08789e07bea6ff62c07f7fb0 to your computer and use it in GitHub Desktop.
try delta double integration again
Display the source blob
Display the rendered blob
Raw
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="700" height="404"><defs><linearGradient id="vPizZVwGCHaO" x1="0px" x2="32px" y1="0px" y2="0px" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#708f70"/><stop offset="1" stop-color="#6c936c"/></linearGradient><linearGradient id="XUhlUTMPFckR" x1="0px" x2="32px" y1="0px" y2="0px" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#807f7f"/><stop offset="1" stop-color="#708f70"/></linearGradient></defs><g><rect fill="#000000" stroke="none" x="0" y="0" width="700" height="404"/><g transform="scale(1,1) translate(214,-30)"><g><g><text fill="#ffffff" stroke="none" font-family="sans-serif" font-size="14px" font-style="normal" font-weight="normal" text-decoration="normal" x="388" y="234" text-anchor="start" dominant-baseline="central">export</text></g><path fill="none" stroke="#807f7f" paint-order="fill stroke markers" d=" M 368 192 L 409 220" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/></g><path fill="none" stroke="#807f7f" paint-order="fill stroke markers" d=" M 368 304 L 368 192" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><text fill="#ffffff" stroke="none" font-family="sans-serif" font-size="12px" font-style="normal" font-weight="normal" text-decoration="normal" x="374" y="254" text-anchor="start" dominant-baseline="alphabetic"></text><path fill="none" stroke="#6d926d" paint-order="fill stroke markers" d=" M -16 144 L -16 224" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><text fill="#ffffff" stroke="none" font-family="sans-serif" font-size="12px" font-style="normal" font-weight="normal" text-decoration="normal" x="-10" y="190" text-anchor="start" dominant-baseline="alphabetic"></text><path fill="none" stroke="#6c936c" paint-order="fill stroke markers" d=" M -80 112 L -80 97" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><g><text fill="#ffffff" stroke="none" font-family="sans-serif" font-size="12px" font-style="normal" font-weight="normal" text-decoration="normal" x="-96" y="85" text-anchor="start" dominant-baseline="central">+2.5V</text></g><g><g><text fill="#ffffff" stroke="none" font-family="sans-serif" font-size="14px" font-style="normal" font-weight="normal" text-decoration="normal" x="-86" y="320" text-anchor="start" dominant-baseline="central">export</text></g><path fill="none" stroke="#6d926d" paint-order="fill stroke markers" d=" M -16 320 L -40 320" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/></g><path fill="none" stroke="#6c936c" paint-order="fill stroke markers" d=" M 64 304 L 64 272" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><text fill="#ffffff" stroke="none" font-family="sans-serif" font-size="12px" font-style="normal" font-weight="normal" text-decoration="normal" x="70" y="294" text-anchor="start" dominant-baseline="alphabetic"></text><path fill="none" stroke="#6c936c" paint-order="fill stroke markers" d=" M 64 368 L 49 368" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><g><text fill="#ffffff" stroke="none" font-family="sans-serif" font-size="12px" font-style="normal" font-weight="normal" text-decoration="normal" x="13" y="368" text-anchor="start" dominant-baseline="central">+2.5V</text></g><path fill="none" stroke="#708f70" paint-order="fill stroke markers" d=" M 160 304 L 128 304" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><path fill="none" stroke="#6c936c" paint-order="fill stroke markers" d=" M 96 304 L 64 304" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><g transform="matrix(-1,0,0,-1,128,304)"><path fill="none" stroke="url(#vPizZVwGCHaO)" paint-order="fill stroke markers" d=" M 0 0 L 2 6 L 6 -6 L 10 6 L 14 -6 L 18 6 L 22 -6 L 26 6 L 30 -6 L 32 0" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/></g><text fill="#ffffff" stroke="none" font-family="sans-serif" font-size="12px" font-style="normal" font-weight="normal" text-decoration="normal" x="102" y="294" text-anchor="start" dominant-baseline="alphabetic">10k</text><path fill="none" stroke="#6c936c" paint-order="fill stroke markers" d=" M 64 336 L 64 368" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><text fill="#ffffff" stroke="none" font-family="sans-serif" font-size="12px" font-style="normal" font-weight="normal" text-decoration="normal" x="70" y="358" text-anchor="start" dominant-baseline="alphabetic"></text><path fill="none" stroke="#6c936c" paint-order="fill stroke markers" d=" M 64 272 L 28 272" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><path fill="none" stroke="#6c936c" paint-order="fill stroke markers" d=" M 28 284 L 28 260" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><path fill="none" stroke="#6d926d" paint-order="fill stroke markers" d=" M -16 272 L 20 272" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><path fill="none" stroke="#6d926d" paint-order="fill stroke markers" d=" M 20 284 L 20 260" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><text fill="#ffffff" stroke="none" font-family="sans-serif" font-size="12px" font-style="normal" font-weight="normal" text-decoration="normal" x="7" y="258" text-anchor="start" dominant-baseline="alphabetic">100pF</text><path fill="none" stroke="#6c936c" paint-order="fill stroke markers" d=" M 64 304 L 50 304" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><path fill="none" stroke="#6c936c" paint-order="fill stroke markers" d=" M 64 336 L 50 336" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><path fill="none" stroke="#6d926d" paint-order="fill stroke markers" d=" M -2 320 L -16 320" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><path fill="none" stroke="#c0c0c0" paint-order="fill stroke markers" d=" M 50 288 L 50 352 L -2 320 Z" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><g><text fill="#c0c0c0" stroke="none" font-family="sans-serif" font-size="14px" font-style="normal" font-weight="normal" text-decoration="normal" x="40" y="302" text-anchor="middle" dominant-baseline="central">-</text></g><g><text fill="#c0c0c0" stroke="none" font-family="sans-serif" font-size="14px" font-style="normal" font-weight="normal" text-decoration="normal" x="40" y="336" text-anchor="middle" dominant-baseline="central">+</text></g><path fill="none" stroke="#6d926d" paint-order="fill stroke markers" d=" M -96 144 L -48 144" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><text fill="#ffffff" stroke="none" font-family="sans-serif" font-size="12px" font-style="normal" font-weight="normal" text-decoration="normal" x="-72" y="138" text-anchor="start" dominant-baseline="alphabetic"></text><path fill="none" stroke="#6d926d" paint-order="fill stroke markers" d=" M -96 144 L -96 144" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><path fill="none" stroke="#6d926d" paint-order="fill stroke markers" d=" M -112 112 L -112 112" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><path fill="none" stroke="#6c936c" paint-order="fill stroke markers" d=" M -80 112 L -80 112" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><path fill="none" stroke="#ffffff" paint-order="fill stroke markers" d=" M -96 144 L -112 112" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><path fill="none" stroke="#6d926d" paint-order="fill stroke markers" d=" M -16 112 L -2 112" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><path fill="none" stroke="#6d926d" paint-order="fill stroke markers" d=" M -16 144 L -2 144" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><path fill="none" stroke="#01fd01" paint-order="fill stroke markers" d=" M 50 128 L 64 128" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><path fill="none" stroke="#c0c0c0" paint-order="fill stroke markers" d=" M -2 96 L -2 160 L 50 128 Z" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><g><text fill="#c0c0c0" stroke="none" font-family="sans-serif" font-size="14px" font-style="normal" font-weight="normal" text-decoration="normal" x="8" y="110" text-anchor="middle" dominant-baseline="central">-</text></g><g><text fill="#c0c0c0" stroke="none" font-family="sans-serif" font-size="14px" font-style="normal" font-weight="normal" text-decoration="normal" x="8" y="144" text-anchor="middle" dominant-baseline="central">+</text></g><path fill="none" stroke="#6d926d" paint-order="fill stroke markers" d=" M -16 272 L -16 320" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><text fill="#ffffff" stroke="none" font-family="sans-serif" font-size="12px" font-style="normal" font-weight="normal" text-decoration="normal" x="-10" y="302" text-anchor="start" dominant-baseline="alphabetic"></text><path fill="none" stroke="#807f7f" paint-order="fill stroke markers" d=" M 304 128 L 192 128" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><text fill="#ffffff" stroke="none" font-family="sans-serif" font-size="12px" font-style="normal" font-weight="normal" text-decoration="normal" x="248" y="122" text-anchor="start" dominant-baseline="alphabetic"></text><path fill="none" stroke="#6d926d" paint-order="fill stroke markers" d=" M -48 112 L -48 144" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><text fill="#ffffff" stroke="none" font-family="sans-serif" font-size="12px" font-style="normal" font-weight="normal" text-decoration="normal" x="-42" y="134" text-anchor="start" dominant-baseline="alphabetic"></text><g><path fill="none" stroke="#807f7f" paint-order="fill stroke markers" d=" M 96 128 L 112 128" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><text fill="#ffffff" stroke="none" font-family="normal" font-size="20px" font-style="normal" font-weight="normal" text-decoration="normal" x="117" y="134" text-anchor="start" dominant-baseline="alphabetic">D</text><path fill="none" stroke="#807f7f" paint-order="fill stroke markers" d=" M 192 128 L 176 128" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><text fill="#ffffff" stroke="none" font-family="normal" font-size="20px" font-style="normal" font-weight="normal" text-decoration="normal" x="157" y="134" text-anchor="start" dominant-baseline="alphabetic">Q</text><path fill="none" stroke="#56a956" paint-order="fill stroke markers" d=" M 192 192 L 176 192" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><text fill="#ffffff" stroke="none" font-family="normal" font-size="20px" font-style="normal" font-weight="normal" text-decoration="normal" x="157" y="198" text-anchor="start" dominant-baseline="alphabetic">Q</text><path fill="none" stroke="#ffffff" paint-order="fill stroke markers" d=" M 157 178 L 171 178" stroke-linecap="round" stroke-miterlimit="10" stroke-dasharray=""/><path fill="none" stroke="#56a956" paint-order="fill stroke markers" d=" M 96 160 L 112 160" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><path fill="none" stroke="#c0c0c0" paint-order="fill stroke markers" d=" M 112 152 L 128 160 L 112 168 Z" stroke-linecap="round" stroke-miterlimit="10" stroke-dasharray=""/><text fill="#ffffff" stroke="none" font-family="normal" font-size="20px" font-style="normal" font-weight="normal" text-decoration="normal" x="117" y="166" text-anchor="start" dominant-baseline="alphabetic"></text><path fill="none" stroke="#c0c0c0" paint-order="fill stroke markers" d=" M 112 112 L 176 112 L 176 208 L 112 208 Z" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/></g><path fill="none" stroke="#56a956" paint-order="fill stroke markers" d=" M 96 160 L 96 163" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><g><text fill="#ffffff" stroke="none" font-family="sans-serif" font-size="12px" font-style="normal" font-weight="normal" text-decoration="normal" x="86" y="175" text-anchor="start" dominant-baseline="central">CLK</text></g><path fill="none" stroke="#01fd01" paint-order="fill stroke markers" d=" M 64 128 L 66 128" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><path fill="none" stroke="#807f7f" paint-order="fill stroke markers" d=" M 94 128 L 96 128" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><path fill="none" stroke="#c0c0c0" paint-order="fill stroke markers" d=" M 66 112 L 66 144 L 94 128 Z" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><path fill="none" stroke="#6d926d" paint-order="fill stroke markers" d=" M -48 112 L -16 112" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><text fill="#ffffff" stroke="none" font-family="sans-serif" font-size="12px" font-style="normal" font-weight="normal" text-decoration="normal" x="-32" y="106" text-anchor="start" dominant-baseline="alphabetic"></text><path fill="none" stroke="#807f7f" paint-order="fill stroke markers" d=" M 176 368 L 176 384" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><path fill="none" stroke="#807f7f" paint-order="fill stroke markers" d=" M 186 384 L 166 384" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><path fill="none" stroke="#807f7f" paint-order="fill stroke markers" d=" M 182 389 L 170 389" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><path fill="none" stroke="#807f7f" paint-order="fill stroke markers" d=" M 178 394 L 174 394" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><path fill="none" stroke="#708f70" paint-order="fill stroke markers" d=" M 176 304 L 176 332" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><path fill="none" stroke="#708f70" paint-order="fill stroke markers" d=" M 188 332 L 164 332" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><path fill="none" stroke="#807f7f" paint-order="fill stroke markers" d=" M 176 368 L 176 340" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><path fill="none" stroke="#807f7f" paint-order="fill stroke markers" d=" M 188 340 L 164 340" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><text fill="#ffffff" stroke="none" font-family="sans-serif" font-size="12px" font-style="normal" font-weight="normal" text-decoration="normal" x="190" y="342" text-anchor="start" dominant-baseline="alphabetic">10nF</text><path fill="none" stroke="#807f7f" paint-order="fill stroke markers" d=" M 240 304 L 224 304" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><path fill="none" stroke="#708f70" paint-order="fill stroke markers" d=" M 192 304 L 176 304" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><g transform="matrix(-1,0,0,-1,224,304)"><path fill="none" stroke="url(#XUhlUTMPFckR)" paint-order="fill stroke markers" d=" M 0 0 L 2 6 L 6 -6 L 10 6 L 14 -6 L 18 6 L 22 -6 L 26 6 L 30 -6 L 32 0" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/></g><text fill="#ffffff" stroke="none" font-family="sans-serif" font-size="12px" font-style="normal" font-weight="normal" text-decoration="normal" x="202" y="294" text-anchor="start" dominant-baseline="alphabetic">1k</text><path fill="none" stroke="#807f7f" paint-order="fill stroke markers" d=" M 304 128 L 368 192" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><text fill="#ffffff" stroke="none" font-family="sans-serif" font-size="12px" font-style="normal" font-weight="normal" text-decoration="normal" x="340" y="164" text-anchor="start" dominant-baseline="alphabetic"></text><path fill="none" stroke="#807f7f" paint-order="fill stroke markers" d=" M 368 304 L 240 304" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><text fill="#ffffff" stroke="none" font-family="sans-serif" font-size="12px" font-style="normal" font-weight="normal" text-decoration="normal" x="304" y="298" text-anchor="start" dominant-baseline="alphabetic"></text><path fill="none" stroke="#6d926d" paint-order="fill stroke markers" d=" M -112 112 L -127 112" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><path fill="none" stroke="#808080" paint-order="fill stroke markers" d=" M -127.34 112 A 16.66 16.66 0 1 1 -127.3400083299993 111.98334000277666" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><path fill="none" stroke="#808080" paint-order="fill stroke markers" d=" M -154 112 L -153 110 L -152 108 L -151 106 L -150 105 L -149 105 L -148 105 L -147 106 L -146 108 L -145 110 L -144 112 L -143 114 L -142 116 L -141 118 L -140 119 L -139 119 L -138 119 L -137 118 L -136 116 L -135 114 L -134 112" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><text fill="#ffffff" stroke="none" font-family="sans-serif" font-size="12px" font-style="normal" font-weight="normal" text-decoration="normal" x="-161" y="93" text-anchor="start" dominant-baseline="alphabetic">10kHz</text><path fill="none" stroke="#6d926d" paint-order="fill stroke markers" d=" M -16 224 L -16 272" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><text fill="#ffffff" stroke="none" font-family="sans-serif" font-size="12px" font-style="normal" font-weight="normal" text-decoration="normal" x="-10" y="254" text-anchor="start" dominant-baseline="alphabetic"></text><path fill="none" stroke="#708f70" paint-order="fill stroke markers" d=" M 160 304 L 176 304" stroke-linecap="round" stroke-miterlimit="10" stroke-width="3" stroke-dasharray=""/><text fill="#ffffff" stroke="none" font-family="sans-serif" font-size="12px" font-style="normal" font-weight="normal" text-decoration="normal" x="168" y="298" text-anchor="start" dominant-baseline="alphabetic"></text><path fill="#ffffff" stroke="none" paint-order="stroke fill markers" d=" M 371 192 A 3 3 0 1 1 370.99999999995777 191.99998407846124 Z"/><path fill="#ffffff" stroke="none" paint-order="stroke fill markers" d=" M -13 320 A 3 3 0 1 1 -13.000000000042249 319.99998407846124 Z"/><path fill="#ffffff" stroke="none" paint-order="stroke fill markers" d=" M 67 304 A 3 3 0 1 1 66.99999999995775 303.99998407846124 Z"/><path fill="#ffffff" stroke="none" paint-order="stroke fill markers" d=" M -13 272 A 3 3 0 1 1 -13.000000000042249 271.99998407846124 Z"/><path fill="#ffffff" stroke="none" paint-order="stroke fill markers" d=" M 195 192 A 3 3 0 1 1 194.99999999995774 191.99998407846124 Z"/><path fill="#ffffff" stroke="none" paint-order="stroke fill markers" d=" M 179 304 A 3 3 0 1 1 178.99999999995774 303.99998407846124 Z"/></g></g></svg>
@ericfont
Copy link
Author

ericfont commented Dec 2, 2025

sim

image

@ericfont
Copy link
Author

ericfont commented Dec 2, 2025

This time using Schmitt-input flip flop with comparator (output blue), which seems to produce a very reliable transition (yellow) right when clock (green) goes up.
Screencast_20251202_154421.webm

The hysteresis is good cause sometimes the transition injects glitches into the analog input signal (red)

@ericfont
Copy link
Author

ericfont commented Dec 2, 2025

Add 10mohm feedback for output and apply a notch filter, so green final output has much less of the oscillation frequency:

Screencast_20251202_163950.webm

@ericfont
Copy link
Author

ericfont commented Dec 2, 2025

almost imperceptible latency:

image

@ericfont
Copy link
Author

ericfont commented Dec 3, 2025

adding a notch-filter for the oscillation combined with a lowpass:

image

This gives a pretty good reconstruction:

Screencast_20251203_022413.webm

The filters add just a tad of delay.

@ericfont
Copy link
Author

ericfont commented Dec 3, 2025

Here is 0.1V(peak) 20khz sine (yellow) being reconstructed w/ notch (green):

Screencast_20251203_023127.webm

@ericfont
Copy link
Author

ericfont commented Dec 3, 2025

my notch filter may be suffering from breadboard parasitics.

@ericfont
Copy link
Author

ericfont commented Dec 3, 2025

There is some glitch that happens when use input that is just DC with some offset away from the midpoint, which causes the output reconstruction to alternate between hitting each rail every second or so. By moving offset back to midpoint and adding an actual sine input, that glitch goes away:

image

@ericfont
Copy link
Author

ericfont commented Dec 3, 2025

For instance, here the input (yellow) is just a DC value that I'm changing every few seconds:

image

But if I get too close to the negative rail, then that triggers the output to enter an oscillatory state of decaying closer to the midpoint and then jumping to the opposite rail, which keeps repeating.

@ericfont
Copy link
Author

ericfont commented Dec 3, 2025

at it seems to be the 2nd integral signal that does this oscillation...the first integration signal stays around mid voltage:

image

@ericfont
Copy link
Author

ericfont commented Dec 3, 2025

It seems the second integral signal isn't properly integrating cause its top or bottom gets clipped:

Screencast_20251203_025522.webm

@ericfont
Copy link
Author

ericfont commented Dec 3, 2025

the signals when changing from one rail to the other:

image

@ericfont
Copy link
Author

ericfont commented Dec 3, 2025

So it seems once its has decayed enough so that the top of the 2nd-integral signal no longer clips, then that triggers the resumption of proper integration...but what happens is the decay keeps on happening and actually over shoots and hits the other rail.

To lessen likelihood of entering this situation, should always DC block the input signal.

@ericfont
Copy link
Author

ericfont commented Dec 3, 2025

zoomed out a bit:

image

@ericfont
Copy link
Author

ericfont commented Dec 3, 2025

If instead did two RC low pass filters in series, then I'd think at least the "integration" would always remain around the middle voltage, so wouldn't have this rail hitting issue. The capacitors would always be keeping the proper voltage. Would still need an opamp afterwards to amplify the signal so it is the same amplitude range as the input signal.

@ericfont
Copy link
Author

ericfont commented Dec 3, 2025

but if try two RC integrations, then get not so great frequency spectrum:

image

There is a 3rd harmonic. So the question I need to investigate is can I get rid of that harmonic with RC and just deal with RC-only, without having to even involve opamp? Or is the issue something else that can be avoided in some other manner?

@ericfont
Copy link
Author

ericfont commented Dec 3, 2025

the pwm seems to be close to 50% during rail transitions:

image

@ericfont
Copy link
Author

ericfont commented Dec 3, 2025

ADC 2nd integration (yellow) also hits the rails

image

@ericfont
Copy link
Author

ericfont commented Dec 3, 2025

image

@ericfont
Copy link
Author

ericfont commented Dec 3, 2025

image

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