Square wave demodulation source or square wave PLL for LIA

I’ve been using a PWM square wave as my demodulation source for a project with a lock in amplifier. When used to drive a mosfet it’s a great way to streamline control and readout of my circuit, but the PLL doesn’t seem to play well with square inputs, and at high bandwidth actually ends up adding a ton of noise to the system…



Maybe this isn’t such a big deal as I’m still getting a phase stable 2kHz signal as the demodulation frequency, but as my PWM duty cycle goes to extremes the resulting signal amplitude gets diminished which isn’t ideal. I’d expect that for a digital signal like a square wave the PLL should actually be much easier to implement. I’m really partial to using a square wave here since you have finer resolution over pulse width than you would with a simple analog output- it’s been allowing a cheaper system like the moku go to punch above it’s weight for my particular application. Yes there’s a little systematic error from the harmonics in the square wave, but that can be compensated for.
As an aside, is there any reason that rectification isn’t an option when operating in the external demodulation source mode? That would also be a fine solution for this situation.

PS: I’ve really enjoyed the ability to probe around within the moku like this- being able to see your signal anywhere in the chain has been both educational and useful for troubleshooting.
Cheers.

-Jack

Hi Jack, you might want to try reducing the bandwidth setting on the PLL. Ideally it should (much) less than the frequency you are trying to lock to (2kHz in your case). With the bandwidth set this high, the loop has the reaction time to respond to the intricate details of your signal, rather than just keeping a sine wave frequency/phase aligned with the fundamental. Try reducing the bandwidth from 100 kHz to either 10Hz or 100 Hz. Hope this helps!

Hi Daniel,

Thank you for this point, I’d just been considering the response time of the lock in amplifier as a whole here, and having the PLL bandwidth limited at 100Hz would mean that the whole system would be constrained there as well right? I guess what I’m wishing for here is to just have a phase detector rather than the full PLL, that way I’m free to send in my PWM square wave as the demodulation signal but still get a rectified output. I may start looking into decoupling readout and control here though…