🛠 Entrées analogiques du Teensy 4.1 : 18 broches, 2 ADC, 0-3,3 V fixes et zéro DAC

Teensy 4.1 · debutant · Schéma : les 18 entrées analogiques du Teensy 4.1 réparties sur les deux ADC, l'échelle de tension figée à 0-3,3 V, et l'absence de sortie DAC comparée aux Teensy 3.5/3.6 (MQS et codecs I2S en remplacement).

Objectives

Master the Teensy 4.1 analog capabilities: 18 inputs distributed across 2 ADCs, default resolution of 10 bits, voltage range fixed at 0-3.3 V. Three documented disappointments to know before wiring: analogReference has no effect, the hardware 12-bit resolution is not practically usable ("only about 10 bits are usable due to noise," product page), and the board has no DAC — unlike the Teensy 3.5/3.6, analog audio output goes through I2S, the MQS pin, or a PT8211 kit. As compensation, 4 analog comparators are embedded.

Hardware

Key Facts

Complete Code

const uint8_t AIN = 14; // A0 sur Teensy

void setup {
  Serial.begin(9600);
  while (!Serial && millis < 3000); // laisser monter l'USB série
  analogReadResolution(10);           // 10 bits : ce qui sert vraiment
}

void loop {
  long somme = 0;
  for (int i = 0; i < 64; i++) somme += analogRead(AIN);
  int moyenne = somme / 64;           // suréchantillonnage anti-bruit
  float volts = moyenne * 3.3f / 1023.0f;
  Serial.printf("A0 = %d  (%.3f V)\n", moyenne, volts);
  delay(250);
}

Expected Verification

When turning the potentiometer, the displayed voltage smoothly follows 0.000 → 3.300 V. Averaging over 64 samples stabilizes the last two digits: this is the counterpart to the noise floor documented by PJRC. To go further (precise triggering, hardware oversampling), Pedro Pereira's third-party ADC library is the community reference, but the 10 useful bits remain the physical ceiling.

Common Errors

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials