Microcontroller adjustable constant current PS - Page 1
Forum section: electronics / beginners

author: meisterlumpi
author_rank: Newbie
timestamp: October 02, 2016, 09:57:59 am
content: Hello everyone,I have four semi-active shock absorbers I'd like to control. They have a valve build in which regulates the fluid throughput (open valve -> soft dampers, closed valve -> hard dampers). The valve is an inductive load and its throughput is controlled by the current going through the coil (low current -> small opening, high current -> big opening).The current range is 0.3A to 2A (for each shock absorber) at 0V-1.5V. I'd like to be able to set the current in .1A steps and a precision in the ballpark of 0.05A or better. I want to use it in the car so input voltage would be 11.5V - 14.5V.The problem is, that the valve needs a current dither to end up in the correct position. Meaning the current has to oscillate with about 250Hz and an amplitude of about .2A. I want those values and the current itself to be adjustable via a micro or something.I'm looking for something that might do just that job or something easily modifiable.You can find lots of cheap const. current ps on ebay with adjustment potis (mostly LED drivers).. Would it be possible to modify those and hook up a micro for the current regulation? Would I need a feedback loop?

author: danadak
author_rank: Super Contributor
timestamp: October 02, 2016, 12:35:48 pm
content: You would need ~ a 6 bit DAC. A control loop, maybe PID, run byprocessor. That implies feedback of course.You can do all this and much more in a Cypress PSOC.Cypress PSOC has ARM core, A/D (SAR and DelSig), DSP, logic fabric that can be used ata GUI level or programmed in Verilog (much more important in future career), DMA, OpAmps,PWM, COM, onboard Vref......see attached "component" list. In PSOC a component is a pieceof onboard HW. PSOC has LUTs and basic gates, counters, shift regs....you can either configwith GUI tool or program in Verilog. Tons of training videos, tool has many example projectsolutions you can draw from. All components come with APIs you use in code to operate thevarious components.You can even design your own components, as well as program DSP engine in ASM to createhigh performance custom DSP designs. DSP is a separate core inside PSOC.Component list attached, as well as an example using DSP to filter a signal. Note this only useda small %age of the resources, eg. one could have added a lot more functionality to the project.Keep in mind you route the signals internally and to pins, with the GUI tool. its its ownbreadboard, FPGA like.SW tool free, low cost boards, $ 10 - $ 25.Regards, Dana.

author: kripton2035
author_rank: Super Contributor
timestamp: October 02, 2016, 03:19:37 pm
content: a microcontroler like pic or atmel will be too slow for a power supply feedbackthere are examples like here :http://www.tuxgraphics.org/electronics/201005/bench-power-supply-v3.shtmlbut they are known to be too slow for a PSwith an ARM like the post before, it should be faster.

author: JPortici
author_rank: Super Contributor
timestamp: October 02, 2016, 03:32:59 pm
content: sure, if you want to stick with a pic16f84apic16f177x has core independent peripherals, you can use it as a programmable smps controller (there's an app note for that)newest pic16 have ADC with core independent math package.. PID basicallythen there are dspicsbut it mostly comes down to your ability to code and expirience. if they are not that much you'd better go with an ARM or PSoC because with those you can use higher clock speed to compensate

author: Andreas
author_rank: Super Contributor
timestamp: October 02, 2016, 05:43:41 pm
content: Quote from: kripton2035 on October 02, 2016, 03:19:37 pmHello,even a PIC12F683 could do the job at around 250 Hz.It has a comparator with internal selectable 24 different reference voltages (upper and lower current levels).With the pin change interrupt you can switch the PWM output (bit-bang) and select the other of the two current levels.The setpoint can be given by a potentiometer.All you need additional is a external current sense amplifier like AD8203 or similar.with best regardsAndreas

author: danadak
author_rank: Super Contributor
timestamp: October 02, 2016, 10:30:37 pm
content: The Cypress PSOC has the additional advantage of DMA and Verilog design ofthe digital HW. So if you want a fully cpu-less solution, that can be done aswell by using the DMA, Verilog, and onbaord DSP unit.Regards, Dana.

author: kripton2035
author_rank: Super Contributor
timestamp: October 03, 2016, 05:55:24 am
content: an adjustable constant current PS can also be done without any microcontroler !

author: 2N3055
author_rank: Super Contributor
timestamp: October 03, 2016, 06:14:38 am
content: Quote from: kripton2035 on October 03, 2016, 05:55:24 amAnd much easier at those currents and power levels...OK question to OP:You gave current and voltage levels, dither currents, set level precision.. That's OK, but what is the dynamic behaviour of set current.. Or how quickly the current has to change after you give it a command, and is it going to be used in some kind feedback loop type closed system, in which case it has to have defined bandwidth..Is this some kind of vehicle suspension, maybe an active one ?

author: danadak
author_rank: Super Contributor
timestamp: October 03, 2016, 11:43:01 am
content: Some PID examples -http://www.cypress.com/documentation/application-notes/an66627-psoc-3-and-psoc-5lp-intelligent-fan-controllerhttp://www.cypress.com/file/137191/downloadhttp://origin-www.cypress.com/forum/psoc-5-architecture/all-analog-pid-control-implemented-psoc5Regards, Dana.

author: meisterlumpi
author_rank: Newbie
timestamp: October 03, 2016, 12:32:41 pm
content: Thanks for all your great replies.Dana, the Cypress PSOC looks really nice and versatile and I wanted to use an FPGA for something for a while now. I have little experience in that regard but the SW seems very beginner friendly.kripton2035, I rather have something more compact than a bench power supply. So definitely a switch-mode supply.2N3055, other than the dither, the supply does not need to be "quick". The constant current value needs to be adjustable but it does not matter if it takes 1ms or 2s to reach the set value. Yes, this is to control veh. suspension.The "which control device to use" discussion is very helpful and interesting but the passive part of the supply baffles me even more.I was hoping I could buy a constant current ps e.g. off ebay in a compact form factor and "hack" it. They often come with potis or buttons to set the CC and CV. Could they be replaced with a micro? Is the passive circuitry that controls the current output quick enough to handle the 250Hz dither and the .2A amplitude and what do I have to look out for. Should I use a separate current shunt for the loopback PID controller?These question probably depend on the specifics of the supply..e.g.http://www.ebay.de/itm/8A-Automatic-Constant-Voltage-Constant-Current-Step-up-Step-down-Charge-Module-/191911886107?hash=item2caed6fd1b:g:l-0AAOSwzJ5Xd3uUSomething I found was that almost all of those 5-10 bucks supplies only go down to 1.2V on the output (Dave explained why that is in one of his power supply design tutorials), I need something that goes down to at least .5V.Would you have suggestions what passive device I should base the project on?

author: 2N3055
author_rank: Super Contributor
timestamp: October 03, 2016, 03:23:00 pm
content: meisterlumpi,do the damper coils need to be grounded?If not, solution is very simple, won't cost much, and can be very good..In that case you don't need current source but 4 current sinks, 5V power supply, and source of 250Hz (i guess sinusoidal waveform is needed).If interested, we can develop it further...

author: Marco
author_rank: Super Contributor
timestamp: October 03, 2016, 03:31:56 pm
content: Quote from: meisterlumpi on October 02, 2016, 09:57:59 amHow much inductance does it have and how much resistance?The power developed in the internal resistance and flyback Shottky diode are probably enough to let the current reduce that much in 4 ms, but I wouldn't assume.