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

Thread: Teensy 3.2 DAC output options / ideas

  1. #1
    Junior Member
    Join Date
    Nov 2020
    Posts
    11

    Teensy 3.2 DAC output options / ideas

    Hello everyone,
    thank you very much for reading and looking at this post!

    I'm working on a new project and outputting to my teensy 3.2's DAC, which is working great! The project is mostly outputting filtered noise, so It's not really critical that the quality is super good or that the signal is stereo (I can send it to L/R later on if need be I suspect.

    I'm now at the phase of my project where I'm starting to think about how this output is going to be used. I have some knowledge here, enough to get myself into trouble, but not enough to really know fully what's going on.

    I'm planning on having 2 outputs for my device which can be selected via a switch headphones/line-out & a small speaker.
    I'll address these independently below as they are really 2 distinct issues.

    Headphones/Line-out:

    Currently I've tried 3 things.

    1. First is driving the headphones (and line-out to bluetooth speaker) straight off the DAC, this works, but from some other threads I've read that this is a bad idea because it is overloading the DAC pin and could cause issues with the hardware

    which lead me to:

    2. The CMOY headphone amp (Schematic) Which I'm currently running with 1/2 of a LME49720 from +9/-9 V. I assume I could run the other 1/2 from the same DAC input to make a duplication of the signal for stereo output.

    This works, and is extremely loud (the schematic's gain is set at 11 with R3 = 1KΩ & R4 = 10KΩ ....) I reduced this down so R3 & R4 = 1KΩ giving a gain of 2 which is much more reasonable.

    So my first question is Is this a reasonable solution? or am I missing something here?
    I'd rather not move to a split power supply from the USB's +5v if I don't have to, but if I do I can use a regulator to make it work...

    3. I also had a LM4808 lying around from a past project so I thought I'd give that a go

    It was behaving really unexpectedly. when I tried to set the gain using the Rf and Ri thing seemed totally backwards and ultimately, just running them both with jumpers 0Ω ended up giving the best results, although it sounded a bit off and was still pretty quiet. I'm really confused as to why the gain resistors here would cause such a issue. Using low Ω's seemed to work the best, but when I tried what I used in a previous project Rf @ 100KΩ and Ri @ 10KΩ for gain of 10, I was met with silence!

    I'm suspecting that this could be because the input voltage is rated for -0.3V to VDD+0.3V which if the DAC is running 1.33V peak to peak, means that the bottom 1/2 of the signal is effectively getting chopped off. Is that right? I'm really not sure about this.


    In summary, Are either of options 2 or 3 worth continuing or better than the other or should I be looking elsewhere entirely?
    Do I need to be doing something between the DAC and either of these options to further tame the signal for the specific chip's application?
    Is there a standard or resource that I could be pointed towards on the proper way to do this!?


    Small Speaker!

    For running speakers I've tried one thing and have a second option on the way to try hopefully tonight:

    1. I've been running this PAM8302A module from Adafruit directly from the DAC pins, from what I can tell this works fine. Although, admittedly, the speakers are tiny and it's hard to really tell what's going on.

    Are there any issues with this approach I should be considering?

    2. For a little more power I've got a PAM8406 module & PAM8610 Module incoming.

    I'm hoping the 8406 is powerful enough and again +5v so it could theoretically run off USB power which would be ideal, but not necessarily a deal breaker. I'm assuming that these are going to be basically the same as the 8302, so I'm mostly just wondering if there are any issues with the DAC -> Module approach.


    Thank you very much for looking and thinking about this with me! I've included below a diagram of what I imagine the output stage would look like and would appreciate any and all feedback.

    Click image for larger version. 

Name:	Screen Shot 2020-11-22 at 2.23.53 PM.jpg 
Views:	29 
Size:	35.0 KB 
ID:	22576

  2. #2
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    4,076
    Another thing to think about is getting the Teensy LC propshield:


    It is made to be attached above or below the Teensy 3.2, and it provides a 2 watt amplifier for the DAC that can be hooked up directly to 4 or 8ohm speakers. You need to set pin 5 high to enable the amplifier. The propshield has a few other things that might be useful:
    • Amplifier mentioned above;
    • Fast voltage conversion for pins 11 and 13 to drive WS2812B (neopixel) or APA102 (dotstar) led strings of lights;
    • 8 megabytes of flash memory that you can use to store things in;
    • Built-in pull-up resistors for pins 18/19 so that you can hook up I2C devices without having to possibly add pull-up resistors; (and)
    • The higher cost propshield has various motion sensors.


    Alternatively Adafruit has a small speaker that includes an amplifier directly. It has 3 wires (ground, power, and signal). On the Teensy 3.2, connect the speaker ground wire to analog ground, connect the signal to the DAC pin, and connect the power pin to either 3.3v or VIN. Note, if you are buying small numbers of things, shipping at Adafruit can be expensive using UPS (and I recently had an order disappear for a couple of weeks that was sent via the USPS).


    Note, the DAC has its limits in terms of sound quality. A better solution might be to use the Audio Adapter. Be sure to get revision C of the audio shield (meant for Teensy 3.2, 3.5, and 3.6) and not revision D (meant for Teensy 4.0 or 4.1).


    The audio adapter has a built-in jack for stereo headphones.

    You can also plug in speakers that have their own amplifiers that have a headphone plug into the headphone jack. I tend to like the so-called 'bomb' or 'hamburger' speakers:


    Or there are line-out options that you can connect to an amplifier for stereo output.

  3. #3
    Junior Member
    Join Date
    Nov 2020
    Posts
    11
    Note, the DAC has its limits in terms of sound quality. A better solution might be to use the Audio Adapter. Be sure to get revision C of the audio shield (meant for Teensy 3.2, 3.5, and 3.6) and not revision D (meant for Teensy 4.0 or 4.1).
    Absolutely appreciate the gesture to use the shield, and I may do that if I cant figure this out – it's a really great backup! But, in the interest of learning something new vs using another module, I'm hoping to learn more about these kind of output, amplification, and audio circuit issues.

    I don't need any sample memory or sensors, so generally this is why I'm trying to bypass the audio/prop shield since it's a rather expensive part if I make multiples later on.
    Eventually I'll lay this all out onto a PCB. So, I suppose a further option would be to take the parts of the audio shield schematic I need and re-lay them out into my project and use the same SGTL5000

    Adafruit has a small speaker that includes an amplifier directly.
    I don't think this will be loud enough for my application, I'm hoping to have a general ambient 'room-filling' sound when it's quiet. I've had good luck with 12watt speakers in the past, but I'm hoping the 5watt ones will be good enough!

    thanks for offering alternatives!

  4. #4
    Junior Member
    Join Date
    Nov 2020
    Posts
    11
    I also found this thread: https://forum.pjrc.com/threads/32597...DAC+headphones

    which maybe answers this question in that my approach with the CMOY / opamp direction is OK?

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    24,485
    Maybe look for one of the many little breakout boards using MAX98357. Power might be a little light or might work out pretty well, depending on how "quiet" the room is and how "room filling" you need the sound. Speaker placement can also much a huge difference in the amount of power you need.

    Or you could go with the super cheap PT8211 and then add a low cost amplifier with analog input.

  6. #6
    Junior Member
    Join Date
    Nov 2020
    Posts
    11
    Appreciate that! I'll look into the MAX98357. Are you recommending that for the speakers only or the headphones as well ?

    Generally do you encourage going with some sort of i2s / i2c output instead of directly from the DAC?
    I suppose it's ultimately about equally as difficult / amount of external components as making the op amp circuit?

    Speaker placement is so hard! the general plan is that the speaker will be behind PCB substrate with a grill pattern drilled into it mounted onto a wood enclosure.

Posting Permissions

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