🛠 Intégration produit : alimentation VIN/VUSB, régulateur 250 mA, RTC à quartz et EEPROM

Teensy 3.2 · avance · Schéma : IMG-teensy-32-avance-7-teensy32-alimentation-rtc-integration.svg — Teensy 3.2 vue de dessous : pads VIN/VUSB sous la carte avec ciseaux et trait de coupe annoté « séparer avec précaution », pile bouton 3 V sur VBAT et GND, quartz 32,768 kHz à souder entre les deux pads RTC ; à droite, jauge du régulateur 3,3 V plafonnée à 250 mA.

Objectives

Move the Teensy 3.2 from the breadboard bench to an integrated product: power via VIN without backfeeding into USB, do not exceed the 250 mA limit of the onboard regulator, enable the RTC (which requires a crystal to be soldered by the user), and save data in the emulated EEPROM and RTC RAM. Each point corresponds to a pitfall documented by PJRC and its forum.

Equipment

1) VIN and VUSB are connected: the backfeeding pitfall

On the Teensy 3.2, VUSB and VIN are connected underneath the board. Applying 5 V to VIN while the USB cable is plugged in sends current back into the computer — a risk for the USB port on both sides. To power via VIN while keeping USB connected (a "powered production, USB for debug" configuration), you must cut the link between the pads underneath the board — but be careful: cutting too deep severs the VIN trace in the internal layers of the board (repair thread on the PJRC forum). You can also power directly with external 3.3 V on the 3.3 V pin, respecting the constraint: the onboard regulator accepts a maximum of 250 mA of external load on the 3.3 V pin — a screen, LEDs, or an ESP8266 on this pin will cause a voltage drop. Indeed, the historical purpose of the reinforced regulator on the 3.2 (vs 3.1) is to be able to directly power an ESP8266 Wi-Fi module or a WIZ820io Ethernet module.

2) RTC: the crystal must be soldered

The PJRC technical specifications table is clear: the RTC requires a 32.768 kHz crystal soldered by the user onto the two dedicated pads — without it, the real-time clock simply does nothing. Once the crystal is installed:

// Le RTC garde l'heure grâce à la pile sur VBAT (3 V, type CR2032).
// 32 octets de RTC RAM (28 utilisables) sont également conservés par VBAT.
#include <TimeLib.h>   // bibliothèque Time livrée avec Teensyduino

void setup {
  Serial.begin(9600);
  setSyncProvider(teensy3Get);   // lit le RTC du MK20
  if (timeStatus != timeSet) Serial.println(F("RTC pas initialise"));
}
void loop {
  Serial.printf("%02d:%02d:%02d\n", hour, minute, second);
  delay(1000);
}

3) Non-volatile memory

4) Ground wiring

The board has 3 GND pins + 1 AGND: connect the power supply and the Teensy with a clean common ground (star topology), especially when using LED strips or an audio stage.

Expected Verification

With the battery + crystal in place: the time survives a total power cut of several minutes. Removing the battery: the clock resets to zero — proof that VBAT is working. When measuring: a multimeter in current mode between the power supply and the VIN pin shows the consumption of your assembly; keep the 3.3 V part under 250 mA. >

Common Errors

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials