# Should a PAM8403 be directly fed from a CHIP GPIO audio signal?

I am building an internet radio (I somehow know how to develop and am an absolute beginner in electronics), for which I wanted to use a C.H.I.P computer and a PAM8403-based audio amplifier.

This has already been done and I followed the instructions from the C.H.I.P blog, to essentially build this

simulate this circuit – Schematic created using CircuitLab

Upon connecting the L/G signal from the C.H.I.P. and without streaming anything, the loudspeaker was issuing a continous hiss, sort of white noise, rather high-frequency.

When sending some audio signal, the signal was very distorded.

Plugging the spekaers directly on the audio outputs of the C.H.I.P. gave a nice sound, although very weak (this is the reason I wanted to amplify it in the first place).

I assume therefore that something is wrong in the way this output signal is processed by the amplifier chip.

I went on reading and articles about how to deal with such nuisances revolve around a low-pass filter. So I added one.

simulate this circuit

When turning the potentiometer (high resistance to low) I get an almost inaudible sound (I have to put the loudspeaker to my ear) and then suddenly the signal is all distorted again. But the hissing sound is gone.

Sioce I find these hind of hardware hacks fascinating I am ready to jump in to understand everything, and my main question would be: is the approach I have correct, that is: is the output signal of GPIO pins of devices such as the C.H.I.P. or a RPi intended to be used with amplifiers such as the PAM8403?

Another possibility would be a faulty element - I will look for another PAM8403 amplifier to discard that as the article I was basing my hack on is clear with the the connections.

• Can you use one with the other? Yes if done properly with appropriate handling of power distribution and the interconnections. But that's a really broad subject. – Trevor_G Nov 27 '17 at 13:02

Connecting the potmeter at the output is a no-go. That will simply not work (assuming you want "decent" volume control). You have to regulate the volume at the input of the amplifier.

The 100 nF capacitor is there to prevent any DC coming out of the C.H.I.P. module to disturb the amplifier.

Also improve the supply arrangement by using separate wires for each module and 1 uF capacitors near the supply connections of the modules.

simulate this circuit – Schematic created using CircuitLab

Next time please educate yourself on "how things are done" regarding audio amplifiers and volume control. There are plenty of examples to be found if you just search for it. "Trying" things out in electronics seldom gives the result you want and only feeds frustration and can also damage components.

• Thank you - I will study your answer. As for "please educate yourself on "how things are done" regarding audio amplifiers and volume control" -- I agree with you but there is a lack of "cookbook" oriented books on electronics (I have searched for some. I certainly understand the need to educate oneself but the amount of things to digest is overwhelming. I am a physicist by education (PhD) and if I can understand that if someone wants to understand chromodynamics over a week-end ... – WoJ Nov 27 '17 at 19:00
• ... he will have a hard time. I am also an amateur developer and here - if someone wants to build a web app over a week-end, this is doable (mostly due to good frameworks). I was kind of expecting that hacking my hardware part would fall into the latter category - some reasonably standalone pieces which fit together without the need to understand a lot immediately (that would come with time). A RPi-like device and a go-to amplifier block was my idea of such pieces. ... – WoJ Nov 27 '17 at 19:01
• ... Turns out I was wrong :) But still very much interested in learning. Thanks again - this gives me some food for thought and after trying out the solutions in the answers I will accept the most suitable answer (the "accept" part always drives me uneasy as the word is definitely not right "thank for" would be better) – WoJ Nov 27 '17 at 19:01

With a radio-frequency receiver nearby, using this Class-D amplifier might cause broadband noise to give the radio grief. Switching noise should be confined to this module in an attempt to keep it from radiating switching pulses into the receiver.

• As Bimpelrekkie has suggested, a large-value power supply bypass capacitor should be added with very short leads, right at the PAM8403 printed circuit pads (GND, +5V). Value is not critical, perhaps 10 uF - 100 uF
• Wire pairs from module-to-speaker should be tightly twisted together for their full length. This will help reduce their ability to radiate pulse energy.

If these steps don't solve noise problems or reduce it to insignificant levels, then low-pass LC filters feeding the speaker may help. This should be added directly at module speaker output leads: