I'm completely hopeless with analog circuits. I think part of it might actually be a self-fulfilling prophecy — I know that I'm bad at it, so I'm not even trying. Usually I just try and copy any analog pieces I need from other projects, cargo-culting them and hoping they will work. A case in point: the audio shield.
Simplicity itself. A small audio amplifier, connected through a resistor and capacitor to the DAC pin on one side, and to an SMD speaker on the other. What could possibly go wrong?
First of all, I re-used a footprint for the PAM8301 amplifier, using a part for some sparkfun's DAC chip. It's exactly the same size, I just changed the labels on the pins. What I failed to note is that the pins on that chip are numbered in the opposite direction than on my amplifier. So to start with, I had to bend the pins of the chip the other way and dead-bug it. Fine.
Next thing I am a little less sure of. I mean, I am sure it doesn't work, but I'm not sure why. If I connect a piezo to the DAC pin directly, I get the sound that I'm playing (although very quietly). If I use the amplifier (with a 47kΩ resistor and 0.1µF capacitor between the pin and the input of the amp), I get nothing. And it gets warm. Sounds like it's simply connected wrong, but I verified the PCB and the datasheet a million times already.
I must be missing something obvious, here's the schematic so that you can laugh at my ignorance:
Oh, and yes, I copied it. From Adafruit's Circuit Playground Express board, which also uses a SAMD21 chip and a very similiar SMD speaker.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.
Hey @deshipu did you ever figure out what was the problem, I'm testing my design (https://hackaday.io/project/165887-pam8301-breakout-board) with a SAMD51 board and while I can sometimes get some sound (mostly when i touch the wires in the "correct" way, it's pretty bad overall. I do wonder if audio just hates jumper wires and it will work better when it's on the same PCB as the MCU, or is there some extra design considerations?
Are you sure? yes | no
Faulty chips in my case.
Are you sure? yes | no
Oh, so just putting a new one worked fine? I got mine from Mouser so I guess it should be fine. Maybe it's the wires after all.
Are you sure? yes | no
Yeah, check the next log entry.
Are you sure? yes | no
I don't see your schematic's R7 in the PAM8301 datasheet's typical application circuit. Out of curiosity, what would happen if you made that 0 Ω instead of 47 kΩ?
Are you sure? yes | no
Tried that, no change. I now suspect the chips (which I got from Aliexpres) are faulty. Ordered (hopefully) good ones from Mouser, we will see when they arrive.
Are you sure? yes | no