Class D audio amp strategy for ESP32 - Page 1
Forum section: electronics / general

author: viper
author_rank: Regular Contributor
timestamp: September 01, 2025, 03:05:06 pm
content: I need a 5-10W audio amp strategy. I have decided to ignore the ESP internal DAC/ADC for any of this as it's just not that great. I'd like to employ I2S tech for this. I certainly would run dedicated power to the amp section. Howevever, I'd like to pinch pennies and complexity where I can. I know there are some smaller "one and done" chips but doubting they have enough authority. Maybe for testing though. I was sort of hoping for an 'integrated solution', but otherwise open to other solutions.Input voltage I think I will have to run higher, like 9V-12V. Only one channel, probably 4ohm impedance.Where I am at the moment is just I2S from ESP32 to compatible DAC, then......I don't know yet.

author: langwadt
author_rank: Super Contributor
timestamp: September 01, 2025, 03:43:20 pm
content: second hit on google,https://www.ti.com/lit/ds/symlink/tas5760ld.pdf

author: tooki
author_rank: Super Contributor
timestamp: September 01, 2025, 06:28:56 pm
content: There are gazillions of options.Take a look at the ESP32-LyraT and -Lyrat-mini boards (the full schematics are on the Espressif website). They’re ESP32 dev boards specific to audio development, and show one way to do it.

author: viper
author_rank: Regular Contributor
timestamp: September 01, 2025, 09:31:49 pm
content: Quote from: tooki on September 01, 2025, 06:28:56 pmAppreciate. I was leaning towards keeping the audio amp section mostly discrete for now, and I need to use the esp32-s3 for some additional functionality. What I have been looking at is the TPA3110 variants out there. From what I gather, they have pretty solid sonics and good SNR. I wasn't sure if this sector (amps) is really flooded with options? If so, I might need to sort by chips, in which it seems like that TI chip is good stuff?Reasons for the discrete amp is I don't yet know how much power will be needed for this project. Trying to achieve a certain db at a small range of frequencies, not listening to music.

author: tooki
author_rank: Super Contributor
timestamp: September 01, 2025, 10:41:42 pm
content: Quote from: viper on September 01, 2025, 09:31:49 pmThe TPA3110 is a bit old.There are other members of the family that are newer and use less energy when idle, like the TPA3126D2 and TPA3128D2 which I’ve used very successfully. (The TPA3156D2 and TPA3129D2, as well as their predecessors, the TPA3116 and TPA3118, share the same footprint.) These are medium-power amps and can work without filter inductors, but benefit from them at higher power.The TPA3136D2 and TPA3138D2 are basically updated versions of, and share the same footprint as, the TPA3110. These are lower-power amps (10W).With that said, I would really look into amps with I2S inputs — that saves you from the pitfalls of analog audio (noise).

author: viper
author_rank: Regular Contributor
timestamp: September 01, 2025, 11:17:11 pm
content: Quote from: tooki on September 01, 2025, 10:41:42 pmThe KISS strategy is something i'm trying to honor, but it also has to work right. The device is basically sending out a pulse for sonar detection and I am very much hoping I don't need as much power as stated, but I sort of "need it" for testing. Being at least familiar in running amps, it might be required to use a higher rated amp just so it doesn't clip with any lower power events.But more to that, you mentioned about power and I really need to work a strategy where I can turn on the amp very quickly, emit a short burst, and turn back off. But if I could get idle down in the micros, I could probably work the power plan around that. It will be running on a battery pack.I don't yet know if waking, firing, and shutting off is practical. But a good audio DAC and such will at least help me get clean sines in the air.

author: viper
author_rank: Regular Contributor
timestamp: September 03, 2025, 02:20:15 am
content: Been looking at data sheets and running numbers and seems I will need to power gate the amp. Curious if most of these amp chips have pop/click protections and soft inrush ability? I can try to find a load switch but not sure I would need it. I would need to constantly power cycle the amp to conserve battery power. The math just shows that even at idle or mute, the amp will consume too much power.

author: tooki
author_rank: Super Contributor
timestamp: September 03, 2025, 07:56:46 am
content: Quote from: viper on September 03, 2025, 02:20:15 amThe TPA3116 and -18, TPA3126, -28, -29, and -56 chips I mentioned all have both mute and shutdown pins. Sequencing those gets pop-free shutdown, provided the input signal is also already zero. If you also use a load switch, or switch off a DC-DC converter to power it, then the ideal power up sequence is:1. Pull the shutdown pin low, and the mute pin high.2. Turn on the power supply to the amp and, if needed, wait long enough for it to stabilize.3. Pull the shutdown pin high.4. Wait >40ms for the amp chip to fully turn on and the signal input caps to charge.5. If you need to turn on your signal source circuitry, do it now, and if needed, wait long enough for it to stabilize.6. Pull the mute pin low.7. Play audio.This is exactly what I did in the Bluetooth speaker project I designed.The TPA3110 and co. do not have a separate mute pin. The 3110 specifically takes less time to power up (14ms, according to the datasheet). I haven’t used those as much, so I don’t know the details of their pop behavior.The datasheets and eval board documentation go into this in detail.

author: viper
author_rank: Regular Contributor
timestamp: September 03, 2025, 04:10:15 pm
content: I appreciate it. Have you stumbled into a 'best practice' or data that might indicate any damage to an amp when constantly cycling either shutdown, power, etc? I guess I consider it like starting a car where we could maybe hit a cycle limit? Or if a shutdown approach is better than switching power?My hope was to find a chip that powers up quickly and I still need to evaluate the needs of a discrete DAC and if we mute that. I don't think there will be much gained by power switching that.

author: tooki
author_rank: Super Contributor
timestamp: September 03, 2025, 04:46:13 pm
content: Quote from: viper on September 03, 2025, 04:10:15 pmI don’t have any data or anything, but I can’t imagine it being a problem, since a class-D amp’s fundamental working principle is to switch MOSFETs on and off hundreds of thousands to millions of times a second. I mean, one of the huge advantages of semiconductors over mechanical switches is that they don’t really experience any kind of wear.

author: SiliconWizard
author_rank: Super Contributor
timestamp: September 03, 2025, 07:29:56 pm
content: Quote from: tooki on September 03, 2025, 04:46:13 pmAbsolutely, All a class-D amp does is switch at a high frequency. When you shut it down, the switching just stops and it powers down internal stages which are 99% digital.

author: mariush
author_rank: Super Contributor
timestamp: September 03, 2025, 08:56:19 pm
content: You can get i2s stereo DACs for 25 cents on LCSC, here's an example :https://www.lcsc.com/product-detail/C41417670.html?s_z=n_i2sMore brand name ones are 75 cents :Cirrus Logic CS4344/5/6/8 10-Pin, 24-Bit, 192 kHz Stereo D/A Converterhttps://www.lcsc.com/product-detail/C8952.htmlFor 5-10 watts, you'll probably need 12v input power or more.If you want low external parts count maybe have a look at MPS MP7720 or MP7740 :https://www.digikey.com/en/products/detail/monolithic-power-systems-inc/MP7720DS-LF-Z/5292746orhttps://www.digikey.com/en/products/detail/monolithic-power-systems-inc/MP7740DN-LF-Z/5292752mp7740 is 8-SOIC, mono max 15w at 24v , around 5w with 15vmp7720 is mono max 20w at 24v , around 5w at 12v, around 8w with 15vSomething better, Lumissil IS32AP2123https://www.digikey.com/en/products/detail/lumissil-microsystems/IS32AP2123-ZLA3-TR/14308381It will do around 15 watts with 12v input voltage, see page 10 in datasheet :https://www.lumissil.com/assets/pdf/core/IS32AP2123_DS.pdf

author: viper
author_rank: Regular Contributor
timestamp: September 04, 2025, 10:16:38 pm
content: Super appreciate the replies guys! I will work through the linked amps to review.Because I have mentioned I need to power cycle the amp frequently, may I ask the best practice to do so? From the perspective of least stress on the amp, and to eliminate any click/pop issues? It does appear that SD or shutdown of the amp, if a chip supports that feature, gets power draw to effectively zero, which is great! Could this be used to keep the power rail hot all the time and just cycle the SD? Or would I need a more refined strategy to limit any inrush to the amp when powered back up?As I may have mentioned, my hope was to find something with an internal DAC running I2S, but I am prepared to resort to them being separate if my power needs exceed common components. I only mention as it pertains to my power management, if I will have to also shutdown a discrete DAC if power consumption is too high. Hoping that muting can get me over the hump. I haven't really dug into DACs much yet as I'm still combing the market for amp chips.And I only need mono or single channel. If running a stereo chip, bridgeable would be great. It seems like most I have reviewed are able to do that.

author: tooki
author_rank: Super Contributor
timestamp: September 05, 2025, 10:16:27 am
content: Quote from: viper on September 04, 2025, 10:16:38 pmWell I gave you a detailed startup procedure already. If not enabling/disabling the power supply rail, change step 2 to just “wait for the power rail to stabilize”. Reverse the steps to shut down.How often do you need to switch the amp on and off? There is no “stress” on the amp, not sure why you’re so fixated on that concept. Again: these amps work by switching thousands or millions of times per second. An extra switching process won’t make any difference. But how often you need to use the amp (and how long it is powered when used) does matter in terms of designing your power infrastructure, which does matter since battery life is important.Quote from: viper on September 04, 2025, 10:16:38 pmWhether to keep the amp power rail hot depends on how the amp will be used. Modern dc-dc converters are quite quick to turn on and off, so you don’t necessarily need to keep the rail running. But it depends on the usage pattern.I dunno what “inrush” you think the amp has when powering on. On the 3126 and its family, going from shutdown mode to powered on causes the quiescent current to increase by about 750 times — from a few microamps to a few milliamps. (In other words, from practically nothing to practically nothing.) There’s no inrush there.Your power supply rail does need to have sufficient capacitance for normal operation, because during playback, the current is pulsed. That’s how Class D amps work: switching the output directly to the power rail for little pulses. So in normal operation, you are actually getting multi-amp bursts of power consumption, they’re just really, really brief. The DC resistance of a speaker is often a bit less than its nominal impedance, e.g. a 4 ohm speaker might have a DC resistance of 3-4 ohms. So your theoretical peak current will be limited by that. (E.g. at 24V, peak current could be 24V/3 ohms = 8A.)I remember testing the -3110 some years ago, using my Fluke 87V’s peak capture mode (which detects peaks as short as 250 μs), and at what I’d call “very lively indoor volume” it captured peaks of about 8A, so about 4A per channel since it was in stereo. The average current was only about an amp.Anyway, that pulsed load is why the amp chip needs generous capacitors placed right next to the power supply pins with fat traces.IMHO, what you need to do first is figure out what supply voltage you need for the amp: the higher the output, the more volts you need to maintain the same level of distortion. If you’re only using, say, 2W of output power, you won’t need the full 24V.(In the Bluetooth speaker I designed, the power amp power rail is variable-voltage, so the MCU can adjust the voltage depending on the volume setting. I designed it so the DC-DC converter defaults to 12V if no control voltage is applied, but can be adjusted from something like 5-20V or something.)You should determine the required supply voltage experimentally by testing an amp with your speaker of choice, and measuring distortion with your actual signal. Vary the voltage and see how distortion changes, then decide what is acceptable.Quote from: viper on September 04, 2025, 10:16:38 pmClass D amps with built-in I2S DACs do exist (though I don’t know why, since to me it makes no sense to do it that way; there must be some advantage I’m unaware of). Many I2S-input amps eschew a DAC and instead take the I2S data and process it in the digital domain into the PWM signal for the output MOSFETs.You can get I2S-input class D amps with hundreds of watts of output power. Output power will not be a reason to resort to an analog-input amp + external DAC.Examples of I2S-input amps with an internal DAC include the TAS3251 (150W, mono or stereo, into 4 ohms at 1% THD) and TAS5830 (100W at 1% THD into 4 ohms).Examples that don’t use an internal DAC include the TAS6424E (120W mono at 1% THD into 2 ohms) and TAS5825P (53W mono at 1% THD into 4 ohms).The TAS5825P is actually designed to do output-level based control of the power supply voltage (“envelope tracking”) to reduce battery consumption, by delaying the audio output a few milliseconds, so that it can actually signal the power supply to increase voltageahead of time, ensuring the voltage is already where it needs to be. The reason I mention this is because the maximum configurable delay is 4ms, meaning that they designed this with the expectation that the power supply (DC-DC converter) can respond more quickly than that. So a properly selected DC-DC converter for your power rail should be able to handle switching on and off fast enough.

author: viper
author_rank: Regular Contributor
timestamp: September 05, 2025, 04:01:15 pm
content: Tooki - again, good stuff! I guess when I said "internal DAC", I wasn't certain how the I2S signal was getting processed, but for this application, it likely doesn't matter. Actually probably a good thing for any EMI, as the board will be very close to the speaker, to keep everything digital.If I were really building an audiophile level system, I'd probably be looking at this different, but we need to emit what I would call a "test tone" very briefly, but continuously. There will be times the entire device sleeps for hours, but when it wakes, it needs to send tones repeatedly. In looking at the energy use, it's just obvious that when not sending a tone, the amp needs to be put in either a sleep mode, or other means to chop power to near zero. Many of these amps pull like 150mA at idle, which is just too much to leave the amp on, when on battery power.You recommend a lot of TI products, and I am seeing them as quite a force in the industry. They have several chips with I2S, some with way more power than we need. We are hopefully estimating our real needs not to exceed 5W, but having experience in audiophile audio, having headroom isn't a bad thing, and it doesn't appear to cost us much, if any more in terms of $ or power. I guess if we use a 15-20W amp, we will have the headroom.But most of the TI chips start tossing in options we really don't need like EQ, DSP, etc. But whatever, we are probably talking like $1 difference.As for switching amp on/off, a basic estimate is about 4M cycles in the device life cycle. That is nothing for a FET, but when I was talking inrush, I am used to capacitors having to charge and usually more ideal to current limit their charge for better life. IDK just yet. If I can pull the amp down to zero power and keep the rail hot, I like that strategy.

author: SiliconWizard
author_rank: Super Contributor
timestamp: September 05, 2025, 05:47:39 pm
content: The integrated class-D amplifiers with I2S interface process the signal 100% digitally. There is no internal conversion to analog of any kind. But they have similarities with sigma-delta DACs as they have similar internal digital modulators to generate the control signals for the power MOSFETs (which themselves may be on-die).

author: viper
author_rank: Regular Contributor
timestamp: September 05, 2025, 10:55:12 pm
content: So I spent time today trying to connect with TI. Finally a login and such. As I evaluate, they have tons of options for these amp chips with I2S. They do seem to be in the budget, have good data sheets. Their CS is about non-existent now which sucks. We worked with them about 20y ago and were great.So my question is....is TI the right OEM to consider with a budget and a few features in mind? Also, is there any FULL product line doc in existence? I see their listings on their site, but we have TAS 23xx, 27xx, 57xx, 58xx, etc, etc. I'd like to learn some differences other than I can't really tell without going through countless data sheets. I was hoping to speak with an app engineer today on this, even post on their forum. Can't do any of that! Obviously frustrated with them!But if they have all the features and reliability we need, I will figure it out.

author: tooki
author_rank: Super Contributor
timestamp: September 06, 2025, 11:03:37 am
content: Quote from: SiliconWizard on September 05, 2025, 05:47:39 pmThat’s what I thought, too! But when I started looking more closely, I discovered to my surprise that some do, in fact, use a DAC, and some even route the analog signal through external pins!Look at the datasheet for the TAS3251:https://www.ti.com/lit/ds/symlink/tas3251.pdfThe block diagram on page 21 (screenshot attached for convenience) clearly shows the DACs and how they’re routed to pins, and the actual power amp stages having analog input pins.I would love to know why they did this, since no obvious advantage comes to mind.Other models stay completely digital.

author: tooki
author_rank: Super Contributor
timestamp: September 06, 2025, 12:11:41 pm
content: Quote from: viper on September 05, 2025, 04:01:15 pmNo, just the highest-power one, which is intended for automotive use, not battery powered applications.I only brought up the high-power options to dispel your apparent concern that I2S-input amps might not have enough power. I’m not suggesting you actually use one of those high-power models, since you don’t need anywhere near that much power.What you do need to figure out is what power you actually need, what your maximum tolerable THD+N, and what the actual impedance of your transducer is. You said “probably” 4 ohms, but you need to know so that you can choose the appropriate ampand supply voltage, since a higher-impedance transducer needs higher supply voltage (and a lower-impedance transducer a higher current), all else held equal, for a given power level.I would probably buy or build a dev board for an amp with lots of headroom and use that to determine empirically how much power you actually need, at what THD+N. This would let you choose an amp with intent, rather than guesstimating and hoping for the best.Quote from: viper on September 05, 2025, 04:01:15 pmQuote from: viper on September 05, 2025, 04:01:15 pmI didn’t ask for how many cycles. Again, the damned things switch hundreds of thousands or millions of times per second anyway. What I asked ishow often. You’ve now said that it might sleep for hours. But when you say “repeatedly” in operation, what do you mean? Continuously? A blip every half a second? Every 10 seconds? Every minute?The amps vary significantly in their power up/down times. So if you need to send, say, 1 per second, an amp that takes 40ms to power up and 10ms to power down is no problem at all. But if you want to send every 70ms, then that’s probably cutting it too close.It depends entirely on your actual usage pattern whether to prioritize an amp with low quiescent current fully powered on (if your intervals are too short to allow shutdown and back) vs. a higher quiescent current powered on, but that is quick enough to shutdown and back that you can actually keep it shut down most of the time. Some models have multiple sleep modes precisely to let you balance these factors.The reason I am pushing you so hard on this question is that your POWER INFRASTRUCTURE depends on it! If your amp and transducer configuration requires you to run a boost converter to get the power amp supply voltage, then part of your power management strategy may need to involve disabling that boost converter during the sleep phases. Otherwise you’re frittering away battery power to generate, say, 12V that aren’t needed.Which capacitors are you worried about exactly? But moreover, what makes you think that it matters whether the amp is in shutdown, or just sitting idle? At the end of the day, all the capacitors in the system (power supply caps, bootstrap caps, output filter caps) basically experience current flow (in pulses) when an output is presented to the transducer. If your signal is zero, even if the amp is on, it’s not going to do much switching. Remember that the amp control circuitry draws very little current. It’s the output switching that causes current draw and thus burdens the caps.Quote from: viper on September 05, 2025, 04:01:15 pmWell, TI is just what I have the most experience with, and they do have a huge selection. But others may be worth looking at, especially since TI gatekeeps their support so much, as you have seen.Quote from: viper on September 05, 2025, 04:01:15 pmI think “a few” is more accurate than “most”.Quote from: viper on September 05, 2025, 10:55:12 pmHah! From TI? LOL.Quote from: viper on September 05, 2025, 10:55:12 pmYeah, that’s pretty much what you have to do.

author: tooki
author_rank: Super Contributor
timestamp: September 06, 2025, 12:22:11 pm
content: P.S. The TAS2120 could be interesting: it is about 6W at 1% THD, and has intelligent power saving (by being signal-aware), as well as having an integrated boost converter. (It can actually do 3x as much power when using an external supply instead of the internal boost converter.) But 6W from a 3.6V battery supply using the integrated boost converter is quite handy, and very efficient.

author: tszaboo
author_rank: Super Contributor
timestamp: September 06, 2025, 12:29:45 pm
content: Quote from: viper on September 01, 2025, 11:17:11 pmStop designing, and measure the impedance and the transfer function of your transducer.You are likely wasting your time on a over complicated design, and a square wave would drive your transducer just as good as a complicated amplifier.Always start with a proof of concept, and not a PCB design.

author: viper
author_rank: Regular Contributor
timestamp: September 06, 2025, 04:18:07 pm
content: Quote from: tooki on September 06, 2025, 12:22:11 pmTo answer some questions. When device is awake, the blips would likely occur every 5-7sec. There will be a faster mode, but for that we can accept just leaving the amp on. Say a blip every 1sec, but device would only be in that mode for a short time. I would think faster wake times would be helpful so we are not losing a 1/4sec in every SD cycle.Indeed I was examining power use and really only need 12V for that amp. All else is 3.3-5v. I did notice TI has some tech out there I am trying to get info on. "Smart amp", which I think is basically clip control. And "boosted", which is I think what you describe where there is a boost converter in the amp so to speak? It would just activate as needed? Seems like a good fit for this application?I'd like to "throw and go", IE, just grab something and test, but I sort of stepped into a new world with these little amps and I'm trying to learn!

author: tooki
author_rank: Super Contributor
timestamp: September 06, 2025, 06:26:46 pm
content: Quote from: viper on September 06, 2025, 04:18:07 pmThanks.For 5-7 second intervals, you could definitely shut down any of the amps discussed, and likely any amp on the market, with plenty of time. You could probably disable your entire boost converter, too.But even for the 1 second mode, chances are these amps are fast enough. (You haven’t stated how long the blip itself is, but I’m assuming it’s some fraction of a second.) The TAS2120 in particular seems to have extraordinarily quick shutdown/power up times, just low single-digit milliseconds each wayincluding volume rampingto avoid clicks. It could literally be powered off and on 100 times per second with time to spare.Quote from: viper on September 06, 2025, 04:18:07 pmI am not 100% sure, but I think that’s sort of a catch-all for many advanced features.Quote from: viper on September 06, 2025, 04:18:07 pmNot “so to speak”, but literally!Take the TAS2120 for instance: its boost converter boosts your battery voltage to about 5V at idle, and increases variably on demand in 33mV steps, up to 14.75V, whenever the audio signal requires it to avoid clipping. The output of the boost converter can even be used to simultaneously power a TAS2320 to make a stereo pair.Quote from: viper on September 06, 2025, 04:18:07 pmIf I am understanding the datasheet correctly, in the TAS2120 the boost converter turns on when the amp is powered on. But as described above, it only boosts a little bit at first. (And additionally, at low signal levels, the amp actually switches the output MOSFETs to the 1.8V rail instead of the boosted rail. So basically, it knows to only suck power from the boosted rail when actually needed.)Quote from: viper on September 06, 2025, 04:18:07 pmHonestly, at first glance it does. Taking the TAS2120 specifically, since it’s the only boosted one whose documentation I’ve looked at more closely, it looks like a great match for your application, provided the output power and noise characteristics are sufficient.Heck, it even has a sine tone generator built in.Note that it does require a 1.8V logic supply that you must provide yourself. But even in operation the current demand of that supply is so minuscule (about 6mA max) that you can just use a tiny LDO off your 3.3V rail.If you have the budget to get a TAS2120 eval board, it might be worth trying one out. I would also recommend, assuming you don’t already have one, getting an I2C interface like an Aardvark to make it easy to write in configuration parameters.In any case, I’d also get a few cheap TPA3126 or similar boards (get some in different configurations: with and without output LC filters, etc) to play around with. As I said, you can use those to determine how much output power you actually need and how much distortion you can tolerate.

author: luiHS
author_rank: Frequent Contributor
timestamp: September 09, 2025, 07:28:54 am
content: I use the TAS5805 via I2S with a Raspberry Pi, and it works perfectly. You only need an I2C port to configure it. We have volume control with I2C commands, and you can also configure filters for tone control or equalization.Externally, it has a PDN pin to disable it, or you can set the volume to zero with I2C commands.