Help needed regarding programmable power supply(4x3 keypad & rotary encoder base - Page 1
Forum section: electronics / projects

author: SHARANYA
author_rank: Contributor
timestamp: November 19, 2017, 06:05:59 pm
content: Hi expertsI am currently building a programmable power supply based on atmega328p/dac8574(16 bit dac)/mcp3424(18 bit adc)/LT1013 op amp.The output range is 0-30v/0-4A.I burnt the INA169(1000mv/A) current sensor and currently using acs714(0.185mv/A).The CV/CC control part is totally based on analog electronics(LT1013 op-amp+some BJTs).By far,my setup is working correctly on the breadboard setup(except the precision of 2nd decimal digit on both the voltage & current range).Now,my main question is how to let the atmega328p know that the control part is in CV/CC mode?Is it by checking the voltage(both set & actual output) or by checking the current(both set & actual flowing) or by checking both?What is the general rule?Also,as far as i have understand,the LT1013 is not a very good choice for this control loop.Please suggest some good precision op amps which are generally used in this sort of application.Will OP295 be a good choice?(I have read in the datasheet that they are used in power supplies!)Also I added buffers previously (using LT1013 op amps) after the DAC & the current sensor INA169 to protect it's output.But there are significant change in the decimal digits (specially in lower range) of the output due to the offset error of the op-amp.So currently i removed the buffer.As for buffer choice,should I use AD8630 (as they have a ultra low offset error and they are rail to rail)?

author: pe6o991
author_rank: Contributor
timestamp: November 21, 2017, 05:15:08 pm
content: I don't see a reason why you use linear regulators instead of digital but ok.You can just tap the output of the CC op-amp with a RC-network to filter the voltage and feed it to a digital pin of the MCU(also you will need a voltage divider to lower the voltage if your op-amp is powered with a voltage higher than 5V).

author: void_error
author_rank: Frequent Contributor
timestamp: November 21, 2017, 07:08:05 pm
content: Quote from: SHARANYA on November 19, 2017, 06:05:59 pmHi, 'not an expert' here.It might be easier to use a comparator to check which loop is active, it will output high or low for CV or CC depending on how you set it up, but since I don't know how you implemented your control loops I can't tell.QuoteFor op-amps at least there's a trade-off between precision, speed, and low-price. You can only pick two. Something in your control loop will slow you down be it the op amps or series pass elements (in case it's a linear supply). In other words, assuming it's a linear supply, there's no need to use really fast op amps if your series pass transistor(s) can't keep up.More experienced members of the forum could give you a more detailed explanation.

author: duak
author_rank: Super Contributor
timestamp: November 21, 2017, 07:31:17 pm
content: Hello,I don't see the schematic you've used so it's hard to comment on the design. If it uses a voltage feedfack loop and a current feedback loop using some sort of clamp or selection logic to determine which loop is in control, the loop that is NOT in control will have its output driven to maximum. This can usually be detected by a simple comparator but in this case, the micro should be able sample the amplifier outputs of the two loops and determine which one is higher and thus not in control.The LT1013 is a good device and is free of many quirks such as polarity reversal under some conditions. It has an absolute maximum Vcc - Vee of 44 but it won't be able to drive the pass transistors without another voltage gain stage. I don't know how much accuracy, stability and precision you want or expect, but good supplies have been built with lesser devices and careful design. My only concern is that the LT1013 can be a bit slow and the transient response is not as good as it could be with a faster device. Note that slower devices can be stuck in a saturated state with their outputs at a maximum or minimum for a relatively long period of time. This is important when the power supply is changing from constant voltage to constant current and back again - you may get some very high voltage or current spikes during the transition.Cheers,

author: SHARANYA
author_rank: Contributor
timestamp: November 21, 2017, 08:19:13 pm
content: Thanks a lot for the nice explanation.Actually,i didn't draw any schematic still now that's why it is missing!sorry for that....I am trying to explain the control part as much as i can do for now.My control part is much similar to Dave's revc schematic.Except for the Lt3080,I am using two transistors in darlington pair(MJE15032 for driver & TIP35 as Pass transistor) for more current handling.The voltage feedback control is present after the emitter of the darlington(i.e at final output).I also tried to measure the output of the current controller op amp before the base of the 2N3904.(For 1A CC test).I am getting only 0.247v and the current is being controlled.Although when I am disconnecting the opamp output from the BJT base driving resistor 10k and crossing 1A current draw,The comparator is triggering & i am getting nearabout 31v at the op-amps output(I am feeding 33v for the op-amps).So my point is,it is very difficult to determine the mode by measuring the current controller op-amp output as the whole control is being executed in a very small amount of voltage change.(Because the 2n3904 is not even getting into full saturation).So,is there a way I can do it in software?And my aim is to be correct after two decimal digits.And please suggest some high speed op-amps that can handle 33-36v.I was thinking to use OP295.Is it ok?I am struggling with this project for a very long time!The CC & CV mode detection is only to update in the display.So if it's a few milisec delayed as compared to the main analog event,then there would be no trouble.But my main target is to detect it ASAP.

author: pe6o991
author_rank: Contributor
timestamp: November 21, 2017, 08:37:05 pm
content: since you mentioned dave's rev c shematic there is a current limit output for the MCU.If you look to the right of the PWM DAC you can see the current limit comparator and it splits into 2 transistors.One is for controlling the regulator and one goes to the micro.the micro probably has a internal pullup and thats how it knows if its in Constant current.I've posted a picture below.

author: SHARANYA
author_rank: Contributor
timestamp: November 21, 2017, 08:40:40 pm
content: .....missed that part.I will add that BJT and let you guys know the result!

author: SHARANYA
author_rank: Contributor
timestamp: November 21, 2017, 09:31:18 pm
content: One more thing i would like to ask!As described by duakQuoteI was testing if there is a voltage spike present when the current control takes place,I didn't find any spikes but instead,I saw that the whole output is oscillating during the current control loop!!The frequency is nearabout 1.5-1.9khz and Vpp is approx 282mV.How to overcome it??

author: pe6o991
author_rank: Contributor
timestamp: November 21, 2017, 10:22:52 pm
content: You getting oscillations because you don't use lt3080 but straight BJT's as you mentioned.In Dave's videos about designing a lab power supply he mentioned something about getting weird oscillations if you use only a comparator and a bjt.His recomendation was to add a small cap on the feedback.It's kinda late and my brain is not functioning correct but try to put a load on the power supply and see if there are weird stuff in CV mode.You didn't post any waveforms so i can't tell whats going on.Maybe some other minds can come and help.

author: SHARANYA
author_rank: Contributor
timestamp: November 23, 2017, 09:55:02 am
content: Ok...The oscillation is happening in the CV mode also.I conducted some tests by varying the current draw.The voltage was at 5v.1)NewFile0 is where the load is drawing 20mA.(Almost no oscillation)2)NewFile1 is where the load is drawing 500mA.(Oscillation freq is 38khz and range is less than 250mv pp).3)NewFile2 is where the load is drawing 1A.(Oscillation freq is 78khz and range is between 1v pp).Please take a look.I also tried some compensation cap of different values(10nF/40nF/100nF)between inverting input and the output.But no significant changes detected.

author: pe6o991
author_rank: Contributor
timestamp: November 23, 2017, 09:32:29 pm
content: Those oscillations look very square.Are you using the micro to set the voltage.If yes scope the CV op-amp non inverting input to see the voltage coming from the micro(maybe its noisy and causes oscillations).Maybe post a schematic to see how things are connected.Also your output filtering capacitance maybe low.Linear regulator usually have a bigger caps on the output.Another thing is to measure the input voltage noise and probably the op-amps supply.Do these things and post the results.

author: magtux
author_rank: Newbie
timestamp: November 24, 2017, 07:17:33 am
content: Have to tried a comparator between the CC and CV opamps before they go to the diodes. Cheap Power Supplies just use LEDs as the diodes for CC and CV.Like the LM358 in the below picture.http://i68.tinypic.com/16ae7np.png

author: SHARANYA
author_rank: Contributor
timestamp: November 24, 2017, 09:41:19 am
content: I am using a dac(DAC8574) to set the output.I hooked the scope to the dac output but found no oscillation!The main input voltage(from a 6A toroidal transformer) is filtered with a big 10000uF cap followed by a 4700uF cap.The op amp's supply is connected to that +supply rail via a LM317HV regulator(To supply 33v to the op amps).QuoteI am using only 1uF cap at the output.Just wondering,If this cap will slow down the whole control loop!Please suggest a suitable value.

author: pe6o991
author_rank: Contributor
timestamp: November 24, 2017, 02:45:53 pm
content: 1.Add a 100nf and a 4.7uF(10uF if possible) to the output of the LM317(if you already don't have)2.Add a 470uF(rough guess) and a 100nf capacitors to the main output of the voltage regulator3.scope the output again

author: SHARANYA
author_rank: Contributor
timestamp: November 27, 2017, 11:39:49 am
content: Sorry for the late replay!I added 470uF & 100nF cap at the output.In normal situation(load drawing almost no current),the voltage precision is getting off.The DMM(Fluke 87V) is showing 5.1v for 5V setting.I am getting this triangular waveform captured in NewFile7.This has a variation of 500mV.Now,When setted my dummy load at 3A,I am getting waveform captured in NewFile6.Although adding caps in the output limited the spikes from 1v to 500mv,but it is slowing down the control loop response when there is no/very little load connected.Any idea what to do?

author: SHARANYA
author_rank: Contributor
timestamp: November 27, 2017, 12:23:31 pm
content: I found another interesting thing!The cap c2(22uF) connected to current limiting BJT's Q2(2n3904) collector is causing the slow down problem.Whenever I am disconnecting the cap,the output voltage is getting 5.03v for 5v setting(.03v off due to no calibration of the DAC).Now there is another problem.Without this cap,the current limiting is not happening.For say,if i am setting 1A,the limit is happening at 1.3/1.4A.Another thing is,when i am increasing to draw current,I can hear a buzzing sound near the 1st power transistor.How the fix the current limit prblem?Should I add some RC fileter after the current limiting op-amp's output??

author: pe6o991
author_rank: Contributor
timestamp: November 28, 2017, 12:22:26 pm
content: Yes the cap will slow down the loop but it shouldn't be there since you are using a bjt instead of lt3080.I don't know if you just copied dave's circuit and just replaced the lt3080 with a bjt or designed a different circuit.If you just replaced the lt3080 with a bjt then its wrong because the CV part is inside the lt3080 and the first op-amp(in dave's circuit) is just an amplifier not a CV loop.Unless you post your schematic i can't help you anymore.The pictures you posted are normal.The waveform should be sawtooth(ish) and the ripple will decrease if the loop frequency increases.The voltage offset can be fixed in software.

author: SHARANYA
author_rank: Contributor
timestamp: November 28, 2017, 04:20:51 pm
content: I started another thread named "Oscillation in CC mode of programmable power supply" as the whole issue is different now.I added the schematic there.Please take a look!

author: David Hess
author_rank: Super Contributor
timestamp: November 30, 2017, 01:43:44 pm
content: I would use emitter followers between the two operational amplifier outputs controlling current and voltage mode to create a ground referenced signals indicating current or voltage mode; this is essentially free if these transistors are already in place to buffer the operational amplifier outputs for greater precision.Or I would insert optocouplers in series with the operational amplifier outputs to do the same thing but with convenient floating digital outputs. The later is how many power supplies like this drive current and voltage mode indicator LEDs.Or combine both of the above for precision and floating digital outputs.