Skip to content
Home > Components > Actuators > 5W Audio Speaker

5W Audio Speaker

A basic 5W electromagnetic speaker used to convert electrical audio signals into sound waves.

Component Preview

5W Speaker5W Speaker

This component simulates a standard 5-watt electromagnetic speaker. It is typically driven by an audio amplifier (like the MAX98357 I2S DAC) rather than directly from a microcontroller pin to produce rich audio or tones.

ActuatorsAudioAnalog Output

Overview

Speakers are the primary method of generating audio feedback, music, or speech in electronics projects. Because microcontrollers cannot output enough current to drive a 5W speaker directly, you must use an amplifier circuit in between.

Pin Reference

PinTypeDescription
IN+analogPositive audio input terminal. Connect to amplifier output (+).
IN-analogNegative audio input terminal. Connect to amplifier output (-).

Configurable Attributes

This basic speaker currently has no configurable attributes in the simulator.

Working Principle

A speaker consists of a permanent magnet and an electromagnet (voice coil) attached to a flexible cone. When alternating current (your audio signal) passes through the voice coil, it creates a fluctuating magnetic field. This field pushes and pulls against the permanent magnet, vibrating the cone and creating sound waves.

Wiring Diagram

  1. Connect the IN+ pin of the speaker to the positive output terminal of your audio amplifier (e.g., MAX98357).
  2. Connect the IN- pin of the speaker to the negative output terminal of your audio amplifier.
  3. Do not connect the speaker directly to a microcontroller digital pin; it may draw too much current and damage the pin.

Wiring Diagram

Example Arduino Code

In the simulator, the speaker is typically driven by the MAX98357 I2S DAC, which receives I2S digital audio from an ESP32.

cpp
#include "Audio.h" // Requires ESP8266Audio library

Audio audio;

void setup() {
  Serial.begin(115200);
  
  // Set up I2S audio output
  audio.setPinout(26, 25, 22); // BCLK, LRC, DOUT for MAX98357
  audio.setVolume(15);
  
  // Connect to a streaming internet radio station
  audio.connecttohost("http://stream.radioreklama.bg/radio1.mp3");
}

void loop() {
  // Process the audio stream constantly
  audio.loop();
}

Simulation Notes

  • To hear audio output from the speaker in the simulator, ensure your browser has permission to play audio.
  • The speaker in the simulator will visually vibrate when audio is actively being played.

Notes / Warnings

  • Real-World Warning: Driving a 5W speaker directly from a 3.3V or 5V logic pin will quickly burn out the microcontroller pin due to overcurrent. Always use an appropriate amplifier.

Released under the MIT License.