Small passive speaker, 3W 4-8 ohm. Requires an amplified signal — cannot be driven directly from a DAC line-out or microcontroller GPIO.
| Pin | Signal | Description |
|---|---|---|
SPK + |
audio | Speaker in positive |
SPK - |
audio | Speaker in GND |
A passive speaker MUST be driven by an audio amplifier (e.g. PAM8403, MAX98357A, LM386). NEVER connect directly to a DAC line-out or microcontroller pin — the signal is too weak and may damage the source. Connect amplifier output (+/-) to speaker (+/-).
| From | To | Wire |
|---|---|---|
board:D9 |
spk1:SPK + |
green |
board:GND |
spk1:SPK - |
black |
This example was written and compile-checked for the arduino-uno. Codey Online adapts it to any other supported board for you.
// NOTE: A passive 3W speaker must be driven by an audio amplifier.
// This minimal sketch is included for documentation purposes, but do NOT connect
// a passive speaker directly to an Arduino pin in real hardware.
const int speakerPin = 9;
void setup() {
pinMode(speakerPin, OUTPUT);
}
void loop() {
tone(speakerPin, 440);
delay(500);
noTone(speakerPin);
delay(500);
}
Describe what you want to build. Codey Online writes the code, draws the wiring diagram, compiles it and flashes your board straight from the browser.
Start for free