0
\$\begingroup\$

I have put together:

  1. an Raspberry Pi Pico that manages a keypad and
  2. a simple audio amp based on LM386N.

The audio amp is connected via GP22 which provides PWM and plays the role of sound-audio feedback on a successful key-in pressed. The system works correctly and audio beeps are played from the speaker attached. However there is unwanted noise that is coming out of the speaker, sporadically.

Specifically the parasite or noise is very precise and is repeated every time the wifi/mqtt publishes data to the network plus some other times, but definitely it doesn't seem to be random noise.

How do I tackle this? Of course I would prefer this to be as silent as possible.

Here is the schematic:

enter image description here

This is the pcb layout:

enter image description here

\$\endgroup\$
7
  • \$\begingroup\$ Show us the layout of the PCB - you are also missing capacitors on the VCC supply \$\endgroup\$
    – BeB00
    Commented Jul 9, 2023 at 17:10
  • \$\begingroup\$ Can you state which kind of buzzer that is? It should be a regular speaker, not a buzzer of any kind. \$\endgroup\$
    – Justme
    Commented Jul 9, 2023 at 17:21
  • \$\begingroup\$ Sounds like poor layout and lack of decoupling capacitors. But please show your full schematic and layout. \$\endgroup\$
    – winny
    Commented Jul 9, 2023 at 17:21
  • \$\begingroup\$ it is a regular small speaker not a buzzer \$\endgroup\$
    – thermike
    Commented Jul 9, 2023 at 17:26
  • \$\begingroup\$ I have edited the post and included the PCB layout. It just that the noise isn't continuous. I suspect that it might have to do with WIFI/MQTT because there is a definite pattern on the noise. \$\endgroup\$
    – thermike
    Commented Jul 9, 2023 at 17:29

1 Answer 1

1
\$\begingroup\$

The noise burst may get coupled via audio input or via supply.

Your circuit shows huge electrolytic caps, but no small bypass caps such as 100nF ceramic that are more effective at high frequencies.

Also, your LM386 circuit is set to operate at maximum gain possible, which means that the usable volume range will be quite low and audio needs to be attennuated by very large amount to have suitable level at LM386 input. It also means any noise coupled to audio will get amplified by huge gain.

And the audio is not AC coupled.

First solution is to set the gain to minimum by removing the capacitor C1 and then AC couple the PWM audio input between IO pin and potentiometer.

You may need to add high frequency supply bypass and audio lowpass filter to remove any leftover noise.

\$\endgroup\$
7
  • \$\begingroup\$ The audio looks like it is AC coupled \$\endgroup\$
    – BeB00
    Commented Jul 9, 2023 at 18:46
  • \$\begingroup\$ @BeB00 If so, where? Not between input and pot, and no AC coupling cap in the schematics before the pot either. \$\endgroup\$
    – Justme
    Commented Jul 9, 2023 at 19:16
  • \$\begingroup\$ Oh sorry, I missed the part where you said input. He doesn't have a negative supply, so wouldn't he have to also add biasing after the coupling to the non-inverting input to keep everything centered at 2.5v? What would the advantage be of AC coupling the input? Presumably his PWM source is already centered around 2.5V (although if its not, I guess biasing makes sense) \$\endgroup\$
    – BeB00
    Commented Jul 9, 2023 at 20:26
  • \$\begingroup\$ @BeB00 It's not an op-amp, it's a LM386 which is a self-contained single-supply audio amplifier IC, the oldest in town. It will bias the output at half supply while inputs are fed according to data sheet. \$\endgroup\$
    – Justme
    Commented Jul 9, 2023 at 22:23
  • \$\begingroup\$ @Justme Do I place AC coupling with a series capacitor in the signal line before the pot or across signal to ground? What value would you suggest? Thank you! \$\endgroup\$
    – thermike
    Commented Jul 10, 2023 at 9:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.