- What is IR?
- Use cases (e.g. controlling TVs, decoding remote signals)
-
M5StickC Plus 2
-
IR LED + IR receiver (e.g., TSOP38238)
-
Jumper wires
-
Breadboard (optional)
| IR Receiver Pin | Connect To (M5StickC) |
|---|---|
| VCC | 3.3V |
| GND | GND |
| OUT | GPIO 36 |
| IR LED Pin | Connect To (M5StickC) |
|---|---|
| + (Anode) | GPIO 9 (or GPIO 26) |
| - (Cathode) | GND |
- Open Arduino IDE.
- Select your board (M5StickC Plus or Plus2).
- Install the
IRremotelibrary by shirriff via Library Manager. - Upload the
IR_SendReceive.inosketch from theexamples/IR_SendReceivefolder. - Open Serial Monitor at 115200 baud.
- Press a button on your IR remote — received codes should display.
- Try sending codes with an IR LED to control a device (e.g., a TV).
This sketch lets your M5StickC/Plus/Plus2 receive and send infrared (IR) signals using an IR receiver and an IR LED.
- IR Receiver (e.g. VS1838B):
- GND → G
- VCC → 3.3V
- OUT → GPIO 9
- IR LED (with 100Ω resistor):
- Anode → GPIO 10
- Cathode → GND
- Arduino IDE with IRremote library (v4+)
- M5StickC board support
- M5StickC Plus2 library (or Plus/C version if needed)
- Press Button A to send a test IR code (
0x20DF10EF, NEC format). - Any incoming IR signals will be displayed on the screen and printed to Serial.
- This example uses the IRremote library.
- Works with many IR receivers (e.g., VS1838B) and 940nm IR LEDs.
- IR LED pins may vary per board; ensure GPIO supports PWM for sending.
- If using M5StickC Plus2, note that some GPIOs are reserved (check M5 docs).
