EEVblog Electronics Community Forum

Electronics => Projects, Designs, and Technical Stuff => Topic started by: i509VCB on December 04, 2024, 06:50:29 am

Title: Poor man's programmable gain amplifier
Post by: i509VCB on December 04, 2024, 06:50:29 am
I have a current sensing circuit below.

[attach=1]

The first stage uses a MAX49925 which is a current sense amp with a programmable gain. Because I have an ADC with an ENOB of 8.6 I need the extra gain to see lower current values.

However for my desired range of 100 mA to ~7 uA I need more than the gain of 100. Another one of these would cost quite a bit more than reasonable. Other programmable gain amps I've found cost about the same. In the image above my thought was that the N channel mosfet when enabled would effectively create a unity gain amp. The amp in the second stage is just some cheap amp since the first stage does the majority of the precise current measurement. Is the poor man's programmable gain amplifier a bad idea to build and should I just do something else there?

Title: Re: Poor man's programmable gain amplifier
Post by: Mahagam on December 04, 2024, 07:39:19 am
R5 placed incorrectly
Title: Re: Poor man's programmable gain amplifier
Post by: iMo on December 04, 2024, 09:34:45 am
What is your ADC?
Title: Re: Poor man's programmable gain amplifier
Post by: Sacodepatatas on December 04, 2024, 09:42:15 am
The feedback network in the second opamp does nothing. R5 is connected like it was an output load, and the output is connected to Vin- either throught R4 or Q1. No difference in gain though. I see you intended to make R4/R5 a resistor divider as the feedback gain network. So then you should connect R4 between Vo and R5, and then to Vin-. Q1 can be placed, either shortcircuiting R4 for decreasing gain to 1, or between R5 and ground (i prefer this because then there is always the same voltage across Q1's gate and source), in the last case, gain control logic is reversed.
Title: Re: Poor man's programmable gain amplifier
Post by: Kleinstein on December 04, 2024, 01:46:25 pm
The MAX49925 is a rather special amplifier, with a large common mode range well beyong the supplies, vey good CMRR, but as a downside also relatively high noise. Don't take the shown equivalent circuit literal - the actual ciruict can look quite different, e.g. using switched capacitors.
It makes sense to have some gain after the amplifier, as the voltage range for the output is rather limited (< +-800 mV for accuracy specs).

Depending on the required bandwidth the amplifier may be the right choice. Ane may want switching of the shunt(s) insteat of a fixed shunt and variable gain. Another question is the common mode voltage at the shunt.
Title: Re: Poor man's programmable gain amplifier
Post by: Zero999 on December 04, 2024, 05:55:25 pm
Put the MOSFET in series with the low side, of the lower resistor. The gain will then be higher, when the transistor is on.
[attachimg=1]
Title: Re: Poor man's programmable gain amplifier
Post by: i509VCB on December 04, 2024, 07:21:53 pm
R5 placed incorrectly

Yes that was a dumb mistake on my part. Probably shouldn't design circuits at 2am.

What is your ADC?

Currently I am using the ADC on an RP2040 - it's ENOB is 8.6.
Title: Re: Poor man's programmable gain amplifier
Post by: i509VCB on December 04, 2024, 07:37:37 pm
The MAX49925 is a rather special amplifier, with a large common mode range well beyong the supplies, vey good CMRR, but as a downside also relatively high noise. Don't take the shown equivalent circuit literal - the actual ciruict can look quite different, e.g. using switched capacitors.
It makes sense to have some gain after the amplifier, as the voltage range for the output is rather limited (< +-800 mV for accuracy specs).

My intention with the MAX49925 is that it appears to be able to survive my possible cases of user error (if I connected the probes backwards).

Is your concern about noise going to be an issue for uA level sensing? I do understand that the part in question is really for multi-amp sensing.

This is definitely going off topic from the original thread topic. Maybe I should just make an actual thread for this question so people don't skip this all.

Depending on the required bandwidth the amplifier may be the right choice. [One] may want switching of the shunt(s) [instead] of a fixed shunt and variable gain. Another question is the common mode voltage at the shunt.

I fully expect I'm going to need to test the circuits regardless of what approach I take. My initial test circuit here kind of meets the range, but I would like a higher current range which might force this still.
Title: Re: Poor man's programmable gain amplifier
Post by: Kleinstein on December 04, 2024, 08:11:01 pm
The noise problem would be a thing at the low end of the setup and also when a fast measurement is wanted. If this is more mA or µA depends on the shunt. For small currents there is the bias / input current to take into account, even though this is mainly linear.
Usually there is a good way to protect the shunt with diodes. It still depends if the current to measure is isolated from the measurement system or connected (e.g. use the same power supply).

With nosie from a bit over 100 nV/sqrt(Hz). This translates to a bit over 100 nA/sqrt(Hz). So OK to resolve some 1 µA up to maybe 30 readings per second. It can be quite a bit worse with a sampling ADC if there is no AA filter.
Title: Re: Poor man's programmable gain amplifier
Post by: Terry Bites on December 06, 2024, 07:45:56 pm
Here's my misery free, full-on lousy never buys a round 3 decade PGA.

Analog switch resistance is almost entirely eliminated from the gain eqn.
So you can go down the bins to find them, CD4016s or something.
You can hammer down on noise by limiting the bandwidth to as low as you can bear.