Amplifier  - Page 1
Forum section: electronics / projects

author: DigitalDesigner
author_rank: Contributor
timestamp: July 03, 2025, 02:35:14 am
content: Hi,I’m using a Class D amplifier (TPA2016 – see attached datasheet), powered by a 3.3V rail, to drive a coil (L1) as shown in the attached schematic. The PCB operates exclusively from a 3.3V supply, with no negative voltage rail available.I need to generate a single-ended signal that mirrors the voltage across the speaker and swinging between 0.5V minimum to 2.5V maximum. This signal will be used to drive an op-amp-based current source. I’m tapping into the Class D output because the input signal can vary in amplitude depending on the application. However, the TPA2016 includes an automatic gain control stage, which ensures that its output is more consistent and predictable than the original input signal—making it a more reliable reference for current source control.What would be a good solution to this?I initially considered using a differential amplifier, but when the op-amp's inverting input (IN–) rises above the non-inverting input (IN+), the output hits the ground rail.Thank you

author: moffy
author_rank: Super Contributor
timestamp: July 03, 2025, 05:25:45 am
content: Quote from: DigitalDesigner on July 03, 2025, 02:35:14 amIf you AC couple the output into an opamp diff amp which has a fixed bias level, say at 1.5V, that should solve the problem unless there are other issues.

author: XxMandragoraxX
author_rank: Contributor
timestamp: July 03, 2025, 07:33:52 am
content: You're using the TPA2016D2RTJ Class D amplifier powered at 3.3 V to drive a coil (L1) in a BTL (bridge-tied load) configuration, and your goal is to generate a single-ended signal that reflects the voltage across the load (OUTL+ and OUTL–), swinging between 0.5 V and 2.5 V. This signal will be used to control a current source based on an op-amp. Since the input signal to the amplifier can vary, but the TPA2016 includes an AGC (automatic gain control) stage, tapping the output provides a more stable and predictable reference. The challenge is that your system only runs on 3.3 V with no negative rail, and when you tried using a differential amplifier, the op-amp’s output saturated to ground when the inverting input exceeded the non-inverting input.The best solution is to use a differential amplifier stage with a properly set common-mode voltage reference. In your schematic, you're already filtering the Class D outputs with passive components (R66/C24 and R70/C27), which attenuate the PWM carrier sufficiently for signal extraction. You can tap the differential signal at the nodes after R66 and R70, before the coil, where the signals are already filtered. Feed these into a differential amplifier built using an RRIO (rail-to-rail input/output) op-amp like the TLV9001, MCP602, or OPA344, powered at 3.3 V. Set the common-mode voltage to 1.65 V using a resistor divider from 3.3 V to ground (two 10 kΩ resistors) and optionally buffer it with an op-amp. Use four equal resistors (e.g., 10 kΩ) in the differential amplifier to ensure a gain of 1, so the full differential swing translates directly to the output. With this setup, the op-amp can output a single-ended signal centered at 1.65 V and swing between 0.5 V and 2.5 V as desired. Make sure your op-amp is capable of outputting close to the rails and add an extra RC low-pass filter if needed to further suppress any residual PWM ripple.

author: Zero999
author_rank: Super Contributor
timestamp: July 03, 2025, 09:37:51 am
content: Quote from: DigitalDesigner on July 03, 2025, 02:35:14 amThat will work, the differential amplifier needs to be designed for single supply operation.Refer to the schematics below, for how to convert common op-amp configurations to single supply.Credit: audioguru for the original image. I added the differential schematics.In your case you'll need to add some low pass filtering to remove the PWM signal. I recommend two filters. Add an RC circuit, before the differential amplifier, to remove the highest frequency elements and a capacitor across RF, to limit the bandwidth of the amplifier, to just above the highest frequency of interest.

author: Terry Bites
author_rank: Super Contributor
timestamp: July 03, 2025, 07:54:11 pm
content: Biblical advice on single supply opamp stuff.

author: edavid
author_rank: Super Contributor
timestamp: July 03, 2025, 08:07:50 pm
content: Why is it necessary to use a differential amplifier? Aren't the 2 outputs complements of each other? What happens if you use the filtered version of only 1 output?

author: moffy
author_rank: Super Contributor
timestamp: July 03, 2025, 09:56:09 pm
content: Quote from: edavid on July 03, 2025, 08:07:50 pmWhy I would do it, differential still only uses 1 opamp with a few extra passives, the output is differential and sometimes there are common mode components on differential signals, it is a safer choice.e.g. How do you define 0V out differentially 1. Both outputs connected to Vcc 2. Both outputs connected to GND 3. Both outputs off. 4. Both outputs some other same voltage.

author: Zero999
author_rank: Super Contributor
timestamp: July 04, 2025, 07:01:01 am
content: To be succinct. Differential is better, because the output is biased at half the supply voltage, which might not be stable.

author: edavid
author_rank: Super Contributor
timestamp: July 04, 2025, 02:32:31 pm
content: Quote from: moffy on July 03, 2025, 09:56:09 pmThere can't be significant common mode components, since the output inductor/speaker would saturate.QuoteWhenever the 2 outputs have the same voltage, but a class D output by definition only has 2 states. Why does this matter?I can't see anything in the datasheet that says whether the outputs have an "off" state. Perhaps in shutdown.Quote from: Zero999 on July 04, 2025, 07:01:01 amCan you explain this? Why would the single ended output level be unstable, and why would it matter?Anyway, I hope OP will return and explain his reasoning.

author: fourfathom
author_rank: Super Contributor
timestamp: July 04, 2025, 03:25:51 pm
content: Quote from: edavid on July 04, 2025, 02:32:31 pmA common mode output offset won't cause the load inductor to saturate -- a differential offset will though.Each output may have distortion caused by asymmetrical +/- drive strengths, but as long as the two outputs are matched this distortion will cancel out. This is one reason why you might prefer using the differential amplifier mentioned up-thread.

author: edavid
author_rank: Super Contributor
timestamp: July 04, 2025, 03:31:23 pm
content: Quote from: fourfathom on July 04, 2025, 03:25:51 pmThat confuses me - wouldn't the asymmetry add rather than cancel?

author: fourfathom
author_rank: Super Contributor
timestamp: July 04, 2025, 03:54:48 pm
content: Quote from: edavid on July 04, 2025, 03:31:23 pmAsymmetry will cause a common-mode offset in a Class-D (switching) amp. The amp has two drivers, labeled (+) and (-), but these are identical totem pole output stages. Example: if the totem pole design has a higher saturation voltage in the PMOS FET connection to V+ and a lower saturation voltage in the NMOS connection to V- (or ground) then there will be an average offset at the output of that driver. But there will be an identical (virtually) offset at the other driver, so the net is a common-mode offset. And the load is always driven by a PMOS and NMOS in series in both the + and - polarity of the switching cycle so there is no differential distortion.We've been discussing a Class-D amplifier, but the same will apply for a linear differential amp.

author: mtwieg
author_rank: Frequent Contributor
timestamp: July 04, 2025, 04:52:57 pm
content: Knowing a bit about class D amp chips, I think it's sensible to use a difference amp connected to both outputs, not just one. Often these application-specific chips have some pretty novel ways of optimizing performance which may cause the output to not be purely differential (for example, at low volume it may only modulate one side while keeping the other static at midsupply). Hard to know what to expect from the chip without thorough testing, as this sort of behavior is often never mentioned in the datasheet (why would it?).So basically what the OP wants is a difference amplifier circuit like the bottom right one in Zero999's post above. The output bias point is defined by the voltage where where the lower "+6V" label is. To get an output swing of 0.5-2.5V, you want that voltage to be 1.5V DC (can create this with a voltage divider like what's shown in that example). As for actual resistor values, no way to know that without more info on the output voltage coming from the chip.

author: Zero999
author_rank: Super Contributor
timestamp: July 04, 2025, 06:16:20 pm
content: Quote from: edavid on July 04, 2025, 02:32:31 pmNo, because common mode means the voltage on both outputs changes by the same amount, so there's no change in potential difference between them.QuoteIf the power supply varies, the output voltage, relative to 0V will vary. It won't affect the speaker because both outputs vary by the same amount, but it will affect a single ended amplifir connected to an output.

author: DigitalDesigner
author_rank: Contributor
timestamp: July 05, 2025, 12:15:56 am
content: Thank you all for the feedback and teh explanations!Attached is the updated schematic as per your suggestions. Is my interpretation correct?@XxMandragoraxX, You mentioned using four equal resistors, which results in a gain of 1. However, considering that the differential voltage across the speaker can reach up to 3.3V, shouldn't the gain be no more than 0.5—perhaps even closer to 0.4? I'm thinking along these lines because the virtual ground (i.e., the bias point of the op-amp’s non-inverting input) is set to 1.5V, and the entire PCB is powered from a 3.3V supply.After doing some research I came up with those values to pass frequencies up to 20KHz (3dB point at 20KHz). And added also the 820pF caps C6 and C7 in parallel with the two feedback resistors R1 and R6. Assuming a gain of 1 - i.e. regardless of my gain question above - are they sized correctly?@Zero999, thank you for those schematics table, very helpful in understanding several things!@TerryBites, thank you for the PDF.@edavid, my reasoning for choosing the differential op-amp? Just because the speaker is not referenced/connected to ground, but I was asking here for advice because I wasn't sure.

author: fourfathom
author_rank: Super Contributor
timestamp: July 05, 2025, 03:10:10 am
content: In this new schematic C5 and C6 (2.4 nF capacitors to ground) will need to be very well matched to avoid common-to-differential mode conversion. You might instead use a single 10nF capacitor between the R2 and R5 outputs, with no ground connection.

author: edavid
author_rank: Super Contributor
timestamp: July 05, 2025, 03:51:48 am
content: Quote from: DigitalDesigner on July 05, 2025, 12:15:56 amThat doesn't matter, since the IC outputs are referenced to ground. I think you could just connect to one of them and get good results. Give it a try.

author: Zero999
author_rank: Super Contributor
timestamp: July 05, 2025, 12:33:17 pm
content: Quote from: fourfathom on July 05, 2025, 03:10:10 amFor best common mode rejection ratio, all of the capacitors in the differential amplifier need to be well-matched, along with the resistors, but in this case, I don't think capacitor matching is super-critical, so long as the upper cut-off is well above the frequency of interest, because the capacitors will have a very low impedance, compared to the resistors.

author: mtwieg
author_rank: Frequent Contributor
timestamp: July 05, 2025, 01:23:06 pm
content: Quote from: DigitalDesigner on July 05, 2025, 12:15:56 amThe output is not rail-to-rail. The datasheet doesn't directly say it, but you can infer its output range from the curves of THD. For 3.3V, I'd estimate your max differential output voltage will be just 2.6V. Best to measure it for yourself though.

author: fourfathom
author_rank: Super Contributor
timestamp: July 05, 2025, 02:50:04 pm
content: Quote from: Zero999 on July 05, 2025, 12:33:17 pmYes, good point. I was picking on the capacitors because the cap tolerance / stability is likely *much* worse than that of the resistors. But as you point out, at least at the 300 KHz switching frequency, the cap impedance is pretty low. And at 300 KHz, even a 5% variation in cap value only gives about a 1/2 dB amplitude difference and a 0.2 degree phase diff. So it depends on the amount of switching signal gets through to the diff amp, and if that matters.

author: DigitalDesigner
author_rank: Contributor
timestamp: July 06, 2025, 10:29:30 pm
content: Thank you all again for the additional clarifications!@mtwieg mentioned that the voltage across the speaker might be only ±2.6 V (rather than the 3.3 V I initially thought), so I’m still trying to understand the differential amplifier gain.It’s currently set to 1 as @XxMangragoraxX suggested, but — unless I’m misunderstanding how this configuration works — wouldn’t that mean the output would be 1.5 V (input bias) with an additional swing of +/-2.6 V which would to exceed the 3.3 V supply rail (1.5V + 2.6V = 4.1V) and go below GND (1.5V - 2.6V = -1.1V)?Thanks again, everyone!