PDA

View Full Version : Amplify output from teensy audio adapter.



toreil
03-07-2016, 06:21 PM
Hi .

Can someone please infor me on best way to amplify the signal from the teensy audio adapter,.
I got good sound in headphones, and in std 8 ohm speaker, but its not loud enough.
Have tried some line in amps and pc speakers, but gets mainly a lot of noise.


Tore

Epyon
03-07-2016, 06:34 PM
Check out the LM48310 audio amplifier? It's the chip that the beta prop shield (https://forum.pjrc.com/attachment.php?attachmentid=6561&d=1457102936) uses.

PaulStoffregen
03-08-2016, 12:59 AM
If you're building your own, the LM4871 might be easier to solder.

The LM48310 chip on the new prop shield is awesome, but it only comes in a very small surface mount package that's almost impossible to hand solder properly.

ballison10
05-18-2017, 03:00 AM
I just made an account to ask for some guidance, I have the same problem as toreil and just ordered an LM4871 (http://www.ti.com/lit/ds/snas002f/snas002f.pdf)
I'm fairly inept with wiring, but I am working on a project and have been able to do just fine until now. I have a teensy 3.2, teensy audio board, and a variety of small speakers. I am able to get a little sound from an 8ohm speaker wired into the headphone jack but unfortunately it's not loud enough and I needed an amplifier.

Just wanted to get my wiring plans in order before the LM4871 arrives. Would this work? I was planning on going from the Teensy 3v pin to VDD with the amplifier's GND going to the Teensy ground right next to 3v. For input into the amplifier I was going to go Line Out L to (+) and the ground right next to the line out to (-). And then VO1 and VO2 to the speaker. I don't think I need a shutdown or bypass unless that's required to make the amplifier work (my project is going to be plugged into a computer the whole time and will just be outputting a few sound bytes every couple seconds for 5 or so minutes at a time).

I would appreciate if someone could help! Thanks a bunch!!

PaulStoffregen
05-18-2017, 09:25 AM
For best power output, you probably want to run this amplifier from 5V power. With the 3.3V power, your maximum power output to the speaker will be less.

You do need a series capacitor, as shown in the LM4871 example circuits. Since the audio shield already has a 2.2 uF capacitor in series with its output, that capacitor should do quite nicely.

Those 2 resistors in the LM4871 example set the voltage gain. For the most power output, you'll probably want about 3X to 4X gain, so the 1Vp-p line output gets turned into 4 to 3 Vp-p onto the speaker. You might also want to add a volume knob, since that will be quite loud (at least for listening in a quiet indoor setting). Unlike the headphone output where the SGTL5000 has an analog volume control built in, the line out signals are fixed levels.

ballison10
05-18-2017, 02:17 PM
Thank you so much for taking the time to respond, Paul, that's why I went the teensy route in the first place!

I do have a volume potentiometer in the handy spot on the audio board, is that sufficient?
Thanks again!

ballison10
05-21-2017, 02:25 AM
Okay got my amplifier wired in (incorrectly I'm sure), and I'm having a problem getting any volume out of the line out pins. I can solder into the headphone jack for audio and it works, but its pretty muffled and I don't think I'm supposed to be doing that haha. Not sure if the muffling has anything to do with the output, could just be a shoddy speaker.
Anyways, in order to get the line out to work do I need to change anything in my code? I know you said the line out signals are fixed levels, and I read somewhere that you can adjust the line out with something like sgtl5000_1.lineOutLevel(), but I don't completely understand how that works or if that's even related to my problem.

this is what my set up looks like:
10639

And I have the code set up like so:


AudioPlaySdWav playSdWav1;
AudioOutputI2S i2s1;
AudioConnection patchCord1(playSdWav1, 0, i2s1, 0);
AudioConnection patchCord2(playSdWav1, 1, i2s1, 1);
AudioControlSGTL5000 sgtl5000_1;

and have the potentiometer set to change the sgtl5000_1.volume(); as it previously was adjusting the volume for a speaker I had going into the HP jack.

Any advice would be greatly appreciated!!
Thank you!

PaulStoffregen
05-21-2017, 12:31 PM
You need to add at least 2 resistors and probably 1 capacitor.

Look at figure 3 in the LM4871 datasheet. You need a resistor between pins 4 and 5, and another resistor between pin 4 and the line-out signal. You can't just connect the signal directly to pin 4.

The 1uF capacitor connected to that resistor is not needed, since one it built into the audio shield. It's ok to wire the output to that resistor without the capacitor shown in figure 3.

However, you probably do need to add a capacitor to pin 2+3. Looks like you have pin 3 shorted to ground. That won't work. You're supposed to connect pins 2 and 3 together and wire them to a capacitor. The other side of that cap goes to ground.

Pin 1 needs to connect to ground. You don't need a resistor and switch as shown. Just wire it to GND.

With these changes, it should "work". However, you may get poor performance without a ceramic capacitor located close to pins 6 and 7.