Advice on ADC for high-side current measurement?  - Page 1
Forum section: electronics / general

author: kimballa
author_rank: Contributor
timestamp: January 09, 2024, 06:10:32 am
content: I'm working on some projects involving transconductance amplifiers and thus have a need for an adjustable, precision current reference, in the range of about 100nA to 2mA.I'd be happy with a source that has drift under 1% in ambient temperature conditions that change by at most 5 degrees. I was able to breadboard something with a current mirror and an opamp that worked surprisingly stable across the range. I've been measuring the current sourced with my Agilent 34401A.That would probably be sufficient to get back to the main project but I've been playing around with building a proper instrument for this purpose. The current is sourced high side. I do not need the instrument to also sink current.My plan is to use a set of resistors and measure the voltage drop across them, using an analog switch like DG455 to switch between resistors to autorange the measurement, and use a low-Vos opamp like OPA4192 to first buffer the high and low side sense voltages and then take the difference and scale it to the range of an ADC.I'm fairly good with opamps at this point I think, but I haven't used an ADC before. I was going to use a SAMD51-based Arduino MCU to drive the lcd, manage the autoranging, and front panel buttons since I'm familiar with it and have a few on hand. It also has an integral 12-bit ADC. Assuming a reasonably linear reading, 12 bits *should* be plenty enough to handle the job to 1%, even if the enob is lower, because I will have four different ranges scaled by resistors of different orders of magnitude.How do I go about determining the accuracy and repeatability of this ADC? The MCU datasheet does not go into great detail about any of the peripherals. Or is it a total waste of time to even start with an integrated adc, and I should look at a separate IC?Beyond low-tempco resistors (and precision matching for the opamp gain stage) are there other things I should especially look out for in design? This will be an essentially DC source, I don't expect a lot of high frequency variation in the load.

author: RoGeorge
author_rank: Super Contributor
timestamp: January 09, 2024, 06:36:51 am
content: It looks like you need a SMU (Source + Measure Unit). A good SMU can be very expensive, maybe you can find a working one on ebay.If you don't need much voltage, there was an Analog Devices evaluation board acting like a SMU (+/-200mA, 0...5V, 16bits). It was superseded by a newer model, but the v2.0 "upgrade" was not a SMU any longer, but v1.0 might still be available.See if anADALM1000would be enough.

author: kimballa
author_rank: Contributor
timestamp: January 09, 2024, 08:37:57 am
content: Thanks RoGeorge. Yes, I basically want a lo-fi SMU... as far as used equipment goes, I've perused eBay casually plenty but even ancient Keithley units go for four figures (or more!), and $500-$1k still seems to be "for parts only" territory even for gear old enough to have a PhD. I also don't need Keithley 6 or 7 digit precision...The ADALM1000 looks interesting. (And the price is right!) I don't think it would work out of the box for me, I need a bit more voltage than that. I'm working on audio synthesizer projects that run on bipolar +/-12V. Even assuming zero headroom requirement, a 5V max source wouldn't be sufficient. The open schematics are interesting, though -- could be a blueprint to adapt to what I'm looking for... thank you for the tip!

author: RoGeorge
author_rank: Super Contributor
timestamp: January 09, 2024, 10:06:12 am
content: To extend the voltage range of ADALM1000 while keeping the exact same SMU features would be to redesign the analog front end entirely. Maybe you don't need full SMU functionality, or maybe you can only level shift the voltage from 0..5V to +/-12V.But then, you can just design the analog front end and attach it to the SAMD51 you already have.Though, even replacing all the analog part of an ADALM1000 except the CPU+DAC, would still be an advantage over starting from scratch, because you would have the software already written: USB drivers, firmware, an application to control the board, C libraries, Python module, etc.I've almost ordered an ADALM1000 some years ago, and eventually didn't buy it because the 0..5V range for a SMU was quite limiting. If it only were a +/-10V, instead of 0..5V.

author: macaba
author_rank: Regular Contributor
timestamp: January 09, 2024, 10:27:19 am
content: What's your compliance voltage range? I agree this sounds like an SMU application but I see from your requirements that some simplication like a precision howland source could be appropriate too.

author: Kleinstein
author_rank: Super Contributor
timestamp: January 09, 2024, 02:15:29 pm
content: For the current source one could kind of copy the Ohm function current source of the HP34401 DMM. The custom swiches could be replaced with more standard ones (e.g. DG409 for the resistro selection) for the The main point is a kind of precision current mirror with switchable gain. If build good enough one may not need to really measure the current at the same time as the DUT. A check towards ground from time to time should be good enough. The large current range is a slight challange, but keep in mind that the leakage / bias current can be seen as part of the normal current and only the chance with temperature is what really matters.

author: kimballa
author_rank: Contributor
timestamp: January 09, 2024, 05:03:37 pm
content: @macaba I need to source a current from approximately +12V down to a bit above GND.I was planning to use the 50uA sink reference example circuit from the REF200 (involves wiring up one 100uA source and the current mirror in a particular way) and then use an opamp to convert that from a sink to source with current gain; two pots in the positive feedback loop would allow coarse and fine gain adjustment between 0x and 50x which would give me the range up to 2.5mA.The datasheet suggests that will be compliant down to Vee+5V (so -7V if I use +/-12, or - 10V if I use +/-15V in the current source). I've built this part already with a homemade 50uA source and current mirror on a breadboard and even that circuit is surprisingly stable... I tested the two potentiometer strategy too and it also works well, I can move around the scale with the coarse and the fine adjust gives me +/-50uA precision to dial it in. Switching the resistor in the negative feedback loop between two options also gives me the option to zoom in on 0-500uA instead of the whole 2.5mA range and have even more precision for fine tuning small currents.The part of the equation where I'm looking for advice is really the last mile to the MCU thru the ADC and making sure I don't introduce errors there.The OPA192 has a 5uV offset and a bias current measured in the 10s of PA, so I'm not super worried about that throwing off the accuracy of current delivered to DUT. I'm just not sure about whether I need to search for a better ADC or how to convince myself that the MCU onboard ADC is good enough.To the other suggestion - Does the 34401A basically switch between passing the current thru to the DUT and to a known load to GND for measurement?

author: Kleinstein
author_rank: Super Contributor
timestamp: January 09, 2024, 06:23:44 pm
content: The current mirror idea in the REF200 is tricky to use with discrete parts, as the accuracy is a bit limited. Expecially the 50 µA example to divider the current is more like not that accurate.With the not too high demand a BJT based current mirror with emitter resistors may still work, but it leaves some uncertainty.A more accurate way is a kind of current mirror with FET and OP-amp, a little like the circuit inside the 34401: The input current is converted to a voltage relative to the upper supply. The OP, FET and a range setting resistor than convert back to current. The range setting resistor can be switched with a CMOS mux chip (e.g. DG408) and this way a large range can be covered.A somewhat tricky part is needing an OP to work near the positive supply for a positive side source. With the not so high demands the cheap TL071H may do the trick, otherwise this point can be s slight challange (e.g. use AZ type OPs or drop the effective upper voltage).With 4 ranges one can cover the large range with steps of some 1:10 with the last decade down from the input side current, that could do the fine part of the adjustment.The current source could work from some 2-4 V below the supply to what ever the P-FET can withstand (e.g. some 50 V below the positive supply). For more the DMMs have added protection that is likely not needed here.The HP34401 does not measurue it's test current - the current is checked via the scale factor for resistance on calibration. The current is than stable enough for good accuracy of the resistance ranges over years. So the source is stable enough to not need the extra measurement. A few other DMM can check the current, by directing it to the current measurement part, e.g. as part of the self test or for an internal adjustment step.Doing an actual measurement in real time would need a 2nd set of resistors (shunts) for the measurement to switch, which adds possibly failure modes and unvcertainty. So only check from time to time may be an attractive option. The accurate current source may be simpler than a good way for a floating measurement. Not having a measurement also increases the available voltage range.Instead of a good ADC one may need a good enough DAC for the fine settings.

author: kimballa
author_rank: Contributor
timestamp: January 10, 2024, 02:27:05 am
content: @Kleinstein -I was actually able to make a reference current and current mirror with 4x BC547B's and 1k emitter resistors on a breadboard; the input current was set just by a resistor, and it was actually surprisingly stable at 47uA. Nevertheless, the current mirror I was planning to employ on a PCB would not be discrete; the REF200 has one on board that you can use.A picture is worth a thousand words... this is the core circuit that I've worked up so far.OPA4192 gives 4 opamps for current amplification and for sensing with very low Vos and Ib and R2R inputs and outputs. It's definitely more expensive than a TL074 ($6 rather than $0.60), but also if I'm building one device for myself, I'm not going to spend a ton of effort worrying about value-engineering $5 out of the BOM if I can just get something that does the job and lets me focus on the next problem. If I needed 10 of them, that would maybe be a different story...(Although the TL074H is practically magic; if it weren't for the mV-scale Vos, I'd just use that -- it's now cheaper than the TL074 in SOIC, with faster slew, lower Ib and Vos, R2R in and out...)

author: Kleinstein
author_rank: Super Contributor
timestamp: January 10, 2024, 09:32:46 am
content: In the plan the current mirror part is only working with the fixed reference current. This is the easy part and not even needed. The adjustment part could also work with 100 µA and then half the value for the adjustable resistors.The current ranges are a bit strange with only 2.2 K and 10 K for R23 / R24. Normally one would want a larger spread here, like 100 K and 1 K (the higher, the more voltage is lost at the high end).With only 2 resistors and thus a large part of the setting via the resistors one has to work with rather small voltages for the low currents. It looks more like the 100 nA is the resolution and not the actual lowest stable current. So I was looking for a more demanding case, extending to even lower currents.The circuit uses adjustable resistors to set the current and a current measurement thus actually makes sense. This could be less an issue if the adjustment is via a voltage and one could read that voltage or provide it via a DAC. Now it makes sense why the ADC and measurement part. A current measurement could still make sense if the loads may limit the actual flowing current.The measurement part kind of works even though the leakage currents at the switches could be an issue with really low currents and for the highest current the on resistance can contribute to temperature drift as the switch resistance is included.The Diodes D2-D4 should be lower leakage diode, there is no need for shottky diodes with typical relative high leakage.Most rail to rail OP-amps have a not so obvious problem, typically some 1-1.5 V from the positive rail: there is a cross over between 2 input stages and this can add quite some error from a different offset error of the 2 parts. The OPAx192 is quite good in this respect (good trim for both parts), so it is a good choice. With other types (e.g. OPA990 with some 1 mV possible step) this can be quite a bit worse and limit the use of RR OPs all the way across the transition region. I suggested the TL071H because this was a type I know (though not used myself) to work to the positive side, though not well for DC.I woulds still prefer a circuit more similar to the 34401 current source, with the current setting resistors at the positive supply and an extra P-channel FET ( I would prefer P-mos though). This would allow to use the same resistors for the measurement and current setting (e.g. a TMUX4052 for 4 ranges) and better precision. Adjustment could be from the first current source, if needed with a DAC.

author: kimballa
author_rank: Contributor
timestamp: January 11, 2024, 02:26:45 am
content: Thank you for the review! I really appreciate the advice. Good catch on the protection diodes, I had switched a different pair to 1N4148 for that same reason but didn't propagate to the other usage.To your observation "It looks more like the 100 nA is the resolution and not the actual lowest stable current" -- I think it's basically... both? I don't have much need right now to go down into the 10's of nA and hold stable down there. And I think being able to dial in the current to ~100nA stability thru the micro-amps range also meets my needs. (Better, even; if I can dial in 200uA +/- 1uA that would probably be fine.) Over 0--85C, leakage current in the DG455 switches is limited to +/-2.5nA for an open switch, 5nA for the closed one, so at any moment that means +/-12.5nA total leakage in the measurement network (plus another 5nA thru the on/off switch at the bottom, so 17.5nA total). Not *amazing*, but I think that will meet the design brief. (Even with low-leakage MMSD4148 protection diodes, they still potentially add more error than that, although hopefully they somewhat cancel each other out.)The choice of R23/R24 and RV1/RV2 was dictated by a few considerations that fed back on one another...As you note, the bigger the resistors, the more voltage you lose at the top end. So I'd like R23/R24 to be small, all things considered.The low end of the range on RV1 / RV2 suffer from residual / end resistance. The bigger RV1/RV2, the less that end resistance matters. Bourns PDB12-series potentiometers have guaranteed <= 10 Ohm end resistance, whereas many other panel-mount pots have end resistance as a percentage of the range. 100k / 5k gives me a 20:1 coarse/fine spread which "feels nice" to use in testing, and 10 Ohm is "small" relative to both of these. Scaling down to 20k / 1k is an option, though.The design range I'm targeting tops out somewhere around 2--2.5mA. The 2k2 positive feedback resistor gives me that, in conjunction with the 100k pot.For better precision on the low end of the range, a larger positive feedback resistor would decrease the gain. 5x that takes me to ~10k, which means the "fine controls" would extend up to 500uA. Which seemed "reasonable" to me. I could use a 22k resistor for R23 and get better fine control thru 250uA which might be better, but now we are starting to really sacrifice voltage headroom.For that matter, I could use a 4-way mux instead of the 2-way switch and introduce more options. I just hadn't thought too hard about how far to push that control.I hear you on the P/N crossover at the high end of the opamp range. OPA192 isn't terrible but the deviation is present. Since most of the circuits I build run on +/-12V, my plan was to just run this circuit on +/-15V, which is still within the range for the OPA192 and the REF200. That means that under pretty much all circumstances, there would be 3V of headroom, and the opamps would stay out of the crossover range.I'm curious why you suggest TMUX4502; Ron, Ron flatness, and Ids leakage are all about 100x worse than DG455. (It is much cheaper though, at least!)I will look up the 34401 schematic though and take a look at that setup. Thanks again for the pointers!

author: Kleinstein
author_rank: Super Contributor
timestamp: January 11, 2024, 09:21:51 am
content: I don't see a problem with increasing the 10 K set resistor. The 2.2 K path should be OK for the higher currents and the 2nd only for the smaller ones. it still depends on the priorities.Using a higher supply and avoid the transition region of the OPA192 is possible. The OP-amp may not need a very negative supply. So +15 und -5 V could be OK too.With the 2 fold 1:4 mux one can use both halfs to have an extra votlage sense (like in the 34401). This way the R_on does not matter, it only adds to the overall drop. The specs for the cheap parts are loose, but this are only test limits. The typical performance is much better. Due to the high on resistance one can expect relatively low leakage. Higher grade alternatives would be a DG409 (still affordable) or even more a ADG1209 (but expensive).

author: kimballa
author_rank: Contributor
timestamp: January 13, 2024, 10:19:06 am
content: Hi Kleinstein,Thanks for the tip about the 34401A design. The schematic in the service manual is a bit confusing... some non-standard symbols, some switching circuits omitted, and a few functions together using the same circuitry means it was a bit difficult to understand the relevant section or how to redraw it. After a couple of evenings of staring at it, I think I figured it out though, and adapted a version of it for this use. See attached for what I came up with if you're curious.This is much more elegant!The terms cancel out so the output current has no dependence on Vcc, so this should have a decently high PSRR. (About -60dB in simulation.) I simulated it last night and built it on a breadboard today around a TL072. Much bigger range -- gets down to 200nA, and up to 10mA. Using a TL072H with the higher common mode input should let it dial down to even lower Iout. The circuit is much more stable too (better PSRR / thermal robustness)... at the low end (<1--2uA) the Iout wanders about ~1%. Most of the range it's stable to 0.1%. I produced 100.0 uA +/- 0.1uA very steadily, even with very different R_load. Above 2--3mA I start to see the impact of power dissipation causing it to drift more, but even there only 0.5%. This makes it much easier to adjust and dial in the knobs. I'm looking forward to seeing how it performs on a PCB.

author: Kleinstein
author_rank: Super Contributor
timestamp: January 13, 2024, 10:49:39 am
content: The plan is indeed a simplified version of the idea in the 34401 current source. One point it is missing is separte switching for voltage sensing. This eliminates the switch resistance from the current setting resistors and allows to use higher R_on switches.For a higher current like > 2 mA it helps if the resistor to set the current is even smaller (e.g. more 100 ohm instead of 499) and less voltage is used. This reduces the self heating, but may need the separate voltage / current sense idea.The signal back to the ADC would still need level shifting from the positive side towards the negative side. This could be the classical high side current sense ciruit with an OP-amp and P-MOSFET converting the signal to a current first.

author: kimballa
author_rank: Contributor
timestamp: March 06, 2024, 05:40:15 am
content: To close this out -- I kept at this project after getting advice here. Thanks @kleinstein and everyone else who chimed in! In addition to the positive current output, I added a current mirror and an analog SPDT switch that would redirect the sourced current into the servo side and the "output channel" into the driven side of the mirror so that it could source and sink current (or rather, source +I and -I). It has a (limited) 4 quadrant range, operating roughly between +/-14V on low current, and losing a few volts of headroom as it gets closer to its limit of +/-10mA out.I achieved the design brief; on the lower ranges it has absolute accuracy of about +/-50nA, and is accurate to 0.1% over the higher ranges. There is some minor slow oscillation of a couple of 10 nA's, but that is acceptable to me.I built this on a 4 layer main board and 2 layer front panel interface board. Power is +5V from USB-C, with dual power supplies developing +/-15V (boost for 15V, cuk for -15V) with a fairly generous set of chunky RLC filters to smooth everything out. Ripple is < 20mV.Some photos of construction and post-calibration results attached.