# Current Sense circuit with digitally programmable gain

I'm designing a precision source meter and I wanted to put a couple ideas out to the community. One thing I will note is that this device has 32 channels, so I need to be very cognizant about both component cost, and component size.

Current sense circuit You can see the current sense circuit below. The dynamic range of this circuit is pretty big. It needs to measure up to 125 mA and down 100 nA. The load voltage is +/- 10 V. I was thinking about using an instrumentation amplifier with a digital potentiometer as the gain resistor. I set the reference pin to 2.5 V to give the output a 2.5 V offset. There's also an output buffer to clamp the ADC input to 0 to 5 V. Regarding the potentiometer, I would then select three resistor values to give me the gains that I desire, and then calibrate them in software.

To calibrate this I will basically store gain and offset values in the firmware to satisfy V = Gain*V_adc+offset. I understand that these are temperature dependent, and depending on how much time I can dedicate to this, I will add a polynomial factor in as well.

My concern about this design is error. Is this idea propose at any greater risk of injecting noise due to the digital signal? What about any other noise sources. I understand that temperature variation will always be a factor, is this particularly at risk of this?

I'm interested in your thoughts. Do you have any other ideas? I'll post the voltage sense circuit tomorrow.

Thank you!

FYI, I know I need caps on the power rails for the op amps and digipot. I made this schematic quickly and didn't put them in, but they'll be there in the prototype.

• Consider switching gain by selecting shunt resistor value, much less punishing on in-amp DC-offsets specification. It's easy to have make-before-break switching to allow constant through current, without the selection switch resistance appearing in the I to V equation. Jul 24, 2020 at 3:31
• How would you accomplish this? Relays are too big and expensive. Transistors are small and cheap, but a single FET or BJT won't work due to the bipolar nature of the circuit. What I need is something like an AND gate, but digital and analog make poor bedfellows. Jul 24, 2020 at 4:31
• Depends on what you are going for in terms of accuracy. High quality relays are how this is normally solved, although if you can afford the series resistance, you can put the shunts in series and use individual op-amp stages into separate ADC channels. Jul 24, 2020 at 5:00
• Is 100nA the resolution or do you actually expect to read a 100nA current to any level of accuracy? That's 330nV, which is rather on the small side. Jul 24, 2020 at 5:27
• Are you using a uC to process the ADC measurements? Jul 24, 2020 at 5:58

simulate this circuit – Schematic created using CircuitLab

Something like this would improve your dynamic range significantly.

As Dean said in the comments, this sort of switching is normally done with relays. However, there are many devices available with varying on resistance, leakage and voltage compliance available that could replace them. Look on Digikey, take your time and look thoroughly. You can buy opto isolated FET output switches if you look. You might want to look at ADG1411 (or ADGS1412 maybe better, higher current and SPI interface) type devices to see whether they might be good enough for your application, to integrate several switches into one package. Look at other manufacturers' devices as well. The ADGs are quad, logic level drive, +/- 15 V analog supply, 100 mA or 200mA per path (schematic shows two switches in parallel for the high current range with the 100 mA switch, but you could have 4 ranges with the 200 mA type), leakage in the sub and low nA range.

I've shown the low leakage BAS116 across the switches as path protection, should all switches be open at once. However, if you keep the voltage low enough, then most silicon diodes will do. Don't use schottky, much higher leakage than silicon. Interestingly, every time I've measured the leakage on silicon diodes in the 100 to 200 mV drop range, the big beefy 1N400x has been lower leakage than a 1N4148.

• I looked at using an analog switch. The problem with this is that it's very expensive. At $12 for two channels, that would add nearly$200 to the cost of the project, not to mention the additional board space. Also, the non-linear temperature response concerns me. Jul 24, 2020 at 21:04
• The advantage of using a digipot would be that I can always set it to the same settings every time, which would then set the gain of the instrumentation amplifier. There would be some temperature variation, but it would be linear (and it's not huge with that chip). The downside of this is that it caps the maximum gain at about 1000 due to the wiper resistance. How do you think that this is punishing on the op-amp? Jul 24, 2020 at 21:09
• @AMacDonald It depends what specification you want, I said 'punishing its offset specification'. 100 nA in 3.3 ohms is 0.33 uV. The INA2126 has an offset voltage tempco of up to 3 uV per C. While you can calibrate out the 250 uV offset voltage, you can't calibrate out the tempco, so with only 0.2 C temperature change, you wouldn't be able to tell the difference between +100 nA and -100 nA. If you're happy with that temperature sensitivity, then go right ahead with a fixed shunt resistor. I'm not sure I'd say I was measuring down to 100 nA unless I had 100x better performance at 100nA. Jul 25, 2020 at 8:57
• Thanks for the clarification. Certainly agree with you that the voltage across the sense resistor would need to be greater. I think I found a chip that might solve many of my problems. Analog's ADA4254 and TI's PGA280 are virtually identical. They're fancy, digital, two channel op-amps, programmable gain op-amps. Moreover, the two channels are digitally selectable and there are GPIOs as well. Jul 25, 2020 at 19:14
• I think I've come up with a solution: have two shunts in parallel, one 8 O and one 3 kO. The 8 O shunt will be connected to two parallel switches (for current purposes) in an ADG1414. Each chip can be used for 4 channels, which would mitigate the cost. The 8 O resistor would be used for measurements between 100 uA and 125 mA, and the 3 kO resistor would be used for measurements between 300 uA and 100 nA Jul 25, 2020 at 20:24