Speaker, 8 ohm
Eight ohms, so 100 ohms in series or a transistor, and tone() plays through it.
- 2 pins
- 1 setting
- In 6 projects
- In 2 lessons
The Speaker, 8 ohm in brief
What it is, and every setting the properties panel gives it.
The 8 ohm speaker in most Arduino kits is a 40 mm paper cone on a voice coil, with two tags and no polarity. Its low resistance is the whole lesson: an Uno pin wired straight across 8 ohms is close to a short, so the pin sags to about a volt while trying to source far past its 40 mA absolute maximum. The Arduino’s own toneMelody example puts 100 ohms in series for that reason, which here gives about 46 mA with the pin holding its voltage; for more volume, drive it through a transistor. Mokxi treats the coil as a real resistance, set by the ohms property, and times each push of the cone from the current through it, rising past 4 mA after falling under 2 mA, to report the note in hertz, however the pin or an H bridge drives it. tone() runs from a timer interrupt as on a real board, and on an Uno it takes timer 2, so PWM on pins 3 and 11 pauses while a note plays. Loudness, coil inductance and the power rating are not modeled.
- Family
- Outputs
- Pins
- 2
- ohms
- 8
- the voice coil's resistance, 8.
2 pins
Named as the editor names them, so a wire lands where you expect it.
How to use an 8 ohm speaker with an Arduino
Put 100 ohms in series: pin 8 to the resistor, the resistor to one speaker tag, the other tag to GND. That holds the current to about 46 mA with the pin’s voltage held up, where the bare speaker would drag the pin down to a volt. For a louder note, or to keep well inside a pin’s limits, switch the speaker with a transistor from 5 V.
tone(8, 440) starts a square wave from a timer and returns at once, and noTone(8) stops it. The music box here makes each note itself instead, toggling the pin with digitalWrite() and delayMicroseconds() for as long as the note lasts, so you can read exactly what a square wave is. Either way, the speaker shows the note it hears in hertz.
On an Uno, tone() takes timer 2, so PWM on pins 3 and 11 pauses while a note plays. On the XIAO and the Uno R4, put the speaker on a PWM pin.
#include "pitches.h"
void setup() {}
void loop() {
tone(8, NOTE_A4, 200); // an A for 200 ms on pin 8
delay(400);
}What is true about the Speaker, 8 ohm, here
In its help article’s own words: what the simulation gets right, and where it stops.
Modeled
The coil is a real 8 ohm load. With 100 ohms in series from a 5 V pin it takes about 46 mA and the pin holds its voltage; straight on the pin, the pin sags to a volt or so and would be sourcing far past its 40 mA absolute maximum, which a multimeter in series shows.
The note. The part times each push of the cone, the current through the coil rising past 4 mA one way after being under 2 mA, and reports the frequency in hertz. It counts a pin toggling against ground, against 5 V, or an H bridge driving both ends alike.
Not modeled
Loudness: the probe is a frequency and says nothing about level, which on a real speaker rises with the current and falls off at the bottom and top of its range. The coil's inductance, its power rating (usually half a watt) and burning out.
From Speaker (8 ohm), in full.
See the Speaker, 8 ohm in a project
6 built-in projects use it. Each opens in the editor, already wired.
Where it turns up in a lesson
2 lessons place it in their own circuits.
The boards it is shown on
Each of these 2 boards has a built-in project with the Speaker, 8 ohm in it.
The rest of the bench
Every one of these is drawn and simulated the same way.
Wire up the Speaker, 8 ohm
Open the editor and push it into the breadboard. It is free, and it runs on your own machine.