Constant current source - Page 1
Forum section: electronics / projects

author: OM222O
author_rank: Frequent Contributor
timestamp: October 11, 2018, 11:31:16 pm
content: I need to measure many shunt resistors with relatively high accuracy of 1mbut I want to design something to an order of magnitude better (just for good practice!) so 0.1mis what I'm designing for(obviously this level of accuracy needs 4 wire measurement so a current source is used in conjunction with an ADC). I will be using an atemga 328P as the MCU (8MHz internal clock), and the ADS1015IDGSR (12 bit ADC with +-1 INL error which is pretty good) plus the REF3440IDBVR as the voltage reference of the ADC (I can switch to ADR434B if it was proven to be unstable or not accurate enough). I will also probably use a precision x10 gain amplifier in combination with the programmable gain array of the ADC to achieve maximum accuracy, but I would also like to have a switchable constant current source to provide 1mA, 10mA, 100mA and 1A (pulsed for a short amount of time just enough for the output of the ADC to be accurate) to be able to do range switching to cover a wider range of resistor values. I seem to be unable to find a device that can do it. I've seen this note on TI's website which is an improved howland charge pump:http://www.ti.com/lit/an/snoa474a/snoa474a.pdfI can use a digital pot (5k 128 taps) and multiply all the values by 10, i.e 1Meg 0.1% resistors (although I think the 249resistor is used to be halfway in the midpoint of the 500trim pot so I might be able to get away with using a 2.49k resistor to go with the 5k pot but I don't know how much this would affect the performance without stepping up the 100kresistors to 1Meg). This way I can have a trimmed value for every output current which is set into the MCU's EEPROM. All in all as accurate as this might be, it seems a bit overkill to me even for the theoretical 0.1mor even the targeted 1maccuracy and if I have to use the ADR434B as my voltage reference, this is gonna end up costing a lot (that chip is about 7 pounds as one off or about 5pounds in 100 quantity). Anyways I couldn't find any specific values but people have been suggesting that the howland charge pump is a low power (about 10s of mA) kind of circuit. is there a limit as to use it for higher current outputs of 100mA or 1A for a pulsed output? if yes, how can I create a current source with that level of adjust ability and even more importantly, do I even need to do a such thing or would I be better off using multiple current sense amplifiers with gains of 10 and 100 + the integrated PGA of the ADC? Thank you very much!

author: coppercone2
author_rank: Super Contributor
timestamp: October 11, 2018, 11:51:28 pm
content: I made a higher power AC current source by using a LT1010 buffering some kind of low noise chip with a differential amplifier being used as the feedback (from some Jim Williams circuit). It's similar to the Buffered HCP.. I think mine was fixed gain too from the DA.I did not really need it and I fried it by accident and I have a partial one built some where (IIRC I did it dead bug).By high power I mean up to 100mA @ MHz range, supposedly, but I don't remember how well it tested... but it did work at fairly high frequencies at decent miliamps. Like it did not oscillate on me or anything stupid like that. I think I hooked it up backwards after adjusting something and an op-amp fried and I did not wanna resolder the thing (it was built really compact). I also did not have a good function generator at my work station at the time, so my test was to measure the AC current with a 34401A in series to see if it was linear when I swept frequency, and it was decent IIRC, enough, but the function generator had some variation of output voltage vs frequency (low range Tek). also a DMM is not good for HF measurement.But I think it could do you a decent pulse wave. But anyway, for these things, you want a trapezoid wave anyway, you don't want to measure the inductive effects.

author: coppercone2
author_rank: Super Contributor
timestamp: October 12, 2018, 12:01:56 am
content: I think this talks about motor winding measurement or something and it might have a relevant circuit.I also think this youtube video had something to do with pulse measurement and may be interesting (its a mod of a commercial box)

author: Vgkid
author_rank: Super Contributor
timestamp: October 12, 2018, 12:06:17 am
content: On the milliohm meter I have , it says not to use a pulsed setup for motors(or other high inductive resistances).

author: OM222O
author_rank: Frequent Contributor
timestamp: October 12, 2018, 12:07:32 am
content: Thanks for the help but as I said I will be using it to measure shunt resistors so it will be a pure DC after the initial pulse which again, is given enough time to settle. I cannot use it straight due to power limitation of the resistors which are used to select the output current(they will be fine for a short let's say 100ms pulse at power levels above which they are rated for), but no AC signals, let alone in the MHz range! You mentioned yours worked fine till 100mA. what about the 1A range? would that be pushing things too far? I also need to find an op amp with level of output capabilityor I might be able to use a series pass mosfet to it's output to get the current capabilityI'm lost ...

author: coppercone2
author_rank: Super Contributor
timestamp: October 12, 2018, 12:18:03 am
content: Well you need to look at the power output of the op-amp and the voltage you want.What can happen, if you use low voltages/high gain, is that you get 'oxide readings'. Higher voltages will penetrate oxide layers (not sure of the physical mechanism) in different ways and stuff. Those videos go into a bit. I would assume its related to heat or possibly plasma with enough voltages (micro sparks?). This a process parameter thats difficult to tune most likely. It also changes between measurements unless your operating in a high vacuum with really clean stuff (and even then you might get micro metal migration etc that effects things, I am not sure, but if you make contact with just asparities on the surface of the metal you can possibly get some kind of melting/diffusion to make weird alloys that break apart when you open the circuit mechanically. Not sure if this is a real effect or if it is common if it is real or what level it would be measurable at, just speculation.Another parameter is noise, with higher gains you tend to get higher noise, so if you are amplifing the shit out of something it will have a higher noise floor, which you can design around.There is also some torque/movement from current flow.. so it kind of depends on how tight your holding something (like 1 amp pulse might exert some tiny force on it if its poorly connected which can change the reading maybe).the lt1010 is a buffer chip that can supply 100mA. If you wanna go with an op-amp, you can make a composite op-amp using a higher power op amp (like an audio amplifier) to act as a buffer.The benefits of an op-amp is that you can do a bipolar pulse and subtract two measurements to get rid of 1/f noise and offset drift some what.If you are OK with a unipolar pulse then you need to research the transistor current source circuits, I never messed with them. I can't tell you their nonidealities but I am sure other forum members can because they are common for hobbyists.

author: coppercone2
author_rank: Super Contributor
timestamp: October 12, 2018, 12:22:50 am
content: also you are supposed to use a pulse, because DC current heats the circuit and causes temperature drift error.Also, what do you qualify as 'settled' for a square wave? I am actually asking because I don't know the decay of those spikes. I assume its not really ever flat but has some kind of inflection to it (based on the opposite negative spike), when looked at in the time domain, which is hard to measure?I am not sure how to measure the DC level flatness of a square wave without a really good high resolution ADC actually. And the dynamic range is pretty big for a microzoom. The resonances usually look pretty complex with a good high res scope. But you don't have alot of bits. But this is splitting hairs.

author: OM222O
author_rank: Frequent Contributor
timestamp: October 12, 2018, 12:35:35 am
content: What do you mean by a bipolar pulse?the noise and gain errors are exactly the reason that I want to avoid using current sense amplifiers and just use a higher current to get a higher voltage drop so the ADC can read it directly.the "pulses" that are generated aren't really square waves in the sense that a PWM signal is (addition of multiple sine waves). it's just a constant current that is switched on and off for a period of time which if I'm using a FET on the output to enhance the power, I can add an RC network as a capacitance multiplier to get rid of any ripples as well! so it is pretty low noise and accurate.I the settle time depends but checking the datasheets for my ADC and considering any small amount of inductance in the wires or the shunt resistor itself, the 100ms pulse should be more than enough in my application.

author: coppercone2
author_rank: Super Contributor
timestamp: October 12, 2018, 12:39:50 am
content: But you always get less heating with a shorter pulse, so its possible to optimize here. The smaller the thing you measure is the more effected it is. A big bus bar probobly won't be measurable but if you are measuring a tiny resistance with high temp co it might be.The electrical signal is a square wave. So long you are comfortable cutting a good portion of the square wave it should be pretty accurate. I would be interested to know how different sampling intervals effect your reading. A PWM also turns something on and off but this is just a slow single shot pulse but it still has frequency content.by bipolar I mean that you will have some offset voltage at the output impedance of your amplifier. If you pulse both ways, you eliminate the offset voltage error by subtraction. But you would need to disconnect the circuit to eliminate the thermal steady state heating by the offset voltage.I built a highly engineered circuit for this but I never got the test to chance it because I lost interest in the measurement.

author: coppercone2
author_rank: Super Contributor
timestamp: October 12, 2018, 12:46:39 am
content: but again, higher current = more heating but less error to resistance because it will puncture oxides by some mechanism or do something thats commonly explained that waylower current more amplification = less temperature error but you will begin to measure stupid crap. It likely depends on the surface texture, metal composition and oxidation level of both your electrodes and the material being measured, and is probobly nonlinear with temperature. And it may be effected by other factors (theoretical).measuring stupid crap may be useful

author: coppercone2
author_rank: Super Contributor
timestamp: October 12, 2018, 12:54:23 am
content: https://en.wikipedia.org/wiki/Contact_resistance

author: exe
author_rank: Unknown
timestamp: October 12, 2018, 03:02:15 pm
content: Howland pump is not easy to make precise (needs well-matched resistors), nor it is needed here. Just a current sink (opamp +mosfet/bjt) will suffice. It can be easily driven from DAC directly.Howland pump is useful when you have a ground load. But since you want precision, you'd need a Kelvin sensing, so load is not grounded by definition.Might also need a good opamp with low offset for current sensing to amplify signal from the resistor to exploit the whole range of ADC.

author: coppercone2
author_rank: Super Contributor
timestamp: October 12, 2018, 04:38:57 pm
content: typically you just put a IA / DA across the load impedance to measure it.What are you talking about exactly? I don't follow.Are you talking about impedance balance? That's not always done but it improves CMRR.

author: perieanuo
author_rank: Frequent Contributor
timestamp: October 12, 2018, 04:58:39 pm
content: Overcomplicated task.Just calibrate your current measuring device where the shunt resistor belongs.cost you less, less headache, same result.And calibrate voltage is less painful imho.Envoyé de mon iPad en utilisant Tapatalk

author: OM222O
author_rank: Frequent Contributor
timestamp: October 12, 2018, 06:14:55 pm
content: Quote from: exe on October 12, 2018, 03:02:15 pmif I use 0.01% 100K resistors (a few cents each) with a digital pot and and a 2.49K resistor, I can get 0.001% accuracy based on my calculations. but I think I'm on the wrong page with this current pump too. you mean something one of those "dummy loads" but with switchable high precision ballast resistor to get the 4 values of constant current? I don't really wanna use a high precision DAC as they are going to add a lot of cost. having an 5V rail (or a 4.096 precision reference which is needed for the ADC anyways), and again, using a digital pot and a fixed resistor in a voltage divider it can get a pretty accurate 1V reference voltage and it's gonna cost way less than an ADC.

author: exe
author_rank: Unknown
timestamp: October 12, 2018, 08:00:27 pm
content: Quote from: OM222O on October 12, 2018, 06:14:55 pmI'm not sure that having matched resistors is enough. Input offset, etc can also play role. So, if you go this way be sure to verify the design over whole range of output voltage.In this regard, a low-side sensing with one resistor looks to much better: only one part to care about (think of drift of Howland resistors), no CMMR problems, simple design. Clear winner, imho.On the other side, I think @perieanuo is right. With a power supply and an ammeter you can do the same.

author: OM222O
author_rank: Frequent Contributor
timestamp: October 12, 2018, 11:29:40 pm
content: there are 2 issues with that:1) I don't have access to precision equipment all the time (just university labs which can be used for a few hours a week).2) I'd like to do it automatically rather than manually as I will be measuring a lot of resistors.I made this circuit which works beautifully:http://tinyurl.com/y8gnl8fwThat is until you read the data sheets and see that even the best analog switch ICs have 900mcontact resistance which throws the 1resistor accuracy out of the water and the difference is so huge that it cannot be adjusted using the digital pot. the mosfet seems like a terrible idea as well because it needs 12.5v on it's gate to give the 1A output for some reason ... I tried replacing it with a BJT and it needed about 2 volts max which is a lot better and again, the power draw of 10 watts(!) won't be an issue as it's a really short pulse and won't damage any parts. I looked into the possibility of using a 4 channel mosfet or 4 BJTs and switching the output of the op amp to do the range switching but the prices were just out of the question for a project like this (4 bucks for a mosfet and 2 bucks for a 4 channel switch ... just no). this is so frustrating and I think I'm gonna give up on the idea of having a selectable current source. rather stick with the 100mA fixed current source and using some other tricks to get the desired accuracy.

author: exe
author_rank: Unknown
timestamp: October 13, 2018, 07:34:31 am
content: Quote from: OM222O on October 12, 2018, 11:29:40 pmWrong type of mosfet or simulation is inaccurate. Logic-level fets need at most 3V above source to open (some of them fine with less than 2V). But you need to massively derate it as almost all mosfets not designed to work in "half-open" state. Although, my load with irfz24n (or irfz44n, don't remember) works fine. Probably, bjt is a safer choice here.Nonetheless, you need to add compensation for stability.Concerning switches, they are not really suitable the way you tried to use them. They are not designed to handle much current. What you can do is use them to, e.g., configure opamp gain. See, e.g.,https://www.renesas.com/eu/en/doc/application-note/an1034.pdffor examples (Figure 1 (d)).What else you can do is use mosfets to switch shunts. Needless to say Rds(on) should be much smaller than the resistor and mosfet should be fully open. Also, mosfets have some parasitic capacitance, not sure if this is a problem or not, but I'd make current source intentionally slow (overcompensate it) to avoid any problems.

author: OM222O
author_rank: Frequent Contributor
timestamp: October 13, 2018, 08:41:57 am
content: Quote from: exe on October 13, 2018, 07:34:31 amwell as I mentioned there are no quad BJT/Mosfets that don't cost a ton and doing gain switching on an op amp is pretty iffy as I'm working with 3 different orders of magnitude (1mA to 1A)! I would again need a pretty schmick chopper amp with very low offset voltage and gain errors (like the one dave used in the uCurrent) which again is gonna end up costing a lot! I think I'm gonna stick to a single 100mA source, and have a x10 current sense amplifier across the test resistor (and maybe one across the shunt resistor to compensate for any temperature drift), I'm already using a 4 channel ADC so doing a 2 channel differential measurement is possible. In conjunction with the PGA of the ADC, I can measure an acceptable value range of resistors with high accuracy!

author: exe
author_rank: Unknown
timestamp: October 13, 2018, 08:46:46 am
content: Quote from: OM222O on October 13, 2018, 08:41:57 amSorry, I don't get this part at all. Why not just picking four discrete fets? Do you have 4 space IO ports on your MCU?

author: OM222O
author_rank: Frequent Contributor
timestamp: October 13, 2018, 10:33:36 am
content: Quote from: exe on October 13, 2018, 08:46:46 amI'm more concerned about the PCB space as that's gonna be my biggest costbut I'm biting the bullet and getting 3 of the BUK98150-55A/CUF logic level N channel fets which are in a SOT-23 packages.I need to separate the grounds (DGND and AGN which takes even more PCB space) so the switching noise of the MCU doesn't affect the performance of the ADC as I'm considering using a 16 bit or 24 bit ADCs. The ADS1115 comes with integrated 2.048V reference so I don't need to worry about that! considering all the errors, I definitely need the 1A current source as even the best x10 amps that I've seen have way too high of offset voltage when measuring 1mand introduce about 30% to 40% error if I use the 16 bit ADC (which is the more reasonable choice)!So one fet would be used to turn the load on/off, one would be used with the op amp to set the gain and one would act as a variable resistor to provide the constant current. however I'm not sure about using a logic level fet for that purpose and might use the SS8050-G which is a BJT in aSOT-23 package as well and use that on the output of the op amp.Here's is the circuit without any gain switching implemented yet:http://tinyurl.com/ybmgsmaeI'll update it with the full schematic with the x10 gain switching for the op amp and use PSpice to do a "proper simulation" if I was happy with this ad-hoc circuit. Thanks for the feedback and feel free to suggest more things which I can change to improve the performance of this device.

author: exe
author_rank: Unknown
timestamp: October 13, 2018, 11:02:15 am
content: Quote from: OM222O on October 13, 2018, 10:33:36 amThere are mosfet pair in sot23-6 packages (or even smaller packages), you can use those to save some space (but I doubt you'll save much).I'm not sure your switch will work under all conditions. For high-value DUT (or no resistor at all) it will fail as opamp's output will swing to the Vcc and you won't be able to switch it off.Concerning ADC, I don't really see much sense to use 24bit ADC. Getting 12+ ENOB takes quite some engineering and volt-nutting. Also, you need to match dynamic range of ADC with your measurement range (e.g., 0-2V 16bit ADC is a poor choice to measure signals in 0-0.1V range). Also worth checking performance of built-in reference. Often an external one can be better. To me a realistic goal would be to get 12 ENOB +-1LSB measurement precision.Concerning separate grounds, up to you. Layout is important, but there are many other factors that affect precision. After all, MCU can sleep while measurements are done, and you can average multiple readings. I'd be more concerned about DC offset errors, temperature effects, component ageing, shielding, NPLC. Nonetheless, the datasheet provides suggested layout, probably you can't get wrong with it.

author: OM222O
author_rank: Frequent Contributor
timestamp: October 13, 2018, 06:29:47 pm
content: I made this simplified version which switches between 100mA and 1A (shows up as 999.9mA for some reason)http://tinyurl.com/yd983ym3This allows me to get the desired accuracy at lower value resistors, but it can go upto about 100 ohms when supplied with 12V (allowing 1V voltage drop across BJT)but it would be really nice to be able to go up to 1K. In order to do that I need to multiply by 10 but I'd rather avoid using another op amp but if it's the only option, I guess I have to go with it. going with a 100ohm shunt resistor is not really an option as it will not allow me to go to the 1A range (unless I somehow manage to fit a 100V voltage supply ... neither practical nor safe) which means I'll lose the resolution that I fought for this hardAny ideas or is another op amp the only option here?

author: exe
author_rank: Unknown
timestamp: October 13, 2018, 08:18:19 pm
content: Quote from: OM222O on October 13, 2018, 06:29:47 pmYou shunted 10 Ohm resistor with 9k+1k=10k resistor. That's why it's not precisely 1A. But that's easy to compensate in software via calibration.I'd say your solution is to have three shunts. Now it's too late to wrap my head around, but I'm attaching "the proper" way of switching between the two shunts (actually made by one of forum members, I downloaded it from the forum). I think it can be easily expanded to three shunts.

author: OM222O
author_rank: Frequent Contributor
timestamp: October 13, 2018, 10:34:38 pm
content: it would be way simpler to just use a dual op amp (they usually come in the same package as single op amps anyways) and set a x10 gain using a non inverting amplifier. As I mentioned, I'm already measuring the current using the ADC anyways, so it's simple enough to adjust for any mishaps either in software or by changing the digital pot (just need to remember to add some input resistors (they already have diode protection which can take up to 10mA so 2k resistors sound good and also helps with the RC filter on the input which they recommendI'm not sure about the input impedance of the ADC so might add my own 5V zener with series resistance so I can use less input impedance to the ADC and still have the protection as there can be a 10v difference across the 10ohm shunt at 1A current). and I know that I'm not using the entire range of my ADC but I only need the resolution (I know this sounds dumb but using something like an INA106 puts the BOM way above my comfort level as I might easily fry a component by accident and they cost a lot ...). If I'm reading semi accurately down to 100u\$\Omega\$ and my goal is to actually get milli\$\Omega\$ readings, It means I can be off by quite a wide margin (considering high temp co of my parts and possible sources of noise, etc, I need that kind of margin) and I can still say it's definitely accurate at the milli\$\Omega\$ range. I'm quite happy with this design. I'm just gonna do some more simulations to make sure everything works as expected, then put an order for the parts (I'll try my luck with a 24 bit ADC and 2 different external voltage sourcesand compare them to the 16 bit one and see how they fare) I'll post the results after I get my PCBs and finish the testing and tell you how things went!Here is the last simulation using another op amp btw (it doens't have a single pole 3 throw switch so I just hacked together 3 switches so just do the switching as you wish):http://tinyurl.com/y8p7pjw7