sinara-hw / Stabilizer

2-channel microcontroller servo with EEM and Ethernet based on STM32 CPU
Other
22 stars 5 forks source link

Firmware feature requests #3

Closed hartytp closed 5 years ago

hartytp commented 5 years ago

I'd like to see Stabilizer become a really nice lab tool for data acquisition, feedback, etc. The first version of the firmware will be very minimal (just a PI loop), but I want to start having a think about "killer features" that would be nice to have in the long run (pending securing funding for M-Labs/Quartiq or finding a student to implement them).

hartytp commented 5 years ago

A really nice use of Stabilizer will be combining it with a variety of mezzanines. e.g. the current stabilizer board we're already designing.

Another example could be a phase locked RF source. The mezzanine would contain VCO + phase detector. If one wants to be fancy, we could add the usual extras (pre-amp, attenuator, etc). It would only be a simple design -- just a handful of MCL bits -- but could be nice for things like fibre phase noise cancellation. Obviously, this could also be done by driving Urukul from Stabilizer using the EEM connector, but that may be overkill for some applications.

jordens commented 5 years ago

By "phase locked RF source", do you mean the same function that a PLL chip gives you, i.e. Mirny? Apart from things like integrator hold and more flexible software controls, that is.

hartytp commented 5 years ago

Yes, just a PLL with a digitally programmable LF.

hartytp commented 5 years ago

Anyway, even though one could do this kind of thing with Mirny in principle, it's nice to have the option of building a simple mezzanine card with some mini-curcuits bits that's tailored to a specific application such as fibre phase noise cancellation.

gkasprow commented 5 years ago

We can reuse verified design of WR-DDS board I designed for CERN some time ago.

gkasprow commented 5 years ago

I placed the CubeMX config file in the repo.

hartytp commented 5 years ago

One of the features I see for stabilizer is really good diagnostics. e.g. being able to get noise spectra for the locked system. I've hacked a proof-of-principle of that onto @jordens code here https://github.com/OxfordIonTrapGroup/stabilizer/tree/adc_log

The really killer feature for me is automated system transfer function measurement. e.g. finding the open-loop system poles so that one can design an appropriate compensator. I've had a go at doing that as follows:

Works nicely. Here is a simple test on HW. Configuration is:

Plot looks like this after DFT (y-scale in dB) tf

So...needs proper testing and some polishing, but seems to work quite nicely. That should make tuning up complex loops much faster :)

jordens commented 5 years ago

You may want to consider choosing the PRNG period properly and take samples for exactly that period. Then the PRNG noise is strictly flat, the ADC trace doesn't need normalization, the noise is much less, and non-linearities due to uneven power disappear. This worked really well for redpid. Nowadays with the benefit of hindsight, I would do it the way audio people do it with an exponential sweep. That has numerous advantages (works well with non-linear transfer functions, gives you extremely good inferred impulse response, even separated by response-order, has useful -- i.e. logarithmic -- power distribution accross the spectrum, much better signal to noise, works well at arbitrarily large modulation amplitudes even with nonlinear response as long as it is locked, etc. see the literature about it).

hartytp commented 5 years ago

You may want to consider choosing the PRNG period properly and take samples for exactly that period. Then the PRNG noise is strictly flat, the ADC trace doesn't need normalization, the noise is much less, and non-linearities due to uneven power disappear. This worked really well for redpid.

Nowadays with the benefit of hindsight, I would do it the way audio people do it with an exponential sweep. That has numerous advantages

Yes, I did consider things like that. This was intended as a simple PoC and a fun way of dipping my toes in rust (speaking of which, I was quite pleases when I realized I can do things like this with smoltcp https://github.com/OxfordIonTrapGroup/stabilizer/blob/a66670ee7b882070c62f4a98cc35e2fc6a500f20/src/main.rs#L669-L673 ). More the easiest than the best approach.

If someone can provide funding for implementing these things in a less hacky and more sophisticated way then that would be ace.