Understanding current sensing in a power supply - Page 1
Forum section: electronics / projects

author: Atom
author_rank: Regular Contributor
timestamp: March 28, 2018, 08:45:43 am
content: So here i am again searching around the internet for a suitable lab power supply. And i've might found ithere it ishttps://wahz.blogspot.it/p/lab-power-supply.html?showComment=1522053580592so i've pretty much understood it, right now i've finished to assembly it on a breadboard and after a little bit of troubleshooting on the votage side everything was working even the current limiting is working but there is a thing that i can't explain..int theory everything is right on the current side of thinghs butin reality is not.1. U8 the ltc2050 is amplifying the max 50mV across the shunt by 100 times so you have 5-0V.2. U1C is a buffer so nothing appens3. U1B is comparing the Iset 0-5V signal with 0-5V signal from the shunt.4. the voltage on the output of U1B will decide if the opamp is sinking orn not current from the base of the transistor.5. if i drain current from the base of the BC847 it will start to turn off turning off the mosfet by decreasing the voltage on it's base.PROBLEMS1. in a first testing phase i was using an IRFP240 mosfet, the voltage on the output of the psu couldn't go under 13V, (i bought the IRFP240 at a local electronics fair).I swapped out the IRFP240 for a IRFP450 (this one is surely legit, bought from Mouser), a lot of stability problemswere resolved and the psu could go down to 3V, there is a little overshoot 30/40mV on the output when i attach a 2A load, maybe because i'm on a breadboardso why is that is the IRFP450 mosfet fake? i've also other mosfets but since i don't know if they could work in a linear application i didn't test them:ST w14nk50zfairchild fqa9n90ctoshiba k2749 / k1341but as far as i can understand they are suited for switching application.PROBLEM THAT I COUDN'T FIGURE OUTfor the voltage shunt amplifier part i've tried OP177 / OP275 /NE5532 and OP184, only the last one works.i'll suddivide the two cases.OP177 / OP275 /NE5532the output of the op amps (U8) is ranging from 8 to 12V even if there is no load attachedso there shouldn't be voltage across the shunt ... but the output of the op amp is highthe output of the power supply isn't turning on 30mV. probably because the comparartor of the current is keeping 1 volts on the output, draining current from the base of the transisitorOP184initially the output is 5mv that's ok considering that i'm on a breadboard and thet i'm using juper wires for sensing the voltage drop.the strange things happens when i attach a load to the psu the output of the op amps goes to 12V , if i remove the load it's stays there fixed at 12V and if i reconnect the load, let's say a 2 amp load the voltage goes from 12 to 12.3Vthe voltage of U8 shoudn't return to nearly zero when i disconnect the load ? because there isn't a voltage drop on the shunt resistor? so why does it stays to 12V???IMPORTANT the shunt was changed to a 30mOHM one and the gain of the amplifier set to 34 R24 = 10ohm R25 = 330ohm GAIN = 1+(330/10)=34max voltage drop across shunt 30mV/A ____at 5A 150mv drop. 150mV*34 = 5,1V close enough for experimentationthanks to every one that will respond

author: Atom
author_rank: Regular Contributor
timestamp: March 28, 2018, 08:48:25 am
content: there you go a more visible schematics

author: xavier60
author_rank: Super Contributor
timestamp: March 28, 2018, 12:30:40 pm
content: All of the op-amps in the current section need to have an input common mode range that includes ground rail voltage.The OP184 should be suitable. Do you have its inputs swapped? It seems that you have positive feedback.

author: Atom
author_rank: Regular Contributor
timestamp: March 28, 2018, 05:47:20 pm
content: no, checked the inputs they 're not swapped. look what i've found ...so when there is no load attached the opamp on the output has 10mV thats ok i'm on the breadboard, but when i attach a load i see the dc voltage fos let's say 1 second then that dc voltage becomes the thing in the photo...is the op amp self oscillating or something like that?

author: Atom
author_rank: Regular Contributor
timestamp: March 28, 2018, 06:01:41 pm
content: Whatching with the oscilloscope i discovered that the current sensing works for the 1 or 2 times that you connect a load, then starts that weird oscillations.it seemed also that the auto oscillating thing is more probable at higher voltages (voltages set on the output of the mosfet) if that can help to tackle the problem.

author: blackdog
author_rank: Frequent Contributor
timestamp: March 28, 2018, 06:36:59 pm
content: Hi,This schematic is asking for trouble...A few points, but I am not going to change the whole schematic, is too much work.1eThere is no resistance directly at the gate of the Mosfet, this is a beginner's mistake.2eThe current loop has three opamps in series, how unstable you want it to be....3eOpamp U1C is total nonsense, the only thing it does is to create even less phase margin and there was already so little by this design.4eI do not understand U8 and the power supply's, why sens in the ground wire...5eWhere are the output capacitors? this is a very strange way of drawing a schematic, so unclear.So, you need sufficient phase margin, if you need a good and stable power supply.If you ignore these necessary characteristics, then you have a random generator on your workbench and not a power supply.Here is a document that describes phase margin and gain margin, happy reading!www.bramcam.nl/Diversen/Gain-Phase-Margins.pdfKind regards,Bram

author: Atom
author_rank: Regular Contributor
timestamp: March 28, 2018, 07:18:32 pm
content: 1e added 10k + ferrite ring to the gate of the mosfet2e i'm a student and a beginner this thing isn't clear to me,you could remove the buffer opamp on the current side but i don't know what kind of results you could have ?a better response time? or what else?3e again i'm not familiar with the phase margin , if you can explain it with few words, then i will read the document that you linked.4e do you suggest an high side sensing of the current ? i could use a differential amplifier to sense the drop across the resistance5e added a 47/100 uF output cap , it's not my own desing i wouldn't be able to go this farCHANGESthe resistors one the shunt voltage amplifier were changed to 100ohm and 3.3k maintaining the gain of 33+1=34, the opamp seems to be fine now, i've also added a small cap on the output of the op amp. before with the 10ohm and 330ohm resistor the 330 one was getting very hot, maybe that vas causing the unstability of the op amp?Bram, i've learnt a lot of things while making this power supply, but it' seems that this desing is unstable ? so do you have any kind of schematichs of a good lab power supply for a beginner ?cheers

author: blackdog
author_rank: Frequent Contributor
timestamp: March 28, 2018, 07:48:20 pm
content: Hi Atom,It takes a lot of time to explain everything, I don't have that time...Read the document, extreemly important!But for short, every active part you insert into the U or I loop will slow down the signal, so wil make the phase margin smaler, so more instability.3 opamps in one loop = horrorIt can be done, but that often results in a slowly reacting loop.But one of the most inportant thing is this =>i've learnt a lot of things while making this power supplyKeep studying!Do not spend time on digital control, learn about gain and phase stability, this is verry important in electronics.If you do not have a stable U and I loops, then why is the digital control necessary, this is trowing away time?Focus on the importend parts,Number-1: I and U loop stability at low current, high current, low voltage and high voltage!And if all is well with the U and the I loop, start with the digital control of the power supply.Maybe it is better that you wil start a "simple design" like this one from linear:http://www.linear.com/product/LT3086Kind regards,Bram

author: Atom
author_rank: Regular Contributor
timestamp: March 28, 2018, 08:05:41 pm
content: i am by no means an expert but i think i've passed the LM317 phase and that's why i'm trying to understand those things.i'm still confused and i've lot to learn, wanna see something funny?i've set the output voltage of the psu at 22v, loaded with 11 ohms resistor, and when it was loaded like that i tried to put a 4700uF cap across the load resistor, lookBlue trace output of the power supply, yellow trace shunt voltage amplified. but maybe i'ts because it's all on the breadboard.

author: Atom
author_rank: Regular Contributor
timestamp: March 28, 2018, 08:10:07 pm
content: Bram sorry for bothering you but what do you think of this power supply instead? it was made from peter oakesi've even bought some IXYS linear mosfet for this, i can't stop now

author: blackdog
author_rank: Frequent Contributor
timestamp: March 28, 2018, 08:22:30 pm
content: Hi Atom,Take a look at my design, it is fast stable and low noise... if you build it welhttps://www.eevblog.com/forum/beginners/how-does-blackdog's-psu-work/25/Bram

author: Atom
author_rank: Regular Contributor
timestamp: March 28, 2018, 08:30:54 pm
content: well well well it's seems that i have something to studylet's give it a tryeven the guy that made this psu used the "blackdog" psu so it should be a very good desingthanks

author: prasimix
author_rank: Unknown
timestamp: March 29, 2018, 10:50:52 am
content: Quote from: Atom on March 28, 2018, 07:18:32 pmIf you are looking for digitally controlled one,hereis what I found so far.

author: tombi
author_rank: Regular Contributor
timestamp: March 29, 2018, 12:53:56 pm
content: Hello,Yeah that is my design. Clearly electronics is not my day jobI designed this thing for fun and learned lots but clearly not everythingA few clarifications - there is a 2.2uF capacitor on the output but that gets loaded on the back of the banana plugs and I didn't figure out how to put it in the KiCAD schematic without putting it on the PCB.. Sorry about that!The reason for the buffer in the current control loop was that I found the input impedance of the current control amp was messing with the the shunt amplifier. Yes the current control loop is pretty slow but the LTC2050 is pretty slow anyway. It takes about (can't remember exactly) 100-150us to current limit when you short it.I've attached an LTSpice schematic I used when working on this - it's been a while so it might not be the latest. You could try substituting parts in there to see what happens. There is some cruft in there like parasitic resistance and inductors to see how it would behave.Rather than just build (or buy) someone else's design I decided to build one for fun. Whatever design you decide to build I suggest building it piece by piece. For example kick out the differential voltage sensing and even the current loop to begin with and just see that you can control the voltage and react to changes in load without oscillating. Then add in other sub-systems.The other thing I would suggest when working on this is star-grounding off one spot (I used the negative end of the current sense resistor). I went down lots of rabbit holes to find my problem was just the resistance of my breadboards/wires. It might even be worth loading the high-current stuff on vero-board.I used Blackdog's SCR/MOSFET pre-regulator but I changed it a bit. I added current feedback so it increased the pre-reg voltage as the current increases. Otherwise I needed to keep 5V above the output to ensure it could meet the max current requirements which negated the benefit of the pre-regulator. This means it can get caught with its pants down for a cycle but it sorts itself out quickly.Hope this helps,Tom

author: Atom
author_rank: Regular Contributor
timestamp: March 29, 2018, 11:04:08 pm
content: thanks for the spice model , right now i've oredered some opamps because the ones that i have now aren't that fast and maybe they couldent be suited for this kind op application.maybe the oscillations where happening becausei'm on a breadboardand was using ameanwell 32V 11A switchmode psu as the main source for the mosfet....so maybe it was the switchmode power supply itself that was oscillating. thanks to everyone,the op amp that i was using was an MXL1014, yeha it's old but it's the only one that in a quad configurations, other than the lm324i'm still here if someone has some rather simple desing to share let's say 30V 3A or even 20V 3A

author: Atom
author_rank: Regular Contributor
timestamp: March 29, 2018, 11:07:52 pm
content: Quote from: prasimix on March 29, 2018, 10:50:52 amwell i've already seen that psu, it's fantastic , the problem is it's complexity and it would take years for me to source all the parts.

author: xavier60
author_rank: Super Contributor
timestamp: March 30, 2018, 03:18:44 am
content: Quote from: Atom on March 29, 2018, 11:04:08 pmI'm experimenting with a MOSFET design of the type that has the +/- control supply rails referenced to the + output. I have made some minor changes since I last posted the schematic,https://www.eevblog.com/forum/projects/lab-power-supply-the-lost-current/msg1441016/#msg1441016mainly changing to TLC072 op-amps.Because I don't like using Potentiometers as Variable Resistors, the circuit ended up needing negative reference voltage, not a real problem. The purpose of the unusual circuitry at the output on the CC op-amp is to speed up the overload response, it can be omitted.It ran well when it was on a breadboard. I had the MOSFET and surrounding components soldered directly together at the heatsink to reduce the chance of instability.The circuit turned into a monster when I added another four op-amps for future interfacing to a micro-controller. I will not be showing this, the analog core circuitry remains the same.

author: prasimix
author_rank: Unknown
timestamp: March 30, 2018, 06:15:44 am
content: Quote from: Atom on March 29, 2018, 11:07:52 pmTake another look, I sent you link to the more then dozen of other DIY PSU designs not mine (i.e. EEZ H24005).

author: Atom
author_rank: Regular Contributor
timestamp: March 30, 2018, 03:26:11 pm
content: Thanks i did not saw all the other projects, by the way digging through the internet i found another power supply project, it uses transisistors and there is a costant current source feeding into the base, then the 2 feedback loops cv and cc drain current from the base making the current / voltage collapsing ....the same thing that the peter oakes psu didhttp://www.paulvdiyblogs.net/2017/07/my-new-power-supply-design-project-part.htmlWhat do you think about this desing ?

author: Atom
author_rank: Regular Contributor
timestamp: March 30, 2018, 08:21:13 pm
content: well, i mentioned that i was using a 32v meanwell switchmode psu, right now i was watching amplified voltage of the shunt in the peter oakes desing, and it was horrible it was a real mess,switched over to an iron core transformer + rectifier + smoothing (4700uF *2 80V) and the current trace was much much better, but obviously when you are rectyfing the ac you end up whit a 100Hz ripple.

author: Atom
author_rank: Regular Contributor
timestamp: March 31, 2018, 11:55:33 am
content: I've seen that many knowledgeable people aswered to my topic, right now i'm breadboarding the peter oakes desing,only the voltage feedbackhere's what i've found...can you confirm what i've thought?1-when you draw current from a linear sistem (transformer rectifier filter caps) you obtain a ripple with a frequency of 100hz the 50/60hz rectified,2 op amps are fast device with bandwidth on the MHz range so picking up a ripple of 100hz it's a joke for them...the tricky part..if on the output of the psu i have the 100hz ripple the diffrential ampifier is going to pick that up and amplifiy it....then there is the summing juction , whe are summing the dc voltage of the pot with the dc voltace(+ac oscillation ) of the feedback op amp, the we're feeding all this into the integrator...the integrator starts to integrate high or low ...so it is constatntly integrating drawing or not current from the zener voltage bringing that high or low and thus varing the voltage of the gate of the mosfet...the speed of the integraions depends on the RC of the integrator so it will beoscillating at a certainfrequency trying to keep the voltage stable, so at the summing node there are0V.the voltage at the gate will oscillate so the output will and this will make the sistem more instable am i right, because now we have the 100hz noise + the oscillations on the integrator that we will find on the output...all those oscillations will be sampled by the differential amplifier and fed back into the integrator,i'm having an hard time understanding this , because on paper was all another storyany help is appreciated1 image original scheme2 image modified scheme for better understanding of what i'm saying....am i totally on the wrong trackplease help me