Range swichable constant current source - Page 1
Forum section: electronics / projects

author: OM222O
author_rank: Frequent Contributor
timestamp: January 15, 2019, 04:16:24 pm
content: HelloI need to have a range switchable constant current source for a project with outputs of 10mA 100mA and 1A. I create a 1V reference using 2 fixed resistors and a digital pot which acts as a crude DAC. my first idea was to amplify the feedback signal from shunt resistor in order to trick the main op amp into seeing different values across the shunt and therefore making adjustments to keep the "1V" across the shunt. (see the circuit below)http://tinyurl.com/y7zr7zqqThis worked really when even simulated in pspice using real world models of op amps but there was a ton of oscillation on the output of the main op amp when I built it. I tried a 1k resistor and 1uF ceramic cap as a low pass RC filter which dampened it down but there was still oscillations across the shunt resistor which obviously wasn't ideal (I also tried different op amps, same results!) ... also unlike the simulation, when all switches were disconnected there was about 200 too 300mA which I'm guessing was cause by electrostatic build up or random noise ... so to say this was a bad idea would be a gross understatement. I'm really limited on the PCB space so I'd rather avoid having 3 separate op amps with 3 separate output pass elemnts (BJTs for FETs) as well as 3 shunt resistors ... I know this is in theory the best method but I'd like to see if you guys have better suggestions on how to achieve this ... One other idea that I'm having right now is to use a unity gain amplifier on the 1V reference, then have the decade divider resistor network (3k 27k 270k) on it's output and use the switch to feed that into the non inverting input of the second amp. also include a RC snubber network which also acts as a pull down when no switch is connected, so the load will be off. That would probably require a split supply or some weird trick as even the "rail to rail" op amp I'm using rn has about 25mV swing so it can't each the desired 10mv .I'm not sure how it works and haven't simulated it yet, I'm just really frustrated after wasting so much time for nothing. I would really love to hear your advice first, thanks.P.S: another reason I'm trying to avoid 3 of each component is because of the fact that one side of the PCB has to be used as a front panel so vias can't be used except for a really small part where the 1inch oled display will fit onto, but if nothing else works, I'll give that a shot.

author: OM222O
author_rank: Frequent Contributor
timestamp: January 15, 2019, 04:47:36 pm
content: Here is what I meant as my second attempt:http://tinyurl.com/y848xrb7the 560k is a pretty weak pull down but still seems to be causing issues ... maybe a better solution is to connect the output of the op amp to the BJT using another switch? There are so many options when it comes to analog circuits, it's seriously overwhelming

author: soldar
author_rank: Super Contributor
timestamp: January 15, 2019, 05:17:23 pm
content: What kind of voltage and what kind of precision do you need because this is the kind of thing I would do with a single transistor and a zenner diode.

author: Zero999
author_rank: Super Contributor
timestamp: January 15, 2019, 05:18:44 pm
content: You need a Howland current pump. Here's a link to one I designed awhile ago. It can both source and sink current and is bridged but as you only need to source, it can be much simpler.https://www.eevblog.com/forum/projects/need-help-with-bi-directional-constant-current-source-(100ma)/msg1972685/#msg1972685Here's some links giving more information.http://www.ti.com/lit/an/snoa474a/snoa474a.pdfhttps://www.edn.com/design/analog/4430167/Op-Amp-Current-Sources--The-Howland-Current-PumpSimulation:http://www.falstad.com/circuit/e-howland.html

author: OM222O
author_rank: Frequent Contributor
timestamp: January 15, 2019, 05:48:18 pm
content: Max voltage is 9v (battery) and I need it to be fairly accurate as it will be used with an ADC to measure resistance values (not shown in schematic) but the digital pot can compensate to +-10%Quote from: Zero999 on January 15, 2019, 05:18:44 pmThat was my first idea as well but I'm not sure they are suitable for currents of about 1A ... I read a lot of articles which suggest they are good for low current situations.

author: Kleinstein
author_rank: Super Contributor
timestamp: January 15, 2019, 06:01:36 pm
content: With such a large range it would get much easier with not just 1 shunt, but at least 2 of not 3 shunts. Could be in series and a switch to direct the current the right path.It would be a good idea to use the same reference as the ADC. Another important point would be the supply that is available - 1 A from a 9 V block sound kind of odd.In the very low ohms range one may also want to switch polarity of the current. 1 A is also a lot of current and could cause quite some self heating for the DUT. The more normal way is to use less current and an alternating polarity, so that very small voltahes can be measured.

author: Zero999
author_rank: Super Contributor
timestamp: January 15, 2019, 09:54:30 pm
content: Quote from: OM222O on January 15, 2019, 05:48:18 pmThe Howland topology had no real limit to the current, other than the op-amp used. If a couple of power transistors are added to the output, 1A is easily doable.I agree with the above about changing the shunt resistance to give different ranges. There could be 1R, 24R and 75R in series. The 75R and 24R could have relays bypassing them. If the voltage across the shunt resistance is 1V, at full scale, that would give 1A, 1/25A, 1/76A and 1/100A ranges, depending on which of the relay(s) is/are on.

author: OM222O
author_rank: Frequent Contributor
timestamp: January 16, 2019, 12:28:07 am
content: the current will be pulsed for a short amount of time just enough to get a few ADC readings and return an average, can you explain how reversing the polarity works in this case?Can I use small mosfets or BJTs to just switch out the shunt resistor without needing separate op amps and feedback loops for every individual shunt?Relays won't be possible, as I said, I'm very limited on the PCB space side of things, also I think BJTs would be a better choice than mosfets as CE voltage drop is almost zero (I know base voltage is different and BE voltage is about 0.7) whereas mosfets have RDS which can affect the 1ohm shunt and make the reading inaccurate

author: OM222O
author_rank: Frequent Contributor
timestamp: January 16, 2019, 04:53:12 am
content: I've tried a lot of different configurations but everything seems to fail me one way or another ...1) Using mosfets for switching in the suitable shunt resistor: RDSon heavily affects the 1\$\Omega\$ shunt unless I use a fairly expensive fet which has <1m\$\Omega\$ RDSon2) Using BJTs to switch the suitable shunt resistor: Base current negates any benefit gained from removing RDSon and the shunt current can be any arbitrary value for the 1A range (either large base resistor => not enough gain (unless darlington pair which is again, added cost for a simple part) => limited to a few hundered mAs or small base resistor => 10s of mA base current => inaccurate readings)3) Using a resistor divide to switch the voltage reference on the non inverting pin: the TLV9002 is barely meeting it's typical swing of 10mV , worst case scenario for it is 20mV => half my boards will not workThis has by far been the most stable circuit build which I've been trying to avoid ... it requires more parts and a more complex design, more PCB space which is practically one sided and it's driving me insanehttp://tinyurl.com/y9gqovf8I can get the TLV9004 which is a quad amp package, a small dual BJT package for the 100mA and 10mA range (again there won't be much thermal load as it's pulsed on for a few ms just to get some readings and return an average) or maybe a combination of above mentioned methods but for 100mA, 10mA and 1mA ranges, with a x10 amplifier using a very low offset op amp (max4238) to effectively multiply the voltage across the test resistor (which is practically the same as passing higher current). that will also allow me to create a really heavy low pass filter to block any AC noise and just measure the DC component. I really need to think about the cost of each method, how stable they are and how accurate they are, while maintaining practicality in the circuit.I'll ask our analog electronics lecturer in uni for some help as well, maybe he has a better idea

author: OM222O
author_rank: Frequent Contributor
timestamp: January 16, 2019, 08:02:23 am
content: if anyone knows an effective solution to switching shunt resistors to get the desired range, without RDSon affecting the accuracy (especially on the 1A range), please let me know because that would be the simplest solution in this case, thanks.

author: Zero999
author_rank: Super Contributor
timestamp: January 16, 2019, 10:16:34 am
content: Your most recent circuit is a current sink, not source. If that's acceptable, then it's easier to implement, than a Howland pump.How accurate does this have to be? How about using slightly lower value resistors, to account for the extra on resistance of the MOSFETs? Any errors can be calibrated out later.A relay is the best part for this application. How much space do you have? It only needs to switch an Amp and there are plenty of small relays available which can do that.

author: OM222O
author_rank: Frequent Contributor
timestamp: January 16, 2019, 10:32:23 am
content: the DUT will sit between the emitter of the pass element (a beefy NPN darlington pair in my current circuit) and the top of the shunt resistor, that will ensure the same current that is passing through the shunt, is passing through the DUT as well because they are in series, so current source / sink doesn't matter, it'll be practically the same (putting shunt and DUT in series).all my components are 0.1% and I was aiming for 0.5% accuracy worst case scenario which is why I'm using 2 channels of my ADC to measure the shunt voltage and 2 of them to measure the voltage across DUT differentially. Ideally the error would be <1mA in 1A range (so again 0.1%). for switching the shunts even (especially low value of 1\$\Omega\$ for the 1A range) 10m\$\Omega\$ can be quite bad but it'll be acceptable (0.1% would be 1m\$\Omega\$ and fets with that value cost more than 2 bucks a pop). I had the idea of using a manual switch which then lead me to the same conclusion: relays ... they're depressingly worse than fets with a few hundred m\$\Omega\$s of contact resistance (or at least the 5 to 10 data sheets that I read, please send me a link to a lower value resistance if you could find one). my next best bet is using dual fets in parallel to effectively halve the RDSon. I only searched for logic level fets so I can drive them from the MCU but I try to see if I can find better RDSon fets with reasonable price , I can add a charge pump to take care of higher gate drive voltages.

author: OM222O
author_rank: Frequent Contributor
timestamp: January 16, 2019, 10:56:08 am
content: This seems to be just the thing I was looking for, although the package is quite large ... but at least it works with 5V which saves space on charge pump circuit on the other hand so a good compromise. I can use two of these, (one for each shunt) with both of their channels in parallel to get even lower RDSon (<2m\$\Omega\$)https://www.mouser.co.uk/datasheet/2/196/irl6297sdpbf-1227821.pdfplease let me know if you can find a better part or have a better solution for this problem. I still keep looking but this seems very promisingP.S:https://www.mouser.co.uk/datasheet/2/427/sira90dp-1114350.pdfis single channel but seems to be smaller with lower RDS, while not costing a huge amount (it's also pin compatible with the rest of SIRA series but I can't seem to find pin compatible devices for the IRL6297) this will be my choice for now.

author: Zero999
author_rank: Super Contributor
timestamp: January 16, 2019, 12:39:23 pm
content: Take the contact resistances for switches and relays given on data sheets, with a large pinch of salt. In reality, they'll be much better than the data sheet specifies. For example, take a switch rated to 10A, which will no doubt have a contact resistance of 100mOhm or something stupid listed on the data sheet. That would indicate a power dissipation of 10W, at full current, but in reality it will be nowhere near that, otherwise the contacts would melt!Switch contact resistances are often measured under the worst case scenario such as a low current and immediately after the contacts have closed. Try conducting a few tests with some switches and relays you have, with a current of 1A and you'll see what I mean. You'll have to get a very good MOSFET to replace a switch. No doubt it's possible these days, but it might not be as easy as you think.How accurate is your digital potentiometer? Probably worse than 0.1%. Scrap it and replace it with a proper DAC.The only way you're going to get the desired level of precision and accuracy is by calibrating it and storing the scaling factors in the micro-controller's memory.Use a reference with a slightly higher voltage than 1V, say 1.024V and a precision 1R sense resistor, which is kept in the circuit at all times. Suppose you have a 9.1R resistor in series with the 1R, to give a range of just over 100mA. Put the MOSFET in parallel with the 9.1R resistor. The MOSFET only needs to have a worst case on resistance of 24mOhm. Switch the MOSFET on for the 1A range and set the DAC output to 1V. Measure the current through the 1R resistor, with a calibrated multimeter. Note the value, which will be used to scale the current setting. For example suppose you read 0.99A, you get your software to multiply all current settings on the 1A range by 1/0.99 = 1.01 and it will give you the correct result. The MOSFET's on resistance will change depending on the temperature, but not enough to upset the calibration.

author: OM222O
author_rank: Frequent Contributor
timestamp: January 16, 2019, 02:24:16 pm
content: Thank you for your suggestions, but I have conducted tests and the digital pot seems to be just fine. it's a 257 tap pot and it will also be adjusted depending on the reading of the adc across the shunt resistor to give very accurate current values (essentially I'm using it as a really fine adjust with a much better resolution than I need while getting the accuracy from the differential reading of the ADC (ADS1115 or ADS1219, that's still not finalized but even the 16 bit 1115 seems to be holding up really well)).Also I mentioned the pass element is a beefy NPN darlington pair and it will be switched for a maximum of a few ms, worst case 10ms! so no heat build up will occur in any of the parts as the thermal mass essentially negates it and it has time to cool down between pulses. The second mosfet I mentioned is rated for "0.00115 at VGS= 4.5 V" which is just above 1m\$\Omega\$ with a really reasonable price! that is perfect for my application as a switch but I also agree with your comment on contact resistance of relays, I will order both the fets and and a few small relays. I'll run 1A through the contact and measure the drop using a home made precision low voltage meter (essentially an ADS1219 with a precision voltage reference (ADR4520) which I have tested with a proper 6.5 digit calibrated multi meter about 5 months ago and it checked out to 1uV, so plenty good enough in this application). I'll make sure to post the results here when I've finished my testing.My main goal is to not affect the value of the shunt resistor via whatever means of switching that is used (either mosfet , a manual switch or a relay) by more than 0.1%. I have made sure to check the power rating of all components and make them really beefy for the 1A circuit, but the rest are a lot easier to deal with (less power, higher error budgets for contact resistance, etc)ThanksP.S: This is essentially my current circuit:http://tinyurl.com/yaf7gln5This will allow me to have 4 ranges for extended range of test resistors, it is really accurate and I quite like it. as I said tho, I need to do some calculations and see if it's viable to use a x10 gain with a MAX4238 with larger shunt resistors (essentially make them 10 times bigger) and buy cheaper switches/mosfets (and theoretically save battery power as well) or if that proved to be inaccurate, stick with the current design. I really appreciate your help and time and probably send you a unit when the design and prototyping is completeI honestly wasn't expecting op amp ringing and oscillations in my first design after running the simulations, but hey, practical components are different ... I'll also make sure to post an update with test results of each method and contact resistance of relays etc.

author: erikj
author_rank: Contributor
timestamp: January 16, 2019, 07:25:39 pm
content: You could try something like this:Turn on one of the mosfets M1-M3 for the range you want. This way the ESR of the mosfets will not affect the measurement.I added C1 for stability, it might not be needed.The idea comes from here:

author: Zero999
author_rank: Super Contributor
timestamp: January 16, 2019, 08:03:24 pm
content: erikj,That's a good idea for eliminating the MOSFET resistance from the measurement!R3 and R4 can be two 180R and two 18R in parallel, to get 90R and 9R respectively.OM222O,I still think you should consider a proper ADC as well as or instead of the digital potentiometer, simply because it's only 8-bit, which not good. If you have more bits, then you'll probably find you don't need so many ranges.By the way you'll need to activate the current source for long enough for it to settle, before taking a sample. You'll fine it will take a few ms for the current to settle to the set value.