I'm building an audio project with an ATMEGA328p using an LM386 as the amplifier and the Mozzi audio library.
- Power source is 4 AA batteries.
- I'm using an MCP1700 voltage regulator to drop the voltage to 3.3 V for the entire circuit EXCEPT the LM386.
- The LM386 is powered directly from the batteries at 6 V (with a 100 μF decoupling cap), bypassing the regulator, to get a better output volume.
- Audio signal comes straight out of the Atmega pin 15 / PB1 / digital 9 through a 2.2 kΩ resistor into the LM386 (resistor is not pictured in the schematic).
The output is nice and loud and not distorted, but there is a quiet high pitched whine and a low buzzing/clicking sound in the background that sort of fluctuates; it sounds like a low pitch sawtooth wave.
What am I missing? I've read about a decoupling cap on the amp pin 7, resistors on the voltage into amp pin 6. I tried hacking these onto my PCB but didn't hear any difference in the noise.
A few schematic notes:
- C3 is 1000 μF
- phonesroute goes straight to a switching headphone/speaker output
- audioout comes straight from the Atmega through a 2.2 kΩ resistor