# how to optimize for multistage gain selection

Started by April 17, 2019
```On 4/17/19 6:24 PM, al.basili@gmail.com wrote:
> I'm trying to design a two stage amplifier for a sensor readout and I would like those stages to be configurable, but I also need to have the overall gain vs. configuration curve to be such that every new step is ~5% increase w.r.t. the previous.
>
> So let's say I have 3 control bits on the first amplifier and 4 for the second, how would I design the set of values those gains need to be at? Is there an algorithm to do that?
>
> I'm currently guesstimating it, but I doubt there's no formal method to do so.
> Any pointer/comment is appreciated.
>

The noise figure of the second amp in a chain is divided by the gain of
the first amp in the chain, so assuming 0000000 is unity gain of the
cascade, or some fixed total minimum gain, and 1111111 is max you can
narrow down your choices by when you need 3 control bits or less worth
of gain compared to that there's no sense for the second amp in the
chain to be anything but the buffer.

it's not the first amp in the cascade that's just going to sit there
with minimum or unity gain doing fuck all and let the second just
amplify its noise!
```
```On Thursday, April 18, 2019 at 11:17:23 AM UTC+10, bitrex wrote:
> On 4/17/19 8:45 PM, Clifford Heath wrote:
> > On 18/4/19 8:24 am, al.basili@gmail.com wrote:
> >> I'm trying to design a two stage amplifier for a sensor readout and I
> >> would like those stages to be configurable, but I also need to have
> >> the overall gain vs. configuration curve to be such that every new
> >> step is ~5% increase w.r.t. the previous.
> >>
> >> So let's say I have 3 control bits on the first amplifier and 4 for
> >> the second, how would I design the set of values those gains need to
> >> be at? Is there an algorithm to do that?
> >>
> >> I'm currently guesstimating it, but I doubt there's no formal method
> >> to do so.
> >> Any pointer/comment is appreciated.
> >>
> >
> > Gain is easy; stepped attenuation is easy. Stepped gain is usually a bad
> > idea because it either changes the input impedance or lengthens and adds
> > reactance to the feedback path.
> >
> > Use fixed gain and stepped attenuation.
>
> If low noise is a requirement, and in the case of a sensor readout it
> sounds like it is, then you have to think carefully about how you do
> your post-gain attenuation - no sense in using a quiet amplifier and
> input circuit design if you're just going to throw away your SNR in a
> noisy attenuator.
>
> At a minimum you'd probably want a low impedance attenuation so you
> don't add self-noise from the attenuator but if the application is low
> power that can also kill the power budget.

If you are working with alternating signals, tapped inductors can be rather nicer dividers than resistor strings.

Properly wound ratio transformers give stable divide ratio to one part in 10^7, the resistive component (and the cosnequent Johnson noise) can be low, and - if the inductance is high enough - they don't have to consume much power.

Getting them wound is a pain - John Larkin (for instance)avoids purpose wound components like the plague - but for tricky jobs it could be worth the trouble.

> depending on specifics of application we don't know I think it's a toss
> up as to whether stepped gain or stepped attenuation will be easier. a
> rule of thumb of low noise measurements is DONT throw away gain
> cavalierly once you've worked hard to bring a small signal up quietly,
> that shit is precious.

Absolutely.

--
Bill Sloman, Sydney

```
```al.basili@gmail.com wrote in

> I'm trying to design a two stage amplifier for a sensor readout
> and I would like those stages to be configurable, but I also need
> to have the overall gain vs. configuration curve to be such that
> every new step is ~5% increase w.r.t. the previous.
>
> So let's say I have 3 control bits on the first amplifier and 4
> for the second, how would I design the set of values those gains
> need to be at? Is there an algorithm to do that?
>
> I'm currently guesstimating it, but I doubt there's no formal
> method to do so. Any pointer/comment is appreciated.
>

school coursework question?
```
```> >
>
> Express the gains that you want in decibels, dB.
>

+1 !

m
```
```Easy. 3 bits of 5% each is 1.05^1, 1.05^2 and 1.05^3 gain per position.  Put
those on the first, I suppose.  (It doesn't matter which amp gets the LSBs
and HSBs, but for noise purposes it is desirable to have at least a modest
amount of gain in the first amp, and to use a lower noise amp or
architecture there.)  Put the rest (1.05^4, etc.) on the other.

If BW per stage is poor, consider even using one more stage, or optimizing
the GBW of the two stages and using an attenuator to reach the lowest steps
(in which case you'll use steps of 1.05^-1 and so on to undo the base gain,
which equals the total attenuation).

Alternately, get a log amp that's analog or digitally controlled; these
normally have a generous tempco, but it may be reasonable to compensate
that.

Tim

--
Seven Transistor Labs, LLC
Electrical Engineering Consultation and Design
Website: https://www.seventransistorlabs.com/

<al.basili@gmail.com> wrote in message
> I'm trying to design a two stage amplifier for a sensor readout and I
> would like those stages to be configurable, but I also need to have the
> overall gain vs. configuration curve to be such that every new step is ~5%
> increase w.r.t. the previous.
>
> So let's say I have 3 control bits on the first amplifier and 4 for the
> second, how would I design the set of values those gains need to be at? Is
> there an algorithm to do that?
>
> I'm currently guesstimating it, but I doubt there's no formal method to do
> so.
> Any pointer/comment is appreciated.

```
```On 4/18/19 11:05 AM, Tim Williams wrote:
> Easy. 3 bits of 5% each is 1.05^1, 1.05^2 and 1.05^3 gain per position.
> Put those on the first, I suppose.&#2013266080; (It doesn't matter which amp gets
> the LSBs and HSBs, but for noise purposes it is desirable to have at
> least a modest amount of gain in the first amp, and to use a lower noise
> amp or architecture there.)&#2013266080; Put the rest (1.05^4, etc.) on the other.
>
> If BW per stage is poor, consider even using one more stage, or
> optimizing the GBW of the two stages and using an attenuator to reach
> the lowest steps (in which case you'll use steps of 1.05^-1 and so on to
> undo the base gain, which equals the total attenuation).
>
> Alternately, get a log amp that's analog or digitally controlled; these
> normally have a generous tempco, but it may be reasonable to compensate
> that.
>
> Tim
>

I think it makes more sense from a noise perspective to have the first
amp have a stage that makes it so the 0b0000001 word ends up with 1.05

And then interleave the gains somehow basically so you don't end up with
the situation where you have say 0b10000001 and only have 5% gain in the
first stage and all the rest in the second. Should be the other way
around, the first stage should be the "coarse" control and the second
the "fine tune" IMO
```
```On Thursday, April 18, 2019 at 12:35:29 PM UTC-4, bitrex wrote:
> On 4/18/19 11:05 AM, Tim Williams wrote:
> > Easy. 3 bits of 5% each is 1.05^1, 1.05^2 and 1.05^3 gain per position.
> > Put those on the first, I suppose.&nbsp; (It doesn't matter which amp gets
> > the LSBs and HSBs, but for noise purposes it is desirable to have at
> > least a modest amount of gain in the first amp, and to use a lower noise
> > amp or architecture there.)&nbsp; Put the rest (1.05^4, etc.) on the other.
> >
> > If BW per stage is poor, consider even using one more stage, or
> > optimizing the GBW of the two stages and using an attenuator to reach
> > the lowest steps (in which case you'll use steps of 1.05^-1 and so on to
> > undo the base gain, which equals the total attenuation).
> >
> > Alternately, get a log amp that's analog or digitally controlled; these
> > normally have a generous tempco, but it may be reasonable to compensate
> > that.
> >
> > Tim
> >
>
> I think it makes more sense from a noise perspective to have the first
> amp have a stage that makes it so the 0b0000001 word ends up with 1.05
>
> And then interleave the gains somehow basically so you don't end up with
> the situation where you have say 0b10000001 and only have 5% gain in the
> first stage and all the rest in the second. Should be the other way
> around, the first stage should be the "coarse" control and the second
> the "fine tune" IMO

So what happens when the coarse control is set to minimum gain?

The reality is the OP has not come back to discuss his homework.  The professor didn't indicate enough of the problem to bother with considering the need to minimize noise.

--

Rick C.

- Get a 1,000 miles of free Supercharging
- Tesla referral code - https://ts.la/richard11209
```
```On 4/18/19 2:22 PM, gnuarm.deletethisbit@gmail.com wrote:
> On Thursday, April 18, 2019 at 12:35:29 PM UTC-4, bitrex wrote:
>> On 4/18/19 11:05 AM, Tim Williams wrote:
>>> Easy. 3 bits of 5% each is 1.05^1, 1.05^2 and 1.05^3 gain per position.
>>> Put those on the first, I suppose.&nbsp; (It doesn't matter which amp gets
>>> the LSBs and HSBs, but for noise purposes it is desirable to have at
>>> least a modest amount of gain in the first amp, and to use a lower noise
>>> amp or architecture there.)&nbsp; Put the rest (1.05^4, etc.) on the other.
>>>
>>> If BW per stage is poor, consider even using one more stage, or
>>> optimizing the GBW of the two stages and using an attenuator to reach
>>> the lowest steps (in which case you'll use steps of 1.05^-1 and so on to
>>> undo the base gain, which equals the total attenuation).
>>>
>>> Alternately, get a log amp that's analog or digitally controlled; these
>>> normally have a generous tempco, but it may be reasonable to compensate
>>> that.
>>>
>>> Tim
>>>
>>
>> I think it makes more sense from a noise perspective to have the first
>> amp have a stage that makes it so the 0b0000001 word ends up with 1.05
>>
>> And then interleave the gains somehow basically so you don't end up with
>> the situation where you have say 0b10000001 and only have 5% gain in the
>> first stage and all the rest in the second. Should be the other way
>> around, the first stage should be the "coarse" control and the second
>> the "fine tune" IMO
>
> So what happens when the coarse control is set to minimum gain?

idk, what would be wrong with that? why not have the bits of the first
amp have a geometric control law starting from 5% gain and the second
have a linear starting from unity gain. like maybe 5%, 10%, 20%, 40% in
the first and 0%, 5%, 10%, 15%, in the second

there's no rule that I saw that a certain group of bits of a given
binary word must map to the control input of a particular amp just that
the cascade gain rises in 5% increments as it goes 0b0000001, 0b0000010,
0b0000011...and with the geometric-linear control laws you can find some
mapping that gives 5% increase with each step such that the first stage
is doing the bulk of the gain.

> The reality is the OP has not come back to discuss his homework.  The professor didn't indicate enough of the problem to bother with considering the need to minimize noise.
>

There are a lot of ways you could do what's requested, even wrt noise
but it sounds like the end result is a silly circuit that's hard to find
much real-world use for. why does the first amp have to have 3 bits and
the second four other than that's some contrived constraint
```
```On 4/18/19 3:23 PM, bitrex wrote:
> On 4/18/19 2:22 PM, gnuarm.deletethisbit@gmail.com wrote:
>> On Thursday, April 18, 2019 at 12:35:29 PM UTC-4, bitrex wrote:
>>> On 4/18/19 11:05 AM, Tim Williams wrote:
>>>> Easy. 3 bits of 5% each is 1.05^1, 1.05^2 and 1.05^3 gain per position.
>>>> Put those on the first, I suppose.&nbsp; (It doesn't matter which amp gets
>>>> the LSBs and HSBs, but for noise purposes it is desirable to have at
>>>> least a modest amount of gain in the first amp, and to use a lower
>>>> noise
>>>> amp or architecture there.)&nbsp; Put the rest (1.05^4, etc.) on the other.
>>>>
>>>> If BW per stage is poor, consider even using one more stage, or
>>>> optimizing the GBW of the two stages and using an attenuator to reach
>>>> the lowest steps (in which case you'll use steps of 1.05^-1 and so
>>>> on to
>>>> undo the base gain, which equals the total attenuation).
>>>>
>>>> Alternately, get a log amp that's analog or digitally controlled; these
>>>> normally have a generous tempco, but it may be reasonable to compensate
>>>> that.
>>>>
>>>> Tim
>>>>
>>>
>>> I think it makes more sense from a noise perspective to have the first
>>> amp have a stage that makes it so the 0b0000001 word ends up with 1.05
>>>
>>> And then interleave the gains somehow basically so you don't end up with
>>> the situation where you have say 0b10000001 and only have 5% gain in the
>>> first stage and all the rest in the second. Should be the other way
>>> around, the first stage should be the "coarse" control and the second
>>> the "fine tune" IMO
>>
>> So what happens when the coarse control is set to minimum gain?
>
> idk, what would be wrong with that? why not have the bits of the first
> amp have a geometric control law starting from 5% gain and the second
> have a linear starting from unity gain. like maybe 5%, 10%, 20%, 40% in
> the first and 0%, 5%, 10%, 15%, in the second
>
> there's no rule that I saw that a certain group of bits of a given
> binary word must map to the control input of a particular amp just that
> the cascade gain rises in 5% increments as it goes 0b0000001, 0b0000010,
> 0b0000011...and with the geometric-linear control laws you can find some
> mapping that gives 5% increase with each step such that the first stage
> is doing the bulk of the gain.
>
>
>> The reality is the OP has not come back to discuss his homework.&nbsp; The
>> professor didn't indicate enough of the problem to bother with
>> considering the need to minimize noise.
>>
>
> There are a lot of ways you could do what's requested, even wrt noise
> but it sounds like the end result is a silly circuit that's hard to find
> much real-world use for. why does the first amp have to have 3 bits and
> the second four other than that's some contrived constraint

maybe being controlled from serial bytes or a single 8 bit port or
something.
```
```On Thursday, April 18, 2019 at 3:23:57 PM UTC-4, bitrex wrote:
> On 4/18/19 2:22 PM, gnuarm.deletethisbit@gmail.com wrote:
> > On Thursday, April 18, 2019 at 12:35:29 PM UTC-4, bitrex wrote:
> >> On 4/18/19 11:05 AM, Tim Williams wrote:
> >>> Easy. 3 bits of 5% each is 1.05^1, 1.05^2 and 1.05^3 gain per position.
> >>> Put those on the first, I suppose.&nbsp; (It doesn't matter which amp gets
> >>> the LSBs and HSBs, but for noise purposes it is desirable to have at
> >>> least a modest amount of gain in the first amp, and to use a lower noise
> >>> amp or architecture there.)&nbsp; Put the rest (1.05^4, etc.) on the other.
> >>>
> >>> If BW per stage is poor, consider even using one more stage, or
> >>> optimizing the GBW of the two stages and using an attenuator to reach
> >>> the lowest steps (in which case you'll use steps of 1.05^-1 and so on to
> >>> undo the base gain, which equals the total attenuation).
> >>>
> >>> Alternately, get a log amp that's analog or digitally controlled; these
> >>> normally have a generous tempco, but it may be reasonable to compensate
> >>> that.
> >>>
> >>> Tim
> >>>
> >>
> >> I think it makes more sense from a noise perspective to have the first
> >> amp have a stage that makes it so the 0b0000001 word ends up with 1.05
> >>
> >> And then interleave the gains somehow basically so you don't end up with
> >> the situation where you have say 0b10000001 and only have 5% gain in the
> >> first stage and all the rest in the second. Should be the other way
> >> around, the first stage should be the "coarse" control and the second
> >> the "fine tune" IMO
> >
> > So what happens when the coarse control is set to minimum gain?
>
> idk, what would be wrong with that? why not have the bits of the first
> amp have a geometric control law starting from 5% gain and the second
> have a linear starting from unity gain. like maybe 5%, 10%, 20%, 40% in
> the first and 0%, 5%, 10%, 15%, in the second
>
> there's no rule that I saw that a certain group of bits of a given
> binary word must map to the control input of a particular amp just that
> the cascade gain rises in 5% increments as it goes 0b0000001, 0b0000010,
> 0b0000011...and with the geometric-linear control laws you can find some
> mapping that gives 5% increase with each step such that the first stage
> is doing the bulk of the gain.
>
>
> > The reality is the OP has not come back to discuss his homework.  The professor didn't indicate enough of the problem to bother with considering the need to minimize noise.
> >
>
> There are a lot of ways you could do what's requested, even wrt noise
> but it sounds like the end result is a silly circuit that's hard to find
> much real-world use for. why does the first amp have to have 3 bits and
> the second four other than that's some contrived constraint

"the first stage should be the "coarse" control "

Not sure what all you are going on about.  The point is that regardless of which you put first, it will have some lowest setting that means you get the maximum noise through it.  Designing the first amp so it has the coarse settings don't alter that issue.

One way to get around this is to give the first amp some minimum level of gain and design the second stage so it has either gain or attenuation as required.

But... none of this can really be optimized until you have an idea of what gain values are required.  It may be that the minimum gain setting already digs the signal out of the noise as much as practical.  The level of control requested was a range of nearly 500:1.  Since this is going into a display you would think the result needs to be in a range that can be digitized without much trouble, so call it 5 volts.  Then the minimum full scale signal would be 10 mV.  I don't think that needs so much concern with noise in the electronics.  Standard attention to detail should suffice.  No need for heroics I think.

BTW, the OP never said the first amp had to have 3 bits.  It was a talking point... "So let's say I have 3 control bits on the first amplifier and 4 for the second"

--

Rick C.

+ Get a 1,000 miles of free Supercharging
+ Tesla referral code - https://ts.la/richard11209
```