So we got this cool badge from the LayerOne 2017 conference in LA in May, and it supports CAN (SW pending), plays SNES (with an optional USB controller) and a bunch of other things - https://hackaday.io/project/13262-layerone-2017 . One of the design decisions was to have a headphone jack but no onboard speaker. I sought to change that.
I'll explain what I figured out, what worked, and what went wrong.
"Internal Speakers Magnet 30x20mm 2500Hz 8Ohm 1W for PC Laptop "
"XPT8871 5V Mono Channel Digital Audio Lithium Amplifier Board for Arduino"
Now that I had all my parts chosen, and working on my desk with a slew of alligator clips, it was time to assemble it all together. In rough order:
I removed the old voltage and signal test leads.
Superglued the pot to the bottom edge, after bending the pins/supports in a useful way. I had originally tried hot glue here but it wasn't strong enough (or at least I was too impatient to let it fully cure).
Soldered in the resistors between the signal lines and the pot.
Hot glued the amp board on. While there's no real exposed connectors, the hot glue also forms a "pad"/air-gap ensuring nothing's shorting.
I cut to length and soldered the wires between power, the pot, and the amp.
Hot glued the speaker on, and cut and soldered it's wires.
Everything looked better than I expected.
Then I turned it on...
unsoldering power and signal lines
checking for sloppy shorting soldering
checked for burned out components
charging the battery/trying a different one
at best I can get only a quick flash of LED1
tried USB power
LED1 blinks repeatedly, but no screen
I broke out the VOM and measure:
With battery: 3V3 = 0V and 5V = ~0.5V
With USB: 3V3 = 0V and 5V = ~4.8V
So I suspect something's wrong with the power regulator circuit.
At this point all the easy troubleshooting didn't resolve it.... not sure if/when I'll get back to this.
Galaga (which happens to be one of my faves from my youth) turned out to be the loudest.
So I just threw my super convenient Xminilab Portable scope (affiliate link) on it, and wired in a 100K potentiometer to manually find the the point where the signal into the amp wouldn't exceed the clipping voltage (see prior post). If you don't know, you don't just wire the pot as a resistor, you connect both the signal wire and signal ground, to create a voltage divider. Sometimes a voltage divider in an audio usage is referred to an L-pad (because of the shape of the schematic) but often that's only used for speaker-level control, it seems.
This worked: R1 = 65.5K, and R2 = 27.2K, for a R2 / (R1 + R2) ratio of 0.293. I suspect the amp's impedance was having a significant effect.
That worked out well but I found a weird effect, if I turned down the volume too low (R1 = 88K and R2 = 5K) I would get a weird "machine gun" effect over the audio. Listen here:
This is where I admit I'm not so good with AC circuits....
So my next thought was if R2 was too low so I tried putting a number of different resistors in series with R2, but while that seemed to work, it also prevented it from getting very quiet. So I increased R1, which again led to "machine gunning" at low levels, so I increased R2 again, and so forth. Some EE is probably laughing at me right now... but after a bunch of experiments I realized I couldn't both minimize the volume on one end *and* maximize the volume on the other end.
To complicate matters I didn't want to use the full-size potentiometer I was experimenting with so I popped over to All Electronics and found something suitable (see main completed image) but not exactly what I wanted. What I wanted was something like the volume control you'd see on an old transistor radio.... but I didn't know until later that's called a Thumbwheel Pot.
That pot turned out to be 150K (actual 144K).
For best loudness
without distortion at low end:
R1S (in Series with R1) = 150K (146.7K actual) and R2S = 18K (17.49K)
For best softness
although giving up max loudness:
R1S = 500K and R2S = 4.3K (No actual values
So I went with the later... next to choose which speaker.
Since I was aiming for 1W 8ohm speakers, I was wondering what the peak voltage I might see would be:
= (P * R) ^ 0.5, or (8) ^ 0.5, or 2.83V peak
On the badge there's a choice of 3.3V or 5.0V.
Specs from eBay:
Input: DC 5V 1A
Output power: 5W
(also a schematic of the board)
Doing some more research I came across this link which corrects and expands on that:
Input: 2.0V - 5.5V
5W (2Ω load) and 3.5W (3Ω load), 3W (4Ω load)
AB / D switching (Judging by the image of the board, it looks like "Mode" is connected to GND so it's in A/B mode)
Compatible with LM4871 (although this seems suspect)
There's also a link to the datasheet but it's mostly in Chinese so it's only so helpful.
While the charts in the PDF are in English, they're not numbered, but here's some choice notes:
For VDD = 3.3V, RL = 8 ohms, THD+N shoots up past 0.4W
For VDD = 5V, RL = 8 ohms, THD+N shoots up past 1W
If one is to believe it's compatible with the LM4871, the datasheet offers more information, particularly:
Figure 22 - clipping voltage for
5V is ~0.3V, and for 3.3V is ~0.2V
At first I tried the 5V source but it was way too noisy and had drop outs - I thought about filtering and adding a
cap to get past the drop-outs, but I decided to try the 3V3 source first. I think the issue with 5V is because of the MP3401 Boost
circuit, see the description and schematic towards the end of this post.
This worked much better but I could tell I was over-driving the input to the amp and getting distortion. I'll tackle that in the next post.
Not that you can't mostly figure these connections out without flipping it over ... but I've also identified the line out signal and GND.
The Easter Egg
When talking to one of the creators at LayerOne he let me know there's an unpopulated LC circuit for a low-pass filter on the board, to keep down
excessive treble. I haven't seen a schematic from theme, but it seems likely it's this: