Micro USB Audio and Link Cable

Two more comments:

I would have expected headphones to be downstream of the amp.

Was a two wire interface (half duplex) considered and rejected? It wouldn’t require the switch.

This is volume control from Adafruit’s schematic for the amp’s breakout board and works fine with ATMLib. Headphones would be downstream of the amp and if I understand the amp’s datasheet correctly you can drop the low pass filter.


I got why you dropped the ferrites but the two 220pf capacitors should probably still be there?

Yeah this is the schematic I used, and thats where the trimpot between the channels came from! :slight_smile: Not my idea, but I guess it works.

Shorting them together kind of makes sense in that the voltage potential approaches 0, and the 10k pot limits the current.

Oops so the C16 needs to be before R6?

Don’t we want the audio out to be at TTL levels? Would putting the audio out powered by the amplifier cause any problem when plugged into recording equipment?

I guess a 2.5W amp isn’t TOO strong, but how much current is supposed to be going through an audio out?

And the question I have using the output of the amp is… Where do I tie the negative signal VO-?

I could tap VO+, but I still need to use signal GND on the output, it’s only a half wave amp at that point?

But your schematic is different. You are connecting AIN+ to AIN- through a resistor. The schematic I shown does not. What it does is using the trim pot as a variable voltage divider but it doesn’t connect AIN+ to AIN- through a resistor.

No I don’t think so :stuck_out_tongue:

Yes, for the same reason as above i.e. you don’t want to close the circuit.

That’s a good point. I thought it would be OK for connecting headphones, but maybe not, and in that case the headphone jack should be between the trimpot wiper and the PAM8302 input (via filter) like in your schematic but only AIN+ would be connected to the trimpot and the filter’s capacitor needs to be moved. Headphones would not be as loud as they could be because only AIN+ would be connected but last time I tried they were quite loud anyway.

My schematic is the same, adafruit has used named nets to connect AIN- I have just drawn the connection because it is more obvious:


I’m not sure the 220pF does much? Not really sure but isn’t that just balancing the impedance of the cables? The suggestion in the datasheet says:

“A simple solution is to put an additional capacitor 1000μF at power supply terminal for power line coupling if the traces from amplifier to speakers are short (< 20CM)”

But again, I’m not really worried at all about EMI, I’d do it if there was some kind of performance benefit. The 220pF I think are too small to do much of anything in our application and the 1000uF is a pretty large can I’d like to avoid although I’ll probably end up needing something similar for a voltage booster elsewhere on the board to generate voltage for the OLED…

Updated schematic to fix the filter:

The way I read this: https://forums.adafruit.com/viewtopic.php?t=108000#p539963 seems to match the way I am proposing to wire up the trimpot. Am I misreading it? (not a rhetorical question).

The thread you are referencing is just suggesting to use an additional trimpot in front of the board, so that you can use a thumb knob instead of having to use a screwdriver to adjust the small one on the PCB.

"I have my adafruit pam8302a working and can adjust the volume with the on board pot. "

But mine will be designed to use a good thumbwheel instead of the screwdriver one.

There shouldn’t be a need for 2 potentiometers in series.

You are right about this by the way. I just looked at the pictures of the breakout board’s PCB and AIN- is indeed connected as you said.

The question is indeed about an additional trimpot but the reply talks about connecting it directly to the amp, at least that’s the way I read it.

Yes the thread, summed up is:

“It’s annoying to adjust the volume with the screw, what else can I do?”


“You can add a trimpot in front of the amplifier that is easier for your fingers”

There is no electrically benefit or reason to doing this it’s explicitly an ergonomic addition.

They are referencing their entire module, NOT the chip. I think that might be your confusion.

Agreed, so your schematic is equivalent to the one of the break out pcb. Thank you for your patience.

I still have misgivings about “shorting” AIN+ and AIN- through the trimpot. I’d try placing a capacitor between pin 1 of the trimpot and AIN- to avoid drawing current, what do you think?

I’m gonna probably build something and see if anything catches fire.

The biggest issue seems to be getting an earful of serial data if you plug in headphones at the wrong time.

I’ve got a friend on twitter trying to come up with a switching regime so that serial is enabled through software to try and avoid that.

Here’s my take on it:

As @dxb mentioned. We need to use TWI / I2C as Rx is in use for FX chip.
With TWI we don’t need the cross switch. pullups maybe need to be a bit lower like 4K7 (depends om cable length)

the trim pot was there to balance the negative input of the amp in case only AIN+ is wired up. I replaced it with a fixed resistor and added a pot to control the volume.

I also added a 2bit R2R dac so ATMlib and two channel sound (forgot which lib uses that) should work fine.

if there wasn’t going to be a line out. I’d skip the dac part, added a 2nd filter so each SPK pin has it’s own filter, hooked the filter output to a stereo pot and connected the stereo pots outputs to AIN+ and AIN- (without the ballance pot and resistor)


Clever! Am I right in saying that with this setup, one of the two channels of a two-channels-pwm-library would always be louder than the other?

that’s correct.

There’s a disadvantage though. Differential sound with two pins will have less volume than if a single pin is used.


The amp is expecting a differential signal, if you’re feeding it a positive biased signal only you’ll have to tie IN_N to ground.

Using TWI is a good option too but we should test it. I can easily use a different enable pin than RX.

The advantage of TWI you can potentially daisy chain. The downside is it’s not asynchronous so you’d have to do time sharing which depending on the data rate might not be ideal for multiplayer. Although just passing some limited XY data isn’t probably going to push the boundaries.

I noticed that and I am not sure I am ok with it but your R2R solution is simpler and cheap. I’ll see if I can propose an alternative but I doubt it!

Yeah, but let’s keep in mind we are now using an amplifier and a real speaker. The on-board sound will be still be TOO LOUD at max volume (probably)

Considering you won’t be using headphones but probably some kind of line-in with Arduboy then the TTL levels matter because you are using fidelity but as our signals are just modified square waves it really shouldn’t matter too much so long as the edges are sufficiently sharp (as modified by the bandpass).

I mean, right? This is cutting edge stuff for my simple brain.

I wasn’t sure that would be a save option as some amps have internal feedback/bypas resistors. But I found the PAM8302A evaluation board user guide that has a jumper that grounds AIN- so it’s safe :+1:

Lolz. that’s easier said then done. It’s no problem for the bootloader as I’ve made versions for both Rx and SDA. But for the library you’d better stick to one configuration. Otherwise installing a board package with an option to select Rx/SDA (like there is in the homemade package) becomes mandatory.

Sychronous makes it more reliable. It can run perfectly run in the background when I understand the datasheet correctly. TWI might even better then normal serial.

  • higher bitrates
  • Don’t need cross cable
  • hook up more then two Arduboys (in parallel)
  • can also be used to interface with sensorboards

Thinking about that last one. How about adding SDA SCL to a ‘grove’ connector instead of audio jack? Don’t have to worry about deafening digital sounds when you hook up a headphone.

Oh I know! We are starting to see the exact reasons that I made this section private! This is still development!!

It looks like we will be switching to using SDA for the chip select pin so that we can use hardware serial over the audio jack.

The advice I have got is that we will have a LOT of problems with signal integrity because of the length of the signal. It shouldn’t be any longer than a few inches. It might be possible, but honestly I think we would need drive transistors because whats in the GPIO probably isnt enough to switch such an impedance load.

Why don’t I make it a micro-hdmi port while I’m at it. It’s a cable everyone has. Grove connectors are huge.

So ya, to reiterate looks like we are moving chip select to SDA.

I guess to be scientists we should compare the performance of TWI vs Serial over a 3m audio cable. I suspect the TWI won’t work without extra circuits and fiddling that might not work again when using a 6m cable.