element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Community Hub
Community Hub
Member's Forum Programable Gain Amplifier
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Leaderboard
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Community Hub to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 14 replies
  • Subscribers 616 subscribers
  • Views 663 views
  • Users 0 members are here
Related

Programable Gain Amplifier

scottiebabe
scottiebabe 2 months ago

I have a project where I am in need of a amplifier with digitally adjustable gain.

There are many ways to construct a variable gain amplifier, one solution involves using a digital potentiometer in the negative feedback path around an op-amp.

A simplified schematic is shown below

image

Image sourced from Application note: ww1.microchip.com/.../01316A.pdf

The closed loop gain of the amplifier is now a function of the digiPOT’s wiper position:

image
Table for an 8-bit digiPOT, table 12 for a 7-bit device is full of mistakes

Half of the wiper codes map to closed loop gains between 1 and 2. There isn’t a lot of choice for larger gains after a gain of 64 then next available choice is 128.

Pretty Neat! I don’t happen to need more than 20 kHz of bandwidth, so finding an op-amp with a gain-bandwidth product greater than 20kHz*128 = 2.6 MHz is not a problem.

Breadboard

It just so happens I have some digital potentiometers laying around.
Specifically, the Microchip MCP4131 digital POT, which has 7-bit resolution and a total ladder resistance of 10k.

https://ww1.microchip.com/downloads/aemDocuments/documents/OTH/ProductDocuments/DataSheets/22060b.pdf

I also have some Renesas ISL28291 dual-opamps.

Both have been sent to me by element14 (and the cool breadbroad, thanks element14!)

I tossed them onto a breadboard and used a RPI pico to interface with the MCP4131 (github.com/.../main)

image


Just like a rotary potentiometer the digiPOT has 3 terminals: A, B, W

image

Instead of a having a continuous resistance track and a movable wiper contact, the digi pot has 128 small resistors in a series string and an analog mux that can select any of the 129 tap points.

If you apply a fixed potential across the A and B terminals, then with the wiper to set to mid-scale code, the output voltage is half the input. At a wiper code of 0, ideally the wiper voltage should be 0 (unfortunately due to the resistance of the terminal disconnect switch it slightly greater than 0).

User beware, behavior at the extreme tap-points is worse than advertised.

At a wiper code of 127, I measured a gain of 80x instead of the ideal value of 128x. Disappointing.

There also isn’t a lot of ‘gain resolution’, the previous wiper code of 126 provides an ideal gain of 64x.

Compounding 2 for more gain and resolution

To achieve a higher total gain and have more gain steps to choose from, I put 2 in series.

image

Now with 2 stages, there are 5363 unique gain values.

image

The vast majority of the unique gains are below 50 dB. Above 50 dB there are 55 unique gain values.

Here is a scopeshot of the PGA cycling between a gain of 1 and 6

image

The brief excursion on the scope plot is python being slow, micropython takes its sweet time between the spi write of the first and second digiPOT.

image

In summary, I am pretty happy with the dynamic range of the amplifier. The amplifier can be programed to provide gains of anywhere between unity and 10000x with 20 kHz of bandwidth and an input referred noise of approximately 3nV/rootHz.

Not bad for parts I had laying around. All the big name semi’s have PGAs with lower noise and more bandwidth all integrated within a single IC for reasonable prices. So, if you need one, you can shop around for a pre-engineered solution. 

  • Sign in to reply
  • Cancel
  • wolfgangfriedrich
    wolfgangfriedrich 2 months ago in reply to scottiebabe

    Yes, 1st rule of quite opamp circuits: don't put gain on the noise. 

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • scottiebabe
    scottiebabe 2 months ago in reply to wolfgangfriedrich

    This is wonderful!

    As you say the first amplifier largely defines the effective noise figure of the full circuit. When I created the gain and pot code LUT, when possible I chose codes that maximized the gain of the first op-amp.

    At lower gains, the input referred noise increases, but with less gain the total output noise decreases. So if you imagine a gain being chosen to level the output to 1 Vrms, the SNR improves.

    One reference point to consider is the PGA2505

    image

    It's a PGA with 60 dB of adjustable gain and has the following integrated input referred noise

    image

    Which is about 500nVrms (over 20 kHz of bandwidth) at the maximum gain setting. As the input signal gets larger and requires less gain the noise figure and final SNR improves

    image

    The bottom line is the noise limit (4vrms is cheating, 500 nVrms gained up by 60 dB is 500 uVrms on the output or an snr of -66 dB referenced to a 1Vrms output)

    The schematic I posted has a 1.6 kHz HPF on the input, so the input referred noise below that frequency gets worse because the input referred noise is the noise on the output divided gain (below 1.6kHz the amplifier is rejecting not amplifying).

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Cancel
  • wolfgangfriedrich
    wolfgangfriedrich 2 months ago in reply to wolfgangfriedrich

    I took the exact circuit into LTspice and did a input referred noise simulation. Just replace the digi-pot with a pair of coupled resistors and a step list of parameters.
    image
    With resistors away from maximum gain, the minimum noise is around 4.6 nV/rtHz (-166 dBV/rtHz) at 70 kHz, which is pretty good. At the datasheet standard frequency of 1 kHz it is still 7.9 nV/rtHz (-159 dBV/rtHz).
    image
    The very minimum of the noise happens when one opamp is at maximum gain and the noise contribution of the opamp becomes negligible. 1.8 nV/rtHz (-175 dBV/rtHz) at 90 kHz. 

    At lower frequencies, the noise gets worse quickly. It is really difficult to get good noise performance at frequencies < 20 Hz. Audiophiles/fools might not care, but scientists do. It is usually a J-FET + low noise opamp combination with really big caps at the bias and reference voltages. Other components are noisy too, especially resistors. And the supply rail will contribute as well. 
    This was fun. 

    PS: I don't see how I can add attachments to comments; to share my LTspice sources. Any helpful hints?

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • Cancel
  • BigG
    BigG 2 months ago

    Your post has been enlightening. I recently learnt the hard way the importance of designing for capacitive loading when it comes to high sensitivity opamps - A case of RTFM... I failed to read the TSZ1x datasheet's specific section on this... tricky to solve too. I hadn't considered the Renesas options before and they're looking much better at dealing with capacitance. TSZ1x amps are also 400kHz GBW.

    image

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • wolfgangfriedrich
    wolfgangfriedrich 2 months ago

    I am very interested in ultra-low noise opamps. I might plug this circuit into LTspice to see if the INOISE really lands close to 3nV/rtHz.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Cancel
  • scottiebabe
    scottiebabe 2 months ago in reply to michaelkellett

    That's why I included it, so I can use wiper code 128 as a try and see, for the parts I had used it allows for a gain setting over 100x but not much more

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • scottiebabe
    scottiebabe 2 months ago in reply to SensoredHacker0

    The op-amp I used has an average PSRR/CMR, so while the op-amp may reject power supply noise by 60 - 70 dB, at the maximum gain setting it gets amplified back up. Instrumentations amps generally have much better specs in that regard.

    You may used fixed gain amps with attenuators, or step attenuators in the feedback path, or pre-engineered parts. 

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • michaelkellett
    michaelkellett 2 months ago in reply to scottiebabe
    scottiebabe said:

    I guesstimate the end terminal switch had about 1/2 RS of resistance. So instead of a gain of 1+ 127/1, it was closer to 1+127/1.5

    Buried in datasheet, the zero-code offset error could be up to 2 LSB

    The 22R resistor will make this worse (but it does give you some control of the gain if you select the 'zero' position of the wiper.

    MK

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • scottiebabe
    scottiebabe 2 months ago in reply to dang74

    Very clever observation!

    They post fancy INL/DNL graphs, which in general are accurate except for the very last couple tap points

    image

    The first few and last few codes are worse.

    image

    I guesstimate the end terminal switch had about 1/2 RS of resistance. So instead of a gain of 1+ 127/1, it was closer to 1+127/1.5

    Buried in datasheet, the zero-code offset error could be up to 2 LSB

    image

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • scottiebabe
    scottiebabe 2 months ago in reply to michaelkellett

    Great advise, I could have expanded more on GBW product. 

    At maximum gain the upper -3db point is still largely determined by the RC low pass filters(luckily the op-amps are plenty fast)

    Here is a frequency sweep (sorry my o-scope doesn't have social media upload to tik-tok buttons, so a cheesy video instead)

    You don't have permission to edit metadata of this video.
    Edit media
    x
    image
    Upload Preview
    image

    *There is an inline 50 dB PAD before the DUT, so the input is 30 uVrms 

    Blue: Input before PAD

    Yellow: DUT Output

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube