Fastest way to run a software feedback loop?

I have an interesting idea for improved temperature control. I'll test it out with an analogue feedback loop, but just for future....

Say I want to make a feedback loop that has both high resolution and high speed, e.g. 100 kHz bandwidth, maybe 300 kHz update rate or a bit faster. (The critical dimension is small, so it can be fast.)

I'm willing to devote a whole small uC to the job. Control needs to be on-off, because I want to use a small FET to control the heater. The ideal case would be one uC, a resistor bridge, a bypass cap, and a FET.

What's the best s/w architecture for this? 4-bit PWM with delta-sigma? Any other pointers?

Thanks

Phil Hobbs

--
Dr Philip C D Hobbs
Principal Consultant
ElectroOptical Innovations LLC
Optics, Electro-optics, Photonics, Analog Electronics

160 North State Road #203
Briarcliff Manor NY 10510
845-480-2058

hobbs at electrooptical dot net
http://electrooptical.net
Reply to
Phil Hobbs
Loading thread data ...

4-bit pulse width modulation doesn't give you particularly fine control of heater power. The thermal time constant of the element you are heating is often a few seconds or longer, and it could make sense to have relatively long "on" and "off" heating periods which you can define to ten or twelves bits. The proper solution is probably to use the technique employed in sigma-delta converters which combines high resolution with the minimum of low-frequency hash.

My milli-degree temperature controller paper - I think you've got a copy - talks about yet another way of combining low ripple with high resolution.

-- Bill Sloman, Nijmegen

Reply to
Bill Sloman

Loop cutoff frequency < loop delay/4 Loop delay = ADC conversion delay + PWM update delay + processing. Slow.

300kHz is pretty much out of league of small MCUs.
100kHz BW for the heater???? What is the thermal time const?

The

What are you really trying to accomplish?

Vladimir Vassilevsky DSP and Mixed Signal Design Consultant

formatting link

Reply to
Vladimir Vassilevsky

Thanks, that isn't quite what I'm looking for.

It's the delta-sigma that gives the fine resolution, as in 1-bit audio ADCs--using the timer just gives the CPU time to do other things such as read the comparator and update the register. I know how to do that, I just don't know what the _fastest_ method is.

The high bandwidth gives me lots of loop gain at low frequency, which is what I need to reject thermal forcing at lower frequency.

Cheers

Phil Hobbs

--
Dr Philip C D Hobbs
Principal Consultant
ElectroOptical Innovations LLC
Optics, Electro-optics, Photonics, Analog Electronics

160 North State Road #203
Briarcliff Manor NY 10510
845-480-2058

hobbs at electrooptical dot net
http://electrooptical.net
Reply to
Phil Hobbs

That's sort of what I was afraid of. How fast can I actually go?

Effectively just the thermal mass of the heater itself, which is very small. Getting ultrafast thermal response is the key invention, but I haven't filed a patent on it yet--I'll happily explain once that's done, because it's a neat hack.

Just what I said--using a magic, essentially infinitely-fast heater to run a very fast thermal control loop. Bandwidth is limited by thermal diffusion, so it isn't really a time constant problem (i.e. it isn't even approximately a one-pole response).

Thanks

Phil Hobbs

--
Dr Philip C D Hobbs
Principal Consultant
ElectroOptical Innovations LLC
Optics, Electro-optics, Photonics, Analog Electronics

160 North State Road #203
Briarcliff Manor NY 10510
845-480-2058

hobbs at electrooptical dot net
http://electrooptical.net
Reply to
Phil Hobbs

If power is low and you can use fast switches, the cool way to do this would be in a small FPGA or CPLD, with seriously fast 1-bit delta-sigma output. The power drivers could be some screaming TinyLogic parts, or a small fast mosfet, or even just a bunch of FPGA pins in parallel. The d-s clock rate could be 100 MHz if you like. Or

200.

Some of the Atera "cpld" parts are really small FPGAs with flash for the configuration storage. They could do PID+D/S easily.

Rob has VHDL for delta-sigma converters. PID is easy in an FPGA... we run PID control loops at 40 MHz.

John

Reply to
John Larkin

I'll second Vladimir's opinion, this is pretty much out of league for a uC. Unless it's maybe one of those screaming turbo-charged 100MHz 8051 variants but even then it's tight.

Have you considered a DSP? Those don't cost much more and have tons of math horsepower for the loop filters and stuff. If it absolutely has to be a uC for some reason consider wave digital filters (WDF). But that'll be quite a steep learning curve.

--
Regards, Joerg

http://www.analogconsultants.com/
Reply to
Joerg

We use an LPC1754 ARM processor, which will clock at 100 MHz. It's a

32-bit RISC so has a lot more horsepower than a 100 MHz 8051. It wouldn't be unreasonable to run a decent PID iteration at 500KHz maybe; we do far more complex stuff, including PID and a lot of logic and filtering, in a few us. But the delta-sigma bit rate would be low.

As Phil suggests, there is probably some hybrid of d-s and PWM that would work better at low update rates and use on-chip uP resources.

I'd vote for doing this in an FPGA.

John

Reply to
John Larkin

Hmm. I was thinking about something quite a bit simpler than that, e.g. sampling the comparator output and adding or subtracting something from the delta-sigma accumulator, then stuffing the MSBs into the PWM register--sort of like a tracking ADC, probably with a constant or maybe a two-speed slew rate.

I don't need a really big slew rate, just high bandwidth, so I can maintain the control range.

The alternative is to run a very very fast thermostat.

Cheers

Phil Hobbs

--
Dr Philip C D Hobbs
Principal Consultant
ElectroOptical Innovations LLC
Optics, Electro-optics, Photonics, Analog Electronics

160 North State Road #203
Briarcliff Manor NY 10510
845-480-2058

hobbs at electrooptical dot net
http://electrooptical.net
Reply to
Phil Hobbs

I've done something similar using a laser diode to target a phosphor dot at the end of a fiber with a 7 micron core. Very little thermal mass there. The laser is pulsed and the optical phosphorescence returns the temperature when the laser is off for closed loop control. Very fast control used in bio-research, locally. This was almost a decade ago.

You doing something similar?

Jon

Reply to
Jon Kirwan

Thanks. If we wind up doing any stabilized lasers together, that might be an excellent approach, but it's outside my comfort zone on this one, on account of the time required to come up to speed.

I'm doing it on spec as a possible licensing candidate. Selling my time is fun for now, but eventually I'd like to have a bit more scope for longer-term stuff, and getting a bit of recurring revenue is the key to that.

I might run a fast thermostat using the built-in comparator, with the uC dorking the setpoint, but I'll have to try that out.

The nice thing about thermal diffusion is that it asymptotically gives a

1/2 pole response (45 degree phase, 1/sqrt(f) rolloff). That way I can just run a one-pole loop filter and not have to worry about stability.

Cheers

Phil Hobbs

--
Dr Philip C D Hobbs
Principal Consultant
ElectroOptical Innovations LLC
Optics, Electro-optics, Photonics, Analog Electronics

160 North State Road #203
Briarcliff Manor NY 10510
845-480-2058

hobbs at electrooptical dot net
http://electrooptical.net
Reply to
Phil Hobbs

Are you going to sense the temperature error with just a comparator, not an ADC? In that case, a thermostat may be as good as a fancy algorithm.

You could digitize the temperature error and do a real PID. The LPC1754 that we use has a 12 bit ADC and a 10 bit DAC and a bunch of PWMs, all for under $5, batch programmed and laser marked by a distributor, jtag reprogrammable any time.

It could digitize and run the PID at 200 KHz (that's the max rate for this chip's ADC), and poke a new 4-bit PWM setting every shot, with some sort of delta-sigma algorithm determining the PWM values. Sounds feasible. There are probably other uCs with faster ADCs.

A small FPGA and a tiny SPI serial ADC would be nice.

John

Reply to
John Larkin

I've just been playing with a cortex M3 part, the STM32F2. It can run at

120MHz, and can toggle an I/O *in software* at 60MHZ! An IRQ takes less than 1us, including the context save, ISR and the return.

There is a just-released cortex M4 version with DSP instructions and a floating point unit. This runs up to 168MHz (STM32F4). But it doesn't sound like a lot of complicated DSP math is needed here.

These parts might be a bit big for the application (>=64 pins) and of course there is a learning curve. But if there is going to be a microcontroller running the rest of the instrument anyway it could be a possibility. It could run the temperature controller as the highest priority IRQ.

--

John Devereux
Reply to
John Devereux

We have recently been introduced to a really smart, really fast FPGA consultant who is working with Rob on the bigC project. I can connect you up if you are interested.

You are welcome to Rob's delta-sigma VHDL, or to the source of our ARM pid control app in C, as a starting point.

*IF* you don't have a lot of lag in the temperature sense loop. If the feedback is optical, that's great.

John

Reply to
John Larkin

est

be

e
.

ma?

l
.

I don't see any problem doing it with a PIC32. It can sample 10 bits at 1MSPS and toggle I/Os at 80MHz. At long as you are not doing anything else, it can easily handle a 100KHz loop.

Reply to
linnix

It's fairly easy to make a PID control (analog) to get very good accuracy, but the P, I, D coefficients may be hard to optimize aforehand. So, if complexity isn't terribly bothersome, a slow CPU can monitor the temperature from second to second, and compose the best coefficient values. Then, something with multiplier function (maybe LM13700, there's two multiplying circuits in each) is programmed with the best coefficients for the observed changing conditions.

The A/D conversion step in a micro is usually not terribly prompt or precise, but analog parts give you those features nearly free. It's like having conscious control over your legs, yet basically just standing up under conscious control, and then letting primitive reflexes keep you balanced there.

Reply to
whit3rd

I had an idea for a really tiny electron source for a cheap SEM, high-school-lab sort of market. It would be a fiber-coupled laser with the fiber tapered down really small at the end, coated with a photocathode material. The numbers looked OK. An SEM doesn't need a lot of beam current.

John

Reply to
John Larkin

The processing will take ~100 instructions. The AVR is the fastest general purpose small MCU (leaving aside crazy architectures like Scenix/Ubicom and state machines on chip like HC16). AVR can run at 20 MHz. With 1.5 clocks per instruction average, that makes 133kHz. This is ballpark; although the actual numbers could be different by a factor of two either way, it tells that there is no headroom.

Vladimir Vassilevsky DSP and Mixed Signal Design Consultant

formatting link

Reply to
Vladimir Vassilevsky

I'd be careful, don't maneuver yourself into a corner. Murphy says that the point where one detects that a more complicated filter is needed for system stability is a few hours after a board is ready and stuffed. And then it doesn't fit into the processor. A subclause of Murphy's law says that the next bigger uC is not pin-compatible.

As John pointed out, the boundaries between DSP and uC are blurring a bit these days. You can get very fast hardware if you are willing to spend $5 or a litte more. That's also roughly where reasonable DSPs start but they often come without peripherals.

--
Regards, Joerg

http://www.analogconsultants.com/
Reply to
Joerg

st

be

a?

something like an stm32f2xx might do it, 120MHz ARM, 120MHz timers,

3x0.5us 12bit adc

-Lasse

Reply to
langwadt

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.