No DAC on 4.0. Alternatives?

Status
Not open for further replies.

donperryjm

Well-known member
I noticed my 4.0 doesn't have the DAC pin that the 3.2 had. Is it possible to use one of the other pins to do this?
What do you guys recommend?
 
I don't know if it will work, but you might try an i2s to speaker solution such as:

Now obviously to use i2s you would need to use the audio library instead of just analogWrite.

I know back in the days when I used Arduinos, I recall you could use the tone function on a PWM pin (and it was listed as working in the T4 beta list) to output a single frequency that you could hook up to a buzzer if you wanted just different sounds.
 
I just want to be able to get a small analog signal out after using the audio library. Can you verify that pins mentioned above will work? I'm planning for the device, I don't have it yet
 
none of the solutions suggested above provide an "analog" voltage -- they all are generating square waves, and duty cycle determines "average voltage"
 
I guess I'll just use the Pt8

I have no problem using a self configured DAC, but i still don't know how to wire it up in the gui to a set of pins that would allow for this.
 
I believe it can be used, but maybe not yet?

But acording to Paul somewhere the DAC is only good for about 10 bits above its noise floor.
 
I believe it can be used, but maybe not yet?

But acording to Paul somewhere the adc is only good for about 10 bits above its noise floor.

10 bits might would be fine for what I'm after. But still interested in knowing how to do the pre-DAC outpuits :)
 
I guess the DAC object in the audio library needs to be updated.

I didn't follow the 4k of posts so I'll shut up now.

Edit... might have been ADCs I'm remembering...
 
Just to confirm (in case anyone needs to hear it directly from me), Teensy 4.0 does not have a true analog output DAC, like Teensy 3.2, 3.5 and 3.6 do. NXP simply did not put one inside this chip.

If you need a true analog DAC, use the older boards, or plan on adding a DAC chip.

You can use PWM or MSQ and analog low pass filtering for a "poor man's DAC", but the results are not as good as a real DAC, especially the PSRR spec.
 
Wow finally, this one post from you finally cleared my heard. I know it is probably trivial, but how does one use an external DAC with the teensy for audio purposes, and what would the best DAC be. I could google it, but would just be crushed by the overflow of information. In a true sense, I am an actual beginner to the digital domain. Thank you
 
Wow finally, this one post from you finally cleared my heard. I know it is probably trivial, but how does one use an external DAC with the teensy for audio purposes, and what would the best DAC be. I could google it, but would just be crushed by the overflow of information. In a true sense, I am an actual beginner to the digital domain. Thank you

It sort of depends on what you want to do. The most typical way is to use digital I2S and let the I2S device generate the sound. And for the Teensy 4.0, the main method it to get the version D audio shield and just attach it to the Teensy. This provides stereo output to either a headphone breakout or to unamplified speakers with L-G-R or L+/L- and R+/R- pins.

For the headphone breakout, with a 3.5mm plug, there are various devices that take headphone and produce sound. You can find cheap versions of these speakers that are often called bomb speakers or hamburger speakers. They have some amount of battery, use USB charging, and can produce sounds:

A little higher on the quality spectrum is the monoprice guitar amplifier. You have to remember to press a button after turning it on to switch it to playing sound from the headphone:

If you go with the speaker output instead of headphone output, you need to apply proper amplification to the sound and then feed that into the speakers. I've used the amplifier and speakers from Adafruit that give decent sound if you are close to the Teensy:

Alternatively, you can by-pass the audio shield, and use a direct I2S card that produces sound. For example, both Adafruit and Makerhawk makes a simple stereo I2S -> mono speaker card that includes an amplifier. So all you need is a cheap speaker. I'll put a link to one article I would about using the Makerhawk card below:

Adafruit and HiLetgo also make I2S stereo decoders. Like the audio shield, it produces either headphone output to a 3.5mm jack or L+/G/R+ to unamplified speakers:
 
Can you please explain deeper the PT8211 solution ( also mentioned on https://forum.pjrc.com/threads/61841-Teensy-4-1-DAC-Output) ?

I have a working Teensy 3.2 with the DAC A14 pin and the analogwrite command. Seen the expected end of live of the Teensy 3.2 one day, I like to replace this with the Teensy 4.0 (or 4.1) for future units. I don't have any SPI display or other, as such, I could use PIN 12 on the Teensy 4.0. Mono signal is fine for me. So far so good.

But as I use the analogwrite command built from a Look Up Table etc, I cannot fall back to a simple “digital” version of that command or switching to another digital library.

As such, can I use the PT8211 kit (https://www.pjrc.com/store/pt8211_kit.html), and connect Teensy 4.0 PIN 12 to the input of the PT8211 ?

On that same PT8211 page, its mentioned: “change AudioOutputI2S to AudioOutputPT8211. Also delete any AudioControlSGTL5000 object.” . However, we don’t use the AudioOutputI2S command for the Teensy 3.2 ?
As such, it’s not clear how to convert from an ‘analogwrite’ command to something that would work with the PT8211 ?

I looked also on https://github.com/TeensyUser/doc/wiki/Audio-Examples , but I have not found what is suitable for the PT8211 kit.

Thank you
 
Status
Not open for further replies.
Back
Top