Encomendado em dias úteis antes das 14:00 = enviado no mesmo dia e, em 98% dos casos, entregue no dia seguinte. Devolução gratuita 30 dias para refletir 1 ano de garantia

Esquema de ligação e exemplo de código

Como ligar o Altifalante 3W 40mm a um Arduino UNO ou ESP32, com um sketch de exemplo que podes carregar já.

3W Speaker Melody Demo

This project plays an 8-note musical scale on a 3W speaker using Arduino's built-in tone() function. The positive terminal connects to digital pin 9 and the negative terminal to GND. Note: while this direct connection works for simple tone generation, an audio amplifier is recommended for full volume and sound quality.

Esquema de ligação: Altifalante 3W 40mm num Arduino UNO
Esquema de ligação · Clique para ampliar
Tabela de ligação: Altifalante 3W 40mm num Arduino UNO
Tabela de ligação · Clique para ampliar
3W_Speaker_Melody_Demo.ino · compilado e testado
/*
 * ==================================================================
 *  Generated by Codey.online  —  https://www.codey.online
 * ==================================================================
 *  Project   : 3W Speaker Melody Demo
 *  Board     : Arduino UNO (arduino:avr:uno)
 *  Parts     : Speaker 3W
 *  Libraries : none (built-in)
 *
 *  Codey Online is an AI-powered browser IDE for Arduino and ESP32.
 *  Describe your project and Codey writes the code, draws the wiring
 *  diagram and uploads it to your board, straight from the browser.
 *  This code is free to use, modify and share, without warranty.
 * ==================================================================
 */

const int speakerPin = 9;

// Musical notes (C4 to C5 scale in Hz)
const int notes[] = { 262, 294, 330, 349, 392, 440, 494, 523 };
const int noteCount = sizeof(notes) / sizeof(notes[0]);

void setup() {
  Serial.begin(115200);
  Serial.println(F("3W Speaker Melody Demo"));
}

void loop() {
  for (int i = 0; i < noteCount; i++) {
    tone(speakerPin, notes[i], 200);
    delay(250);
  }
  
  noTone(speakerPin);
  delay(1000);
}

Wiring diagram and example code generated by Codey.online — https://www.codey.online

ESP32 3W Speaker Tone Player with MAX98357A

This project plays musical tones through a 3W speaker using the ESP32 built-in I2S audio interface and a MAX98357A Class-D amplifier. The ESP32 synthesizes audio samples in software and streams them via I2S to the amplifier, which powers the speaker directly.

Esquema de ligação: Altifalante 3W 40mm num ESP32 DevKit V1
Esquema de ligação · Clique para ampliar
Tabela de ligação: Altifalante 3W 40mm num ESP32 DevKit V1
Tabela de ligação · Clique para ampliar
ESP32_3W_Speaker_Tone_Player_with_MAX983.ino · compilado e testado
/*
 * ==================================================================
 *  Generated by Codey.online  —  https://www.codey.online
 * ==================================================================
 *  Project   : ESP32 3W Speaker Tone Player with MAX98357A
 *  Board     : ESP32 DEVKIT V1 (esp32:esp32:esp32doit-devkit-v1)
 *  Parts     : Speaker 3W
 *  Libraries : none (built-in)
 *
 *  Codey Online is an AI-powered browser IDE for Arduino and ESP32.
 *  Describe your project and Codey writes the code, draws the wiring
 *  diagram and uploads it to your board, straight from the browser.
 *  This code is free to use, modify and share, without warranty.
 * ==================================================================
 */

#include <driver/i2s.h>
#include <math.h>

#define I2S_BCLK_PIN   26
#define I2S_LRC_PIN    25
#define I2S_DIN_PIN    22
#define SAMPLE_RATE    44100

// Musical notes (frequencies in Hz)
const float notes[] = { 261.63, 329.63, 392.00, 523.25 }; // C4, E4, G4, C5

void playTone(float freq, int durationMs) {
  int totalSamples = (SAMPLE_RATE * durationMs) / 1000;
  int16_t buffer[128];
  size_t bytesWritten;

  for (int i = 0; i < totalSamples; ) {
    int chunkSize = min(64, totalSamples - i);
    for (int j = 0; j < chunkSize; j++) {
      int16_t sample = (int16_t)(sin(2.0 * M_PI * freq * (i + j) / SAMPLE_RATE) * 8000);
      buffer[j * 2]     = sample; // Left channel
      buffer[j * 2 + 1] = sample; // Right channel
    }
    i2s_write(I2S_NUM_0, buffer, chunkSize * 4, &bytesWritten, portMAX_DELAY);
    i += chunkSize;
  }
}

void setup() {
  Serial.begin(115200);
  Serial.println("I2S Speaker Demo Initializing...");

  i2s_config_t i2s_config = {
    .mode = (i2s_mode_t)(I2S_MODE_MASTER | I2S_MODE_TX),
    .sample_rate = SAMPLE_RATE,
    .bits_per_sample = I2S_BITS_PER_SAMPLE_16BIT,
    .channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT,
    .communication_format = I2S_COMM_FORMAT_STAND_I2S,
    .intr_alloc_flags = ESP_INTR_FLAG_LEVEL1,
    .dma_buf_count = 8,
    .dma_buf_len = 64,
    .use_apll = false
  };

  i2s_pin_config_t pin_config = {
    .bck_io_num = I2S_BCLK_PIN,
    .ws_io_num = I2S_LRC_PIN,
    .data_out_num = I2S_DIN_PIN,
    .data_in_num = I2S_PIN_NO_CHANGE
  };

  i2s_driver_install(I2S_NUM_0, &i2s_config, 0, NULL);
  i2s_set_pin(I2S_NUM_0, &pin_config);

  Serial.println("Setup complete. Playing melody...");
}

void loop() {
  for (int i = 0; i < 4; i++) {
    Serial.print("Playing note frequency: ");
    Serial.println(notes[i]);
    playTone(notes[i], 300);
    delay(50);
  }
  delay(1000);
}

Wiring diagram and example code generated by Codey.online — https://www.codey.online

Altifalante 3W 40mm

Pequeno altifalante com um diâmetro de 40mm.

Potência: 3 Watt
Impedância: 4 Ohm

Altura: 19mm

Cor: Preto

  • 40 mm diameter
  • 19 mm hoog
  • 3 watt
  • 4 ohm

Por que escolher este produto?

  • Compact formaat – 40 mm diameter, slechts 19 mm hoog.
  • Klein vermogen – 3 watt voor eenvoudige audio-opstellingen.
  • 4 ohm impedantie – Geschikt voor systemen met 4 ohm.
  • Zwart uitgevoerd – Uitgevoerd in zwarte kleur.
Especificações
Corpreto
Potência3 W
Resistência4 Ohm
Diâmetro40 mm
Altura19 mm

Frequentemente comprados juntos

Total: € 14,74

Avaliações

★★★★★ 4,0/5 1 avaliação
  • ★★★★★Maarten de WitCompra verificada

    Melhor do que o esperado, vibra bastante em volumes mais altos

Escrever uma avaliação
A tua avaliação

Envio & devoluções

Envio

  • Pacote com Track & Trace€ 6,20Alemanha 1-3, França 2-3, Espanha/Itália 2-4, outros países 3-5 dias úteis
  • Pacote com Track & Trace€ 7,35Alemanha 1-3, França 2-3, Espanha/Itália 2-4, outros países 3-5 dias úteis
  • Pacote com Track & Trace€ 8,50Alemanha 1-3, França 2-3, Espanha/Itália 2-4, outros países 3-5 dias úteis
  • Pacote com Track & Trace€ 9,15Alemanha 1-3, França 2-3, Espanha/Itália 2-4, outros países 3-5 dias úteis
Tudo sobre envios

Devoluções

Não ficas satisfeito? Tens 30 dias após a receção para devolver o produto.

Tudo sobre devoluções

Vistos recentemente

Caixa UNO R3 Transparente Acrílico

Caixa UNO R3 Transparente Acrílico

€ 1,65
Cabo USB-A para Micro-USB 1 metro Branco

Cabo USB-A para Micro-USB 1 metro Branco

€ 2,00
Garra jacaré 45mm Preto

Garra jacaré 45mm Preto

€ 0,55