Source: https://mokxi.com/parts/irremote
Updated: 2026-11-10

Part

# Infrared remote, 21 buttons

NEC frames from twenty-one buttons: a 9 ms leader, 32 bits, and a repeat every 110 ms while you hold one.

See every part

- 1 pin
- 2 settings
- In 3 projects
- In 1 lesson

Drawn live by the editor's own code, at the size you see it.

At a glance

## The Infrared remote, 21 buttons in brief

What it is, and every setting the properties panel gives it.

The 21-button kit remote is the thin black handset sold with every VS1838B. It sends NEC: a 9 ms burst and a 4.5 ms gap, then 32 bits of address, inverted address, command and inverted command, least significant bit first, each a 562.5 microsecond burst and then a gap of the same for a zero or 1.6875 ms for a one. Its address is 0x00 and the commands are the tutorials’ set: CH- 0x45, 0 0x16, 1 0x0C, 2 0x18, 3 0x5E. The famous 0xFFA25D for CH- is the same frame read from the other end, each byte bit-reversed. The handset never wires to a board; the receiver’s OUT goes to any Uno digital pin or ESP32 GPIO. In Mokxi the single IR pin carries the beam with the 38 kHz carrier implied: wire it to the receiver’s IR pin, or point the handset at an unwired receiver within 7.5 m. Hold a button and a full frame goes out, then a repeat code every 110 ms. The classic mistake is treating each repeat as a new press. Other IR sources, a flat battery and every protocol but NEC are not modeled.

Family

Clocks and links

Pins

1

address

0

repeats

true

Pins

## The one pin

Named as the editor names them, so a wire lands where you expect it.

- IR

How to use it

## How to use the 21-button IR remote with an Arduino

The kit handset sends NEC with address 0x00, and each button is a one-byte command: CH- is 0x45, CH 0x46, CH+ 0x47, 0 is 0x16, 1 is 0x0C, 2 is 0x18 and 3 is 0x5E. Older tutorials print the same buttons as 0xFFA25D and the like, the whole 32-bit frame read from the other end, so every byte comes out bit-reversed. This lamp project prints both for every press, so the two tables can be seen to be one.

The handset does not wire to the board. Its IR pin is the beam, drawn here to the receiver’s IR pin, and the receiver’s OUT goes to pin 2. Press 1, 2 or 3 to pick a lamp and 0 for off. Hold a button and the handset sends one frame, then a short repeat code every 110 ms; the sketch acts on repeats only for CH- and CH+, which dim the lamp while held. Treating every repeat as a fresh press is why volume buttons run away.

Part pin

Board pin

IR

The receiver’s IR pin (the beam)

Receiver OUT

Pin 2

Receiver VCC

5 V

Receiver GND

GND

The handset is the same for every board; on an ESP32 the receiver runs from 3.3 V and the same command bytes come back.

Click to open it in the editor

This is the simulator itself, running here. Click anything to open it in the editor.

Open this project in the editor Read the full tutorial

How it is modeled

## What is true about the Infrared remote, 21 buttons, here

In its help article’s own words: what the simulation gets right, and where it stops.

### Not modeled

The carrier and the air, as above. The automatic gain control, so this receiver
never blanks. A real one turns its gain down under a long continuous burst and
stops seeing anything, which is why NEC's leader is 9 ms and not 90. The tuning,
so a burst at any rate at all is a burst here and two remotes on different
carriers would interfere. The few hundred microseconds of edge error a real
receiver has, which is what makes a decoder's tolerances necessary; here the
edges are exact. And no protocol but NEC: no RC-5, no Sony SIRC, no extended
NEC with a 16-bit address.

From Signals you time, not read, in full.

Projects

## See the Infrared remote, 21 buttons in a project

3 built-in projects use it. Each opens in the editor, already wired.

Lessons

## Where it turns up in a lesson

One lesson places it in its own circuit.

### Learn articles

1 lesson

- Arduino IR Remote: Decode NEC, Switch Lamps

Boards

## The boards it is shown on

This board has a built-in project with the Infrared remote, 21 buttons in it.

- Arduino Uno R3

Libraries

## Arduino libraries for the Infrared remote, 21 buttons

Built in, so the sketch compiles with nothing to install. Each page has the calls, the wiring and an example to run.

- IRremote
- IRremoteESP8266

More parts

## The rest of the bench

Every one of these is drawn and simulated the same way.

Full-size breadboard

A real 0.1 inch grid with the rails and the center channel, 63 columns wide.

Jumper wires

Drag from any pin or hole to any other. Corners snap, and you can drag them.

Power

A supply rail at the voltage you choose.

Ground

The other end of every circuit.

LED

Lights when current flows. Five colors, and the brightness is what your eye would see.

Filament lamp

A tungsten bulb in a holder: an inrush when it is switched on cold, tens of milliseconds to warm up, and dim on half its voltage.

Resistor

Any value you like, with the color bands drawn to match.

ESP32-C3-DevKitM-1

A RISC-V board that runs your firmware at 160 MHz on the real memory map.

Pushbutton

A 12 mm tactile switch. Hold it while the simulation runs.

Raspberry Pi Pico

The RP2040 board on our own Cortex-M0+ core. Pick a program and press Run.

Raspberry Pi Pico W

Raspberry Pi Pico W (RP2040). The same board and the same pinout as a Pico, with the CYW43439 on it. The WiFi is simulated (no radio; real internet through the Cloud panel’s switch), and the on-board LED, which hangs off that chip rather than off GP25, is driven through the same path. Everything else is the Pico.

Raspberry Pi 4 Model B

Raspberry Pi 4 Model B: the 40-pin header, driven by main.py with RPi.GPIO or gpiozero.

See every part

## Wire up the Infrared remote, 21 buttons

Open the editor and push it into the breadboard. It is free, and it runs on your own machine.

Start building free Open the editor
