Codey OnlineBibliothèque de composants Arduino & ESP32 › 3W amplifier MAX98357A I2S DAC
3W amplifier MAX98357A I2S DAC
Sortie

3W amplifier MAX98357A I2S DAC

Module ampli mono Class-D MAX98357A I2S (3W). Reçoit l’audio I2S numérique et pilote directement un haut-parleur. Aucun DAC nécessaire — entrée numérique, sortie analogique amplifiée.

Protocoles: I2S Largeur: 17.9 mm

Brochage — 3W amplifier MAX98357A I2S DAC

Broche Signal Description
SPK - audio Speaker - out
SPK + audio speaker + out
LRC data bottom header far-left hole
BCLK SCK bottom header left hole
DIN data bottom header center-left hole
GAIN digital bottom header center hole
SD data bottom header center-right hole
GND ground bottom header right-center hole
VIN power bottom header far-right hole

Conseils de câblage

Broches d’entrée I2S : BCLK (bit clock), LRC (word select / LRCLK), DIN (données série). Alimentation : VIN (3.3V-5V), GND. Sortie haut-parleur : relier directement SPK+ et SPK- à un haut-parleur passif (4-8 ohm, jusqu’à 3W). Indiquez TOUJOURS le raccordement du haut-parleur dans les schémas de câblage — l’amplificateur ne sert à rien sans lui. Broche GAIN : laisser non connectée pour 9dB, relier à GND pour 12dB, relier à VIN pour 15dB. Broche SD : laisser non connectée ou mettre à HIGH pour activer ; mettre à LOW ou relier à GND pour arrêter.

Exemple de schéma de câblage — 3W amplifier MAX98357A I2S DAC

De Vers Fil
board:5V x1:VIN red
board:GND x1:GND black
board:D9 x1:BCLK green
board:D8 x1:LRC blue
board:D10 x1:DIN yellow

Exemple de code Arduino — 3W amplifier MAX98357A I2S DAC

Cet exemple a été écrit et vérifié à la compilation pour le arduino-uno. Codey Online l'adapte pour vous à toute autre carte prise en charge.

#include <Arduino.h>

// Canonical beginner example for MAX98357A on Arduino Uno.
//
// Important:
// The Arduino Uno (AVR) cannot generate hardware I2S with the standard core,
// so this sketch demonstrates the wiring and control pins, then produces a very
// simple software-generated square-wave audio pattern on the data pin.
//
// Wiring used:
//   D9  -> BCLK
//   D8  -> LRC
//   D10 -> DIN
//   5V  -> VIN
//   GND -> GND

const uint8_t PIN_BCLK = 9;
const uint8_t PIN_LRC  = 8;
const uint8_t PIN_DIN  = 10;

const unsigned int toneHz = 440;
const unsigned long toneOnMs = 1000;
const unsigned long toneOffMs = 500;

void outputSquareWave(unsigned long durationMs, unsigned int frequencyHz) {
  // This does not create real I2S audio; it is only a simple beginner demo.
  // The MAX98357A requires an I2S-capable source for proper audio playback.
  unsigned long start = millis();
  unsigned long halfPeriodUs = 500000UL / frequencyHz;

  while (millis() - start < durationMs) {
    digitalWrite(PIN_DIN, HIGH);
    delayMicroseconds(halfPeriodUs);
    digitalWrite(PIN_DIN, LOW);
    delayMicroseconds(halfPeriodUs);
  }
}

void setup() {
  pinMode(PIN_BCLK, OUTPUT);
  pinMode(PIN_LRC, OUTPUT);
  pinMode(PIN_DIN, OUTPUT);

  digitalWrite(PIN_BCLK, LOW);
  digitalWrite(PIN_LRC, LOW);
  digitalWrite(PIN_DIN, LOW);

  Serial.begin(115200);
  Serial.println(F("MAX98357A example starting."));
  Serial.println(F("Arduino Uno does not support native I2S in the standard AVR core."));
  Serial.println(F("This sketch only demonstrates basic pin control on the labeled connections."));
}

void loop() {
  Serial.println(F("Tone ON"));
  outputSquareWave(toneOnMs, toneHz);

  Serial.println(F("Tone OFF"));
  digitalWrite(PIN_DIN, LOW);
  delay(toneOffMs);
}

Composants similaires

Active Buzzer Module

Active Buzzer Module

⚙️

LED

LED Matrix Module MAX7219

LED Matrix Module MAX7219

Passive Buzzer Module

Passive Buzzer Module

Construisez votre projet Arduino ou ESP32 avec l'IA

Décrivez ce que vous voulez créer. Codey Online écrit le code, dessine le schéma de câblage, le compile et flashe votre carte directement depuis le navigateur.

Commencez gratuitement