I2S amplifier/Three wires and a switch/04. CTRL: on, off, left or right
Three wires and a switch · 04 of 9

CTRL: on, off, left or right

CTRL is the TK100's on switch and its channel switch at once. The chip reads the voltage on its CTRL pin: near 0 V it is off, around 1 V it plays the left channel, from 1.5 V up the right. A 22 kΩ resistor and the L/R jumper decide which of those a HIGH from the ESP32-S3 becomes.

Three bands on one pin

The NS4168 reads the voltage on its CTRL pin and sorts it into one of three bands, by its datasheet:

Chip's CTRL pinThe chip
0 to 0.4 Voff, about 1 µA
0.9 to 1.15 Von, plays the left channel
1.5 V up to its supplyon, plays the right channel

The gaps between the bands are not defined. A voltage has to land inside one.

What sits between the pin and the chip

The header's CTRL pin does not reach the chip directly. It goes through a 22 kΩ resistor. On the chip's side of that resistor, the L/R jumper leads to 10 kΩ and ground.

What the chip sees on CTRL
Right channel
CTRL is
L/R jumper
Header CTRL
3.3 V
Chip's CTRL pin
3.30 V
The chip
Right channel
Right channel, the way it ships. Nothing pulls the chip's pin down, so it sees the whole 3.3 V, above 1.5 V. The chip is on and plays the right half of every frame.

With the jumper open, as it ships, the 10 kΩ is not connected, so nothing pulls the chip's pin down and it sees the whole 3.3 V: right channel.

With the jumper bridged, the two resistors form a divider: 3.3 × 10 / (22 + 10) = 1.03 V, worked out, which lands in the left band. The same HIGH from the same GPIO now picks the other channel.

Drive it, always

Driven LOW, the chip is off whatever the jumper says. Left unconnected, it has nothing defining it: with the jumper open the chip's pin floats, and with it bridged the 10 kΩ holds it at 0 V. Neither plays.

So CTRL goes to a GPIO, GPIO 18 in this book, and the sketch drives it HIGH before it plays:

pinMode(PIN_AMP_ON, OUTPUT);
digitalWrite(PIN_AMP_ON, HIGH);       // wake the amplifier

Driving it LOW again is the clean way to silence the speaker between sounds.

When it does not work

I left CTRL unconnected and it is silent.

As expected. With nothing on CTRL and the jumper open, the chip's pin hangs on 22 kΩ with nothing on the other end, a state the datasheet does not define; with the jumper bridged, 10 kΩ holds it at 0 V, which is off. Wire CTRL to GPIO 18 and drive it HIGH.

Can I tie CTRL to 3V3 instead of a GPIO?

Yes, a wire from CTRL to 3V3 keeps the amplifier on whenever the board has power. You lose the way to switch it off in software, which the record sketch uses to keep the speaker silent between plays.

I bridged the jumper and now it plays nothing.

Bridged, the chip plays the left channel. If your sketch fills only the right sample, that is silence. Write the same sample into both, or remove the solder bridge with a soldering iron and some wick.

Why is the channel chosen by a voltage and not a pin?

The NS4168 has eight pins and spends only one on control. It reads three bands on that pin, off, left and right, so a single wire and two resistors do the work of two switches.

Where this goes next

Why neither speaker wire is ground, and what never to connect to them.

Both wires move

Edit this page — content/books/i2s-amplifier/ctrl-on-off-left-right.mdx

Community

Questions about this product

See what other owners have asked, and read their solutions.

Ask a question ↗

I2S Amplifier

Loading discussions…

Discuss this article

Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.

Browse Modules and blocks on the forum