

A loudspeaker is an electroacoustic transducer that converts electrical audio signals into corresponding sound waves. The primary components of a loudspeaker include a diaphragm (often referred to as a cone), a voice coil, a permanent magnet, and an enclosure or cabinet. Loudspeakers are ubiquitous in modern technology and are found in devices ranging from simple alarm clocks to complex sound reinforcement systems.








| Pin Number | Description | Notes |
|---|---|---|
| 1 | Positive Terminal | Connects to amplifier output (+) |
| 2 | Negative Terminal | Connects to amplifier output (−) |
// Example code to drive a loudspeaker using an Arduino UNO and a simple amplifier circuit
int speakerPin = 9; // PWM pin connected to the amplifier input
void setup() {
pinMode(speakerPin, OUTPUT);
}
void loop() {
// Generate a 1kHz tone for 1 second
tone(speakerPin, 1000, 1000);
delay(1500); // Wait for 1.5 seconds
}
Note: The above code assumes the use of a simple amplifier circuit connected to the Arduino. The loudspeaker must be connected to the amplifier's output, not directly to the Arduino pin. The tone() function generates a square wave, which may not be ideal for high-quality audio applications. For more complex sound, consider using a dedicated sound library or shield.