Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 17 of 17

Thread: Teensy 3.5/3.6 and simple headphone hookup

  1. #1

    Teensy 3.5/3.6 and simple headphone hookup

    Hi,

    This may be a super simple, super naive question. I have a project I wanted to revive from a few years ago, where I was using a Teensy audio board and Teensy 3.2 (I think). I was looking at the new 3.5/3.6, and the added speed and larger numbers of analog inputs look promising, so I have one arriving this weekend!

    In my project, I want to play/mix a bunch of in-memory audio samples onto headphones. With the dual DAC output now, my question is, is it reasonable to skip the audio board and just output directly from the teensy to headphones? If so, I'm curious if anyone can point me at best practices/guidance for hooking up headphones directly to the DAC outputs on the teensy 3.6? (note: I can probably get away without stereo, actually, so I suspect I only really need a single DAC, so I'm open to either).

    All the usual issues apply; I'm going to have analog sensors inputting to the board, will have some LEDs and perhaps a small OLED display, so I'd like to have some filtering. And, of course: I'm a CS person, using this to play with sensors and arduino, it's been dozens of years since I did basic electronics, so I'm mostly naive when it comes to the circuits side of things (more that I should admit).

    Thanks for any help.

  2. #2
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    1,999
    search forum and find:
    https://forum.pjrc.com/threads/24967...C-audio-output

    https://forum.pjrc.com/threads/28581...sy-3-1-DAC-A14

    DAC has DC offset and can only drive 1 ma -- feed it to an amp/line-in

  3. #3
    Sigh. Thanks. I was hoping to avoid using the audio shield but I guess that's probably not going to happen then.

  4. #4
    Senior Member oddson's Avatar
    Join Date
    Feb 2013
    Location
    Isle in the Salish Sea
    Posts
    1,112
    If this if for a one-off and your time is worth anything to you then absolutely the audio board is the way to go.

    Technically you could buy a DIP style audio amp and a few discreet components on a breadboard for a few bucks but not as a novice it's not worth it unless that's what you want to do for a few weekends.

    You could likely find some PC-amplifier-module boards that could talk to the ADCs on the Teensy and come a fair bit cheaper than the Audio Board but you still have to get them working too.

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,169
    If you want something small and portable, indeed the audio shield is the way to go, since building your own little amp board would involve quite a lot of the hardware design stuff you're looking to avoid.

    If something big and bulky is ok, you might have other options. For example, I have a M-Audio AV40 speaker on my workbench. When I want to do a quick test to hear the DAC output, I just connect the DAC pins to the "aux" input and then listen to the speaker, or plug in headphones. Big, bulky, expensive... but very quick & easy if the AV40 is already on your desk!

    Click image for larger version. 

Name:	maudio.jpg 
Views:	50 
Size:	25.8 KB 
ID:	12939

    I bought that speaker years ago, specifically because it had both of those on the front panel.

    If you have something similar laying around, like almost any non-USB computer speakers, maybe it can amplify the signal to let you listen easily.

  6. #6
    Hi

    Would a headphone amplifier like the hama HA202 or the FiiO A1 solve this also?

  7. #7
    Quote Originally Posted by PaulStoffregen View Post
    If you want something small and portable, indeed the audio shield is the way to go, since building your own little amp board would involve quite a lot of the hardware design stuff you're looking to avoid.

    ...
    Hi Paul

    Another question:

    I read that the audio shield has to have very short connections to the teensy. Are there problems to be expected when the teensy and the audio shield are both connected by the same "motherboard" aka a simple two layer pcb where and the teensy and the audio shield can be plugged in?

  8. #8
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,169
    A few inches is fine. The quality of the GND connection makes a difference. Running the GND trace next to MCLK and BCLK helps.

    For longer wires, adding a small series resistors close to pins 7, 11 & 23 may help. The exact resistor value to use depends on your PCB layout. A lower value (like 33 to 100 ohms) would be used if you have a 4+ layer PCB with the ground plane directly underneath the signals. For a 2 layer board where the ground runs alongside the signal, a higher value (like 100 to 330 ohms) would be used. But even if you don't get the resistor perfectly matched to the characteristic impedance of your PCB layout, even getting somewhat "close" makes a huge improvement in signal quality and a reduction in crosstalk.

  9. #9
    Member
    Join Date
    Sep 2014
    Location
    South Dundas, Ontario, Canada
    Posts
    37
    Quote Originally Posted by AlainD View Post
    Hi

    Would a headphone amplifier like the hama HA202 or the FiiO A1 solve this also?
    I use this unit for similar reasons for my headphone listening/testing of various audio devices. It has a gain switch for selecting High and Low to cover most situations.

  10. #10
    Quote Originally Posted by KOC62 View Post
    I use this unit for similar reasons for my headphone listening/testing of various audio devices. It has a gain switch for selecting High and Low to cover most situations.
    Hi

    Have you tested it with the teensy?

    I also found the lm4881 based amp, but it needs 12V and the board is rather large.


    BTW. I have nothing against the audio shield, but I don't like the nr of connections to make for a simple headphone output.
    BTW2. Adafruit has some small 2W audio amps but no headphone amp.

  11. #11
    Senior Member oddson's Avatar
    Join Date
    Feb 2013
    Location
    Isle in the Salish Sea
    Posts
    1,112
    LM386 is a standard workhorse for headphone amplification and the passive parts count can be as little as two caps and a resistor to condition the signal (if pre-set gain of 20 is sufficient, otherwise another cap and resistor may be needed).
    Plus it will work with 5V supply.

    But it's not trivial and the audio board is supported by the tutorial making it a much more attractive choice for electronics noobs.

    The connections between the boards, however, is a bit of a barrier for the soldering challenged and the amp-only option just needs power and signal from the Teensy.

  12. #12
    Member
    Join Date
    Sep 2014
    Location
    South Dundas, Ontario, Canada
    Posts
    37
    Quote Originally Posted by AlainD View Post
    Hi

    Have you tested it with the teensy?
    No, not yet. It may be awhile before I get to an audio teensy project, as I have a number of other projects on the go.

  13. #13
    Quote Originally Posted by oddson View Post
    LM386 is a standard workhorse for headphone amplification and the passive parts count can be as little as two caps and a resistor to condition the signal (if pre-set gain of 20 is sufficient, otherwise another cap and resistor may be needed).
    Plus it will work with 5V supply.

    But it's not trivial and the audio board is supported by the tutorial making it a much more attractive choice for electronics noobs.

    ...
    About the LM386: are there more considerations than written in the last of kurtE's posts Connecting-a-Speaker-to-Teensy-3-1-DAC-A14?

  14. #14
    Senior Member
    Join Date
    Apr 2014
    Posts
    303
    I have had several projects needing output from teensy to amp speakers or headphones, so I have been following this thread to see what best solutions to the queries people are posting...??
    I don't seem to have any problem I would use 22uf or 47uf etc as coupling to block the DC and maybe a 220 ohm or 470 ohm with a 0.1uf cap to AGND as low pass filter.
    Also to provide user control of tone and volume I would use a digital filter in teensy and adjust the corner freq. using a touch button, and add a mixer in teensy so as to adjust the gain for volume control, again with a touch button. This seems to provide good enough control for headphones of 32 ohms or more. I wouldn't connect 4 or 8 ohm speakers direct. If user want more sound amplfication then use any sound system with Linein to amp/speakers unit.

    Would the LM386 not work in this situation...same as any other amplifier, input AC coupling would block the DC..??...and why worry about the LM386 being powered by 12 volts if needed...??

  15. #15
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,169
    The DAC pins on Teensy are not meant to drive 32 ohm headphones. The maximum recommended current is ~1 mA, which corresponds to driving about 3.3K. An amplifier chip should be used for 32 ohm headphones or an 8 or 4 ohm speaker.

  16. #16
    Quote Originally Posted by Teenfor3 View Post
    ...
    Would the LM386 not work in this situation...same as any other amplifier, input AC coupling would block the DC..??...and why worry about the LM386 being powered by 12 volts if needed...??
    The LM386 can be powered by 5V. This means that teensy and amplifier can use the same supply and battery 5V solutions are easily available. Those can charged by usb (and testing can be done while powered by usb).

  17. #17
    Quote Originally Posted by oddson View Post
    If this if for a one-off and your time is worth anything to you then absolutely the audio board is the way to go.

    Technically you could buy a DIP style audio amp and a few discreet components on a breadboard for a few bucks but not as a novice it's not worth it unless that's what you want to do for a few weekends.

    You could likely find some PC-amplifier-module boards that could talk to the ADCs on the Teensy and come a fair bit cheaper than the Audio Board but you still have to get them working too.
    It's more or less a one-off; I am trying to make the project as small (or, specifically, narrow) as possible, since it's a musical instrument and the wider audio board was something I was hoping to get rid of.

    I'll stick with the audio board for now, perhaps some day in the future I'll take those two weekends and figure it out.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •