DSP digitally controlled dummy load ? - Page 1
Forum section: electronics / projects

author: Spikee
author_rank: Frequent Contributor
timestamp: June 29, 2015, 10:21:39 pm
content: Hello everybody,I recently finished my course in DSP and that got me wondering.Could one (reasonably) replace the feedback opamp of a constant current load and replace it with digital control (via some digital control loop)?Design would look something like this:Input: Voltage and load currentOutput: Voltage to buffer opamp to fetConstant current, constant voltage, constant resistance modes via change in digital control loop.Control loop would be running on a Ti C2000 or the like processor with an RTOSI already know how to make an analog version of a current/resistance load but I would like to learn how to use digital control loop and dsp in practice.I have googled a bit but could not find relevant information concerning digital controlled dummy / constant current loads.Anybody home in signal processing and digital control loops that could point me in the right direction?Thanks

author: nctnico
author_rank: Super Contributor
timestamp: June 29, 2015, 11:12:35 pm
content: You can apply analog control loop theory. But be aware that A/D D/A conversion and processing add a delay.

author: Spikee
author_rank: Frequent Contributor
timestamp: June 29, 2015, 11:28:20 pm
content: I'm aware that sampling and processing will add a delay. That's why I'm looking at DSP specific processors to try to keep it to a minimum.What kind of control loop speed should I thinking off?One design i quite like is the one from Kaktus circuits The Mightywatt.It uses the TI INA214 for current measurement and a TI TLC2272 opamp. It seems to work quite nice.The Bandwith of the INA214 is not that super high:Schematic is here:https://drive.google.com/folderview?id=0B7G3xJXZNLUpfmw5WGVoRXpHOE5iOGFaZk5jRTEwTkRGRERMTFk4c2oweU9tSWw4TGdRTzg&usp=sharing&tid=0B7G3xJXZNLUpfnVWSEF0VTA3WkxmOUZ6U2pOcVNRdFloU2d0UzdjeE5NdHU3R0FZb3NNR2cIn my design I will probably use higher speed ADC's and (PWM?)DAC for DSP purposes.While I have had PID and FUZZY as a uni. course and also as lab course it is quite a step when wanting to apply it to something "real".Thanks for the tip.

author: c4757p
author_rank: Super Contributor
timestamp: June 29, 2015, 11:33:07 pm
content: There isn't much need to keep it to an absolute minimum, DC loads don't tend to have really high bandwidths anyway. But you need to factor the delay into your loop compensation calculations.Work with the delay, not against it.

author: NiHaoMike
author_rank: Super Contributor
timestamp: June 30, 2015, 05:36:58 am
content: It can be done, but makes no sense unless you're trying to emulate a particularly complex load. On that note, take a look at MPPT controllers. They're basically regenerative loads that try to draw as much as possible from some solar panels.

author: Jeroen3
author_rank: Super Contributor
timestamp: June 30, 2015, 05:47:31 am
content: You shouldn't make the gate controlled by a digital process. Too slow. I used an INA shunt amplifier in the loop and I had to slow the process down a lot.You can use the digital process to control the current setpoint for the analog loop.Switch shunts using some fets to have adjustable current range.

author: Spikee
author_rank: Frequent Contributor
timestamp: June 30, 2015, 09:19:58 am
content: This will be more of a learning exercise. I have built my own digitally controlled fully isolated DC load before but I would like to try it in the digital domain.By removing the INA current monitor in the design I linked to and add my own differential shunt monitor circuitry would remove that slow down in the control loop.I suppose I have to play around in mathlab a bit to try a few different things.

author: tszaboo
author_rank: Super Contributor
timestamp: June 30, 2015, 09:34:38 am
content: Yes, it is quite possible to replace a ~1EUR opamp with a quite fast DSP an ADC and a DAC. You are going to need a lot of bandwidth, otherwise the entire system will oscillate. I'm not sure why would you do that, considering it will cost you like 25 times as much, but it is possible.

author: Spikee
author_rank: Frequent Contributor
timestamp: June 30, 2015, 10:03:04 am
content: Commercial systems seem to have a bandwidth of 20Khz. That seems reasonable.Edit:I did some measurements in ltspice and it seems the bandwidth of the control loop is quite a bit higher.With a lm324 with a bit of filtering the bandwidth was around 1Mhz which is quite high.Using a digital process to control the setpoint of the analog loop would be a more reasonable approach.

author: LDM
author_rank: Contributor
timestamp: June 30, 2015, 11:25:42 am
content: For a project to play around with DSP this could be quite fun. I'd say go for it! Fully understanding the circuit through simulation would be the way to go though, since it would be a bummer to design the thing and find it can't work as you want it to due to a rather large delay. I agree with you thatQuote from: Spikee on June 30, 2015, 10:03:04 amSomething like a multiplying DAC (MDAC) could be fun to play around with in this case.

author: Spikee
author_rank: Frequent Contributor
timestamp: June 30, 2015, 01:46:35 pm
content: Had a short twitter convo. with the c2000 launchpad creator , he said this is definitely possible.Off to simulate some stuff in matlab.

author: Kalvin
author_rank: Super Contributor
timestamp: June 30, 2015, 02:15:50 pm
content: Quote from: NANDBlog on June 30, 2015, 09:34:38 amUsing an eval kit will cost quite a lot, like you stated. However, there are quite a few DSP-microcontrollers with integrated ADC, DAC and op amps available in very low price range. For example, Microchip has a range of PIC24F and dsPIC33E controllers available in hobby-firendly PDIP-28 package running from 16 MIPS up to 70MIPS containing ADC+DAC+op amps. Depending on how fast the control loop needs to be, the PIC24F or dsPIC33E may be sufficient to run a PID fast enough. TI C2000 series fixed point and floating point DSP-microcontrollers offer faster speed but they are available in LQFP packages which are not as hobby-friendly as the Microchip's. Possibly the TI C2000 require external op amps too.I wouldn't bother using any RTOS since the application is so simple: The main program loop will typically be an idle loop and the signal processing will take place in the interrupt handling routine. The main program loop will run whenever the interrupt task is not running, so it can talk to the UART or push buttons or whatever as a background task.

author: Spikee
author_rank: Frequent Contributor
timestamp: June 30, 2015, 02:20:57 pm
content: I have done LQFP before (reflow and p&p) so that is not the issue. Ti guy told me RTOS is possible but you kinda need to know what you are doing so you don'tsome shit up.Price is also not an issue. Kinda trying to figure out how to do this. Need to find some time so I can test in mathlab with some control loop evaluations and simulations.I have used Cypress, Atmel, Pic parts before but TI not that much. Went to multiple seminars of TI and they have great application support.So I really should give those parts a chance.

author: Kalvin
author_rank: Super Contributor
timestamp: June 30, 2015, 02:54:30 pm
content: Quote from: Spikee on June 30, 2015, 02:20:57 pmIf you need to run multiple tasks in addition to the interrupt-driven control loop, a simple co-operative schduler might be all you need:http://petevidler.com/2011/03/simple-co-operative-scheduling/Each task will be a (simple) state machine which will be run by the scheduler. The scheduler will call the task's entry function, the ftask's entry unction will execute the task's state machine and return back to the scheduer as fas as possible.Should the task require any busy loops or polling, those busy loops and polling will be implemented as a states in the task's state machine, so no task will block other tasks:http://petevidler.com/2011/03/handling-delays-without-blocking/.There will be one high priority real-time, interrupt-driven "task" which will interrupt the scheduler or any task running and execute the control loop at the sample rate.

author: nctnico
author_rank: Super Contributor
timestamp: June 30, 2015, 02:57:36 pm
content: I agree. Do all the signal processing inside the interrupt. Doing this in the main application requires buffering and increases the delay between input and output.

author: f5r5e5d
author_rank: Frequent Contributor
timestamp: June 30, 2015, 03:28:40 pm
content: its really unavoidable to get to a level of competence in analog feedback theory - should be able to write the equations for popular op amp active filters, calc frequency/phase response - including op amp limited GBW, excess pole phase shift...know about gain intercept frequency, gain and phase margins, how much you need how to change which circuit parameter(s) to fix - "Classical" frequency response Bode and Root Locus at leastthen you can rely on some "rules of thumb" - with > ~20x sample rate over your system gain intercept it is usually possible to mostly ignore added digital delay unless you're doing something silly like FIR filter, Delta-Sigma ADC or DAC or have a "plant" with severe resonances beyond your control loop bandwidth - like mechanical systems with bending modes...you really need the analog control at the interfaces anyway - its better to use local analog domain feedback to say control a current servo loop with a control voltage from the DAC rather than drive the gate, try to invert the (poorly known, varying) nonlinear gm curve of the MOSFET directly from the DSPso the best advice I know for digital feedback control is to learn analog feedback control 1stand a further practical point is that "DSP" optimized FIR pipelining, SIMD is next to useless for control - you will be doing at best a few IIR biquads per loop - moving data in irregular fashion - so FIR MIPS really is a poor metric for digital control