Implementation of digital computation (curve fitting) followed by PID control
Posted: Wed Feb 21, 2018 5:56 am
Hi all,
I want to see if I can use the Red Pitaya to help our laser locking experiment. I want to analyze a fast analog input (using digital computations) and use the outcome of that analysis as the input to a PID controller. Each cycle of my analog signal (the cycle rate is variable and not a limiting factor here) consists of two peaks with some separation (ie time delay). The goal would be to fit each peak to a (Gaussian) curve, determine their separation, then combine that value with a set point for what the separation should be into a PID feedback loop using the onboard FPGA. The output of the PID loop would be sent to the RP's fast analog output, which would then be fed into the experiment generating the analog signals. This whole process would ideally be repeated as fast as possible (>100 Hz would be a great starting point).
I am imagining performing everything in a Python/MATLAB environment: acquiring the data from the fast ADC, performing curve fitting, then somehow feeding that result into the PID controller (using a fast DAC?) (this is where I start losing the plot). What would be the speed limitations on how fast I can import the analog input data into a programming environment? Is there a way I can access the PID functionality through Python or MATLAB? Ideally all of this would take place in a single script, is that even possible? Alternatively I was thinking of performing the digital computations and curve fitting, sending that to the fast analog output, and feeding that back into the second fast analog input and using that for the PID controller's input. Would I be limited then by multiple ADC and DAC cycle times? Could I run curve fitting with digital computations and the PID module at the same time?
Some context on the experiment (if that helps you visualize things): We are performing laser locking by transferring the stability of a stable laser to an unstable laser. The lasers are sent into a resonant cavity and the cavity length is ramped using a piezoelectric device driven by a signal generator. The output of the cavity is monitored with a photodiode. Every cycle of the ramp we get two resonant peaks corresponding the resonances of the stable and unstable lasers. The goal of the feedback loop is to fix the separation of these resonances, which stabilizes the frequency of the unstable laser.
Thanks for any advice you can provide!
I want to see if I can use the Red Pitaya to help our laser locking experiment. I want to analyze a fast analog input (using digital computations) and use the outcome of that analysis as the input to a PID controller. Each cycle of my analog signal (the cycle rate is variable and not a limiting factor here) consists of two peaks with some separation (ie time delay). The goal would be to fit each peak to a (Gaussian) curve, determine their separation, then combine that value with a set point for what the separation should be into a PID feedback loop using the onboard FPGA. The output of the PID loop would be sent to the RP's fast analog output, which would then be fed into the experiment generating the analog signals. This whole process would ideally be repeated as fast as possible (>100 Hz would be a great starting point).
I am imagining performing everything in a Python/MATLAB environment: acquiring the data from the fast ADC, performing curve fitting, then somehow feeding that result into the PID controller (using a fast DAC?) (this is where I start losing the plot). What would be the speed limitations on how fast I can import the analog input data into a programming environment? Is there a way I can access the PID functionality through Python or MATLAB? Ideally all of this would take place in a single script, is that even possible? Alternatively I was thinking of performing the digital computations and curve fitting, sending that to the fast analog output, and feeding that back into the second fast analog input and using that for the PID controller's input. Would I be limited then by multiple ADC and DAC cycle times? Could I run curve fitting with digital computations and the PID module at the same time?
Some context on the experiment (if that helps you visualize things): We are performing laser locking by transferring the stability of a stable laser to an unstable laser. The lasers are sent into a resonant cavity and the cavity length is ramped using a piezoelectric device driven by a signal generator. The output of the cavity is monitored with a photodiode. Every cycle of the ramp we get two resonant peaks corresponding the resonances of the stable and unstable lasers. The goal of the feedback loop is to fix the separation of these resonances, which stabilizes the frequency of the unstable laser.
Thanks for any advice you can provide!