You've got a whole list of things to run down...
Where is your power coming from? A battery, wall-wart, PC? If it's anything other than a battery you need to see how quiet the supply is. Wall-warts are incredibly noisy and unless you take care you are going to get noise. What kind of decoupling do you have on the supply? You're going to need something fat and something skinny. Start with 100uF-470uF electrolytic on the rail. Pair that with a 0.01-0.1uF ceramic (maybe both). Skipping this and you might as well forget it. You can go further and use a series resistor in the supply but start with the caps.
How is the input connected? AC-couple (use a cap on the input to the amp). Something like a 0.47uF should do it. Then it doesn't matter if the PIC is an output or an input (the cap blocks DC. Regardless if it's an output high or low nothing is showing up at the amp. The only time the amp sees signal is when you are outputing "sound" as an AC waveform). Use a high value resistor to ground on the input of the amp (on the amp side of the cap). Something like a 1M ohm (the data sheet shows a 10K but this is to match the output from a preceeding pre-amp or line level. You don't need that coming from a PIC). This keeps the input at ground unless there is a signal.
Are your grounds tied together at one point (preferably at the supply)? If you have multiple ground paths then you're going to get into trouble. Tie the supply leads together at the supply. Use a single wire from the output of the PIC to the input cap.
Looking at the data sheet you should run this in BTL (bridge-tied load) configuration. This uses both amps in the package and gets rid of the big caps on the output (the 470's). This part uses a lot of caps, make sure you are using them. Keep the leads short and if you are using a "plug-strip" protoboard get rid of it and solder the stuff together. Flying leads between components are far better than proto-boards.
There are amps out there that have an enable pin. You can get one of those and turn the amp on and off as you need. If something is battery powered this saves on power. This only masks the problem however; the hum and noise are still present unless you get rid of it.
Mike Tripoli
Bookmarks