Implementation of digital computation (curve fitting) followed by PID control

Applications, development tools, FPGA, C, WEB
Post Reply
hutzlerlab
Posts: 4
Joined: Wed Feb 21, 2018 5:22 am

Implementation of digital computation (curve fitting) followed by PID control

Post by hutzlerlab » 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!

amike88
Posts: 89
Joined: Tue Mar 29, 2016 7:41 pm

Re: Implementation of digital computation (curve fitting) followed by PID control

Post by amike88 » Mon Feb 26, 2018 3:25 pm

I think Red Pitaya hardware should be possible to handle that.

I'd recommend that you take a look at jupyter I think that you should be able to do those calculations there. Everything is prepared for you regarding the signal generation (DAC) and signal acquisition (ADC). Also all the programing is done in python.

hope this helps

hutzlerlab
Posts: 4
Joined: Wed Feb 21, 2018 5:22 am

Re: Implementation of digital computation (curve fitting) followed by PID control

Post by hutzlerlab » Wed Feb 28, 2018 4:09 am

Yeah I am gonna give that a shot now, thanks. What is the difference between python commands through Jupyter and through SCPI?

amike88
Posts: 89
Joined: Tue Mar 29, 2016 7:41 pm

Re: Implementation of digital computation (curve fitting) followed by PID control

Post by amike88 » Mon Mar 05, 2018 10:42 am

There are a couple of differences:
  • Jupyter is running on RP
  • Jupyter supports more options where it comes to controlling RP, There are some limits on what can be done through SCPI.

dvc
Posts: 5
Joined: Sun Mar 04, 2018 6:45 pm

Re: Implementation of digital computation (curve fitting) followed by PID control

Post by dvc » Mon Mar 05, 2018 11:48 am

Hi,

> There are some limits on what can be done through SCPI.

Is the SCPI interface going to be supported in the future? Alternatively something like requested here [0] would also be nice. While scripting the redpitaya through python/jupyter is a really cool, I think that having a reliable way to get some measurements in a gui is also important. The webapps seem a little unpolished to me (scope isn't real time, etc.).

[0] http:forum.redpitaya.com/viewtopic.php?f=11&t=298

amike88
Posts: 89
Joined: Tue Mar 29, 2016 7:41 pm

Re: Implementation of digital computation (curve fitting) followed by PID control

Post by amike88 » Mon Mar 05, 2018 12:41 pm

SCPI is supported, however not all features supported on the hardware are supported through the SCPI interface. Also SCPI is much slower, than if you use jupyter.

Post Reply
jadalnie klasyczne ekskluzywne meble wypoczynkowe do salonu ekskluzywne meble tapicerowane ekskluzywne meble do sypialni ekskluzywne meble włoskie

Who is online

Users browsing this forum: No registered users and 24 guests