Audio artefacts on a DIY internet radio box - Page 1
Forum section: electronics / beginners

author: MustSeeMelons
author_rank: Newbie
timestamp: June 13, 2024, 08:45:50 am
content: Hi!I'm building an internet radio box that consists of a Pi Zero, a PCM5102A I2S to analog, and a TPA3111D1PWPR (10W) amplifier. I've attached the schematic as well as the PCB layout of a 2-layer 1.6mm board. Basically following the datasheets to put it all together.For volume control, I placed a pot after the I2S chip. Power-wise I'm using a 12V barrel plug, 3.3V LDO for the I2S chip, and 5V buck for the Pi itself. The amp is running from the 12V supply.It works! But once I turn the volume up a bit it sounds like trash. Distorted, fart-sounding is the best I can describe it.I'm using a generic 4 Ohm speaker without any known characteristics.I tried another generic 4 Ohm, but 15W rated speaker - sounds the same, perhaps gets a bit louder.I've used this speaker before with a MAX98357 (3W) and it worked great. Though now before it starts to sound bad the sound seems fuller? If that makes sense.Next, I tried out a brand name 30W speaker. With a proper datasheet. After some googling it seemed I was experiencing clipping, so my hopes were low that this would change anything - but it did! It sounds awesome!Can someone please shed some light on the subject? Are two of my three speakers just under spec? Or am I doing something terribly wrong? I added a low pass filter, maybe I need a high pass as well?Any help would be appreciated, thanks

author: xvr
author_rank: Frequent Contributor
timestamp: June 13, 2024, 09:25:10 am
content: Wrong connection of R11 - should be connected to pin 7, instead it conected to pin 14 (and vice versa - just swap pins 7 and 14).R15 is short circuited.

author: aliarifat794
author_rank: Regular Contributor
timestamp: June 13, 2024, 09:45:24 am
content: Adding high-pass filters can help improve sound quality by removing unwanted low frequency noises.

author: jzx
author_rank: Regular Contributor
timestamp: June 13, 2024, 01:58:09 pm
content: See if the power supply can give enough current for the peaks. If not, the voltage drops and creates feedbacks and strange effects.

author: jzx
author_rank: Regular Contributor
timestamp: June 13, 2024, 02:02:37 pm
content: If you have an oscillocope, you can check if there is ripple in the power supply whe you rise the volume. If not, you can try with a more powerful PS, as a PC power supply to discard this posibility.

author: MustSeeMelons
author_rank: Newbie
timestamp: June 13, 2024, 02:11:26 pm
content: @xvr How can you tell that the pins are swapped? R15 is a bit weird - but I'm just following the application schematic. Attached it.@jzx I'm testing from a bench power supply that can supply 5A. If it were a power supply issue wouldn't the issue be present on all speakers?

author: xvr
author_rank: Frequent Contributor
timestamp: June 13, 2024, 02:15:08 pm
content: QuoteSee 'Pin function' table on page 3. It saysQuoteAnd any case - connect power suply through 100K resistor is a nonsense. I think that DS has an error here. May be it should be 100R?

author: mariush
author_rank: Super Contributor
timestamp: June 13, 2024, 04:40:53 pm
content: You don't say what's the maximum output power of your 12v adapter. At 10w output on a 4 ohm speaker, the amplifier chip alone would consume 1A of current.The layout is pretty bad, with what looks to be pretty thin traces where there's no reason to. I would more or less have a copper pour/fill from the barrel jack all the way down to the left of the audio amp chip and the components near it. Not that trace that splits into multiple diagonal traces.Also the layout of the switching regulator and the linear regulator is kinda bad.The inductor is too far from the chip and uses too thin traces. I would actually put the BST capacitor C6 right where the text for R3 is, and have the inductor right below the capacitor. This way you can have a trace come out the SW pin and connect to a rectangular copper area that connects to both the inductor pad AND the C6 capacitor.Keep the feedback resistors away from the inductor, and connect the output capacitors directly to the other pad of the inductor. Pay attention to the advice on page 14 in the datasheet:https://www.monolithicpower.com/en/documentview/productdocument/index/version/2/document_type/Datasheet/lang/en/sku/MP1660GTF/It may be a good idea to add a solid (polymer) capacitor in parallel with those two ceramics, something in the 47-100uF 10-16v range.For the 3.3v regulator, because it's so close to the 2 22uF ceramics on the output of the 5v switching regulator, you could leave out that 1.5uF ceramic capacitor on input.... maybe change it to a 100nF for decoupling purposes even though even that wouldn't be needed since it's so close to the 5v switching regulator.But the biggest issue is that 1117 regulators can be unstable with ceramic capacitors on output, depending on who makes them. For your TLV1117, it's not designed to be stable with ceramic capacitors, you can see the recommendations on page 11 :https://www.ti.com/lit/ds/symlink/tlv1117.pdfQuoteThis part really needs ESR above 0.2 ohm, other models from TI recommend as much as 0.4 ohm minimum, and most 1117 regulators not "tweaked" for stability with ceramic capacitors require at least 0.1 ohm ESR.The easiest way would be to use a low capacitance value electrolytic capacitor, anything in the 22uF to 100uF 10-35v rated should have an ESR above 0.1 ohmOr you can use a regulator that advertises being stable with ceramic capacitors like AZ1117I for example :https://www.digikey.in/en/products/detail/diodes-incorporated/AZ1117IH-3-3TRG1/5699672(note that while it's stable with ceramic capacitors this model also has specific requirements, like at least 22uF capacitance, others are fine with as little as 10uF)I'm not saying these are the reasons it would sound bad, but they could be. For example the PCM5102A is powered from 3.3v and if the output oscillates...Also... decoupling capacitors (0.1uF / 100nF) should be as close as possible to voltage pins, I see in the schematic that your 10uF are positioned closer. It probably makes very little difference, but just saying for future designs.For the amplifier chip, I don't think you need 220uF .... even the datasheet shows 100uF, I'd use two 100uF solid (polymer) capacitors and I'd probably use 270-470uF solid (polymer) on the input by the barrel jack.

author: jzx
author_rank: Regular Contributor
timestamp: June 13, 2024, 05:47:18 pm
content: Quote from: MustSeeMelons on June 13, 2024, 02:11:26 pmI have forget your third speaker. If the amplifier works with one speaker, must be correct, but decoupling capacitors are important.In your first post you have not said the power of the power supply, and a weak power supply is a common cause of distortion at "high" power. (10W is not very high, but for a small power suply it is).Quote from: MustSeeMelons on June 13, 2024, 02:11:26 pmIt is posible. You dont know the characteristics of the 1st speaker, and the characteristics of the 2nd can be fake (chinese watts) o it can be damaged. If the coil is not well centered in the magnet or if it is distorted, it can brush against the core, perhaps only at high volume, when the coil goes further. Have you tested your 2nd speaker with another amplifier?

author: MustSeeMelons
author_rank: Newbie
timestamp: June 13, 2024, 06:19:29 pm
content: @mariush Thank you so much! Lots of useful info for a newbieHave to spend more time with datasheets and not ignore recommended layoutsSorry regarding the 12V adapter, it is rated at 3A. I mainly use the bench supply to avoid wasting parts on prototypes.@jzx On the 3W amp all speakers sound good.@xvr Huh, the table contradicts the recommended layoutI guess time to go to TI's forums to figure this out?

author: 807
author_rank: Frequent Contributor
timestamp: June 18, 2024, 02:15:12 pm
content: The datasheet seems misleading, as that 100k resistor on pin 14 shows the other end connecting to AVCC...but pin 14isAVCC, so that 100k resistor appears to just short itself outIf pin 7 & pin 14 are actually connected internally (as they are labelled the same) then connecting a resistor between pin 7 & 14 ahieves nothing.Looking at the way others have interpreted AVCC, pin 7 has been connected to supply through a 10R resistor, then the 100k connectes from pin 7 to pin 14. In your circuit you have done this, but you have also connected the supply straight to pin 7 as well. This isn't required.

author: jzx
author_rank: Regular Contributor
timestamp: June 18, 2024, 03:03:53 pm
content: Quote from: MustSeeMelons on June 13, 2024, 06:19:29 pmYou said that at low levels it sounded well, but bad if you raised volume. A damaged speaker can sound well at low level and bad at high level.If the speaker sound well with the 3W amplifier at higher level than with the 10W amplifier, it is not the trouble, but the 10W amplifier can send more power to the speaker.Have you an oscilloscope?

author: 807
author_rank: Frequent Contributor
timestamp: June 18, 2024, 03:47:26 pm
content: Looking at the answers on the Texas Instruments forum about pin 14, it isnotinternally connected to pin 7, despite both pins having the designation AVCCPin 7 is a power connection while pin 14 is an I/O connection. Why on earth did they call both pins AVCC? No wonder there is so much confusionSome have even connected pins 7 & 14 externally on the PCB, thinking they were the same internally, which caused problems.

author: MustSeeMelons
author_rank: Newbie
timestamp: June 18, 2024, 05:50:12 pm
content: @jzx I don't have a proper oscilloscope, yet. I want to buy one but keep putting it off. I am quite space-constrained. I have this thing:https://www.aliexpress.com/item/1005003318080178.html?spm=a2g0o.productlist.main.3.49d64060ttDhA9&algo_pvid=2fd06943-cca0-4f20-9592-35fe18a19622&algo_exp_id=2fd06943-cca0-4f20-9592-35fe18a19622-1&pdp_npi=4%40dis%21EUR%2126.00%2115.07%21%21%2127.25%2115.80%21%402103080e17187320854378211ef0d1%2112000035132000036%21sea%21LV%212194027302%21&curPageLogUid=LBGlyaxXtW61&utparam-url=scene%3Asearch%7Cquery_from%3A.In fear of miscommunication, I shall clarify:Speaker I: Chinese, no data on it - works well on the 3W at all levels. Distorted at higher levels on the 10W. (It might be a 3W speaker, dunno)Speaker II: Chinese, but rated at 15W! No more data. Works well on the 3W at all levels. Distorted at higher levels on the 10W.Speaker III: Branded, 30W, has a proper datasheet. Works well on both amps with no distortion. Actually sounds pretty great just sitting on a table above some one layer TP@807 Thanks! The reference schematic caused a headache. So technically I can remove the direct connection for pin 7 to 12V and keep it all through the 10R resistor?

author: jzx
author_rank: Regular Contributor
timestamp: June 19, 2024, 05:07:08 pm
content: This scope probably is slow, because if the output is not very well filtered, you will have rests of the high frequency modulation.What are L2 and L3? In the datasheet are specified as ferrite beads, lousy, and in your board they seem standard coils. If they are not lousy you can have resonances.

author: 807
author_rank: Frequent Contributor
timestamp: June 20, 2024, 09:56:54 am
content: Quote from: MustSeeMelons on June 18, 2024, 05:50:12 pmYep. That's what most others have done. Otherwise the 10R resistor is doing nothing by being shorted out.

author: MustSeeMelons
author_rank: Newbie
timestamp: June 20, 2024, 11:04:41 am
content: @jzx L2 and L3 come from 8.2.2.3 from the datasheet. My reasoning was "it shouldn't hurt"Update regarding the TLV1117 - I'm using a variant that is stable with ceramic caps:https://www.ti.com/lit/ds/symlink/tlv1117lv.pdf?HQS=dis-dk-null-digikeymode-dsf-pf-null-wwe&ts=1719656731397&ref_url=https%253A%252F%252Fwww.ti.com%252Fgeneral%252Fdocs%252Fsuppproductinfo.tsp%253FdistId%253D10%2526gotoUrl%253Dhttps%253A%252F%252Fwww.ti.com%252Flit%252Fgpn%252Ftlv1117lv