very basic questions re: DAC on teensy

pqov

Member
Hi! I'm absolutely new to the world of arduino/teensy/etc., so forgive my ignorance -- I have yet to read any tutorials, etc. I'm just trying to select the right board for my project.

I understand that the Teensy boards all have DACs on them, correct?

Assuming that's correct, is the analog output roughly equivalent to "line level"? Meaning, going into the impedance of the average "line in" it's going to work OK?

Is the DAC output just a couple of pins somewhere on the board that can be soldered to? (Meaning, no other module is required I assume?)

I'm going to be reading a hall effect sensor, a button or two, and some kind of rotary knob (i.e. with detentes that signals as each detente is reached), generating a sine wave out of the DAC, and flashing a couple LEDs. (I assume the teensy is capable of much more than this, but just wanted to explain the basics.)

Thanks!
 
Hi! I'm absolutely new to the world of arduino/teensy/etc., so forgive my ignorance -- I have yet to read any tutorials, etc. I'm just trying to select the right board for my project.

I understand that the Teensy boards all have DACs on them, correct?
I'm a software guy, so I will defer information about details and such to others.

First of all, there is are older variants of Teensy (Teensy 2.0 and 2.0++) that really aren't part of the modern Teensies normally talked about here. These teensies use the 8-bit AVR 32u4 chips, and not the ARM based chips the more modern Teensies use. I don't think the AVR 32u4 has DAC support at all.

In addition, two of the 'modern' Teensies (3.0 and 3.1) have been obsoleted for several years now. IIRC, the 3.0 did not have a DAC. The 3.1 was replaced by the 3.2 (there are some minor differences, but the 3.1 and 3.2 are essentially the same). Of the Teensies:
  • Teensy LC: Has a single DAC;
  • Teensy 3.1/3.2: Has a single DAC;
  • Teensy 3.5/3.6: Has two DACs so you could do stereo;
  • Teensy 4.0/4.1: Does not have DAC's (the chip maker removed the DAC capability).

Unfortunately, with the current chip shortages, the Teensy LC, 3.2, 3.5, and 3.6 are unobtainable. I think Paul said that maybe there was a batch of LC's that was in production. I don't remember if it will be available shortly, or if it went out, and it has been sold out.

I believe the Teensy 4.0 has been out of stock, but the PJRC product page says they will have some availability in December. At the moment, Teensy 4.1s are available (though mostly without the ethernet support that part of the initial design, but you likely don't need that).

The Teensy 4.0/4.1 has support for MQSR/MQSL, which is a 'medium quality' system for playing sounds. You can use this like a DAC. The trouble with MQSR/MQSL is it uses hardwired pins. One of these pins (12) is one that is needed to do SPI for hooking up faster displays. There are alternate ways to do displays, but it can be a problem.

Normally however, you use the audio adapter (https://www.pjrc.com/store/teensy3_audio.html) or low cost PT8211 board (https://www.pjrc.com/store/pt8211_kit.html). The audio adapter has both 3.5mm headphone and line level output. The PT8211 only does line level. You can also buy external I2S devices to emit sounds that you hook up to the appropriate pins.

For line level output, you normally have to hook up an amplifier before you attach a speaker. The DACs just change the voltage from 0 to an upper limit (normally 3.3v), that you would have to attach a speaker. Adafruit sells a nice combined mono speaker that takes 3 pins (ground, DAC/line out output, and power, https://www.adafruit.com/product/3885).

Assuming that's correct, is the analog output roughly equivalent to "line level"? Meaning, going into the impedance of the average "line in" it's going to work OK?
Here is where somebody else needs to chime in.

Is the DAC output just a couple of pins somewhere on the board that can be soldered to? (Meaning, no other module is required I assume?)

On the Teensys with DACs yes. The DAC is just a pin that you vary the voltage to. The interface is to call analogWrite on the pin to vary the voltage. Additionally, there are PWM (pulse width modulation) pins where you can tell the Teensy to rapidly turn the pin on/off, and if you hook up an amp and speaker, you can hear sounds. Unfortunately the initial Arduino code uses analogWrite to also control PWM pins (the original AVRs did not have DACs). So if the physical pin is a DAC, you get true analog output, if it is a PWM pin, you get this rapid on/off to simulate a DAC.

I'm going to be reading a hall effect sensor, a button or two, and some kind of rotary knob (i.e. with detentes that signals as each detente is reached), generating a sine wave out of the DAC, and flashing a couple LEDs. (I assume the teensy is capable of much more than this, but just wanted to explain the basics.)

Thanks!
For this purpose, you likely can use any PWM pin. If you want to play music, you probably want to step up from PWM. Using DACs is good enough for things like props where you want to play recorded sounds, but if you want true audio level music, you need to step up to the audio adapter.
 
Thanks for the detailed reply!

Sad to hear that the DAC is gone in the latest versions... I guess the Arduino has an analogous audio board as well (?) but part of the design objective here is to minimize the assembly/connectivity complexity, so I was hoping for something with a built-in DAC, and the internet pointed me to the Teensy.

At any rate, I'll keep checking out my options. Much obliged!
 
With Teensy 4.0 and 4.1, you might try the MQS output. It's 353 kHz PWM with noise shaping tricks which you low-pass filter with a resistor and capacitor. Sound quality is pretty good.
 
Yes, more or less. There is some noise shaping stuff it's doing in varying the pulse widths, which maybe some class D amps do too.
 
Back
Top