IR Receiver Brick



Pictured with the KY-022 kit module plugged in.
Kit Bricks · SKU TP-K05
Control your robot with any TV remote.
₹299
Works with TinkerPie V1 · Arduino C++ with the TinkerPieBricks library · Delivery across India: ₹100, 3–7 days · 7-day replacement for damaged or defective kits
About this kit
Control your robot with any TV remote. The IR Receiver Brick is a carrier for the KY-022 module from common 37-in-1 sensor kits: plug the module into the socket and connect one cable to a TinkerPie SENSOR port. A small CH32V003 processor on the brick does the timing work, so your program simply reads the result over I2C.
Features
- 38 kHz receiver, NEC codes decoded in the brick
- Address + command + repeat flag
- Works with the kit IR remote
- Plug the kit module straight into the socket – no jumper wires
- One cable to any TinkerPie SENSOR port (I2C), BUS IN + BUS OUT to chain more bricks
- On-board CH32V003 does the timing – your code just reads the result
Specifications
| Kit module | KY-022 IR Receiver (module 5 of the 37-in-1 sensor kit) |
|---|---|
| Socket | KIT SENSOR: 2.54 mm female, S + - |
| Size | 48 x 32 mm, M3 holes on the 8 mm grid |
| Connectors | 2 x JST-PH 4-pin TP-BUS (IN / OUT) |
| Interface | I2C 0x08-0x0F (8 on one bus) |
| Power | 3.3 V from the SENSOR port |
| Brain | WCH CH32V003 |
| Arduino class | tpb::KitSensor |
How to use it with TinkerPie
- Plug the KY-022 module into the 2.54 mm socket on the top edge. Match the pin names: the brick says S + -, the module has the same letters.
- Connect BUS IN to any TinkerPie SENSOR 1-4 port with a 4-pin JST-PH cable (the same cable as the other sensors).
- More bricks? Plug the next one into BUS OUT. Two bricks of the same type need different addresses: bridge ADDR +1, +2 or +4 on the back (0x08-0x0F; the first is 0x08).
- Install the TinkerPie and TinkerPieBricks Arduino libraries, open the quick-start sketch below, choose the board ESP32S3 Dev Module and upload.
Libraries: TinkerPie and TinkerPieBricks (Arduino IDE: Sketch → Include Library → Add .ZIP Library). Full guide: getting started with TinkerPie Bricks.
Quick start
Upload this, open the Serial Monitor at 115200 baud and watch the TinkerPie matrix.
Quick-start sketch (Arduino C++)
// IR Receiver Brick (TP-K05): quick start
// Reads the brick and shows the value on the TinkerPie matrix and in the Serial Monitor (115200 baud).
#include <TinkerPie.h>
#include <TinkerPieBricks.h>
using namespace tinkerpie;
tpb::KitSensor ir;
void setup() {
Serial.begin(115200);
tinkerpie::begin(); // also starts the SENSOR ports (I2C bus Wire1)
if (!ir.begin(tpb::KitSensor::IR_RECEIVER)) Serial.println("IR Receiver Brick not found at 0x08: check the cable to SENSOR 1-4");
}
void loop() {
if (ir.irAvailable()) { // a remote button was pressed
Serial.printf("address 0x%02X command 0x%02X\n", ir.irAddress(), ir.irCommand());
basic::showNumber(ir.irCommand(), Colors::Purple);
}
basic::pause(50);
}
Project: TV-remote robot
Drive a two-wheel robot with any NEC TV remote. Press each arrow once to learn its code (shown in the Serial Monitor), then put the codes into the sketch.
TV-remote robot (Arduino C++)
// TV-remote robot: IR Receiver Brick (TP-K05)
// Drive a two-wheel robot with any NEC TV remote. Press each arrow once to learn its code (shown in the Serial Monitor), then put the codes into the sketch.
#include <TinkerPie.h>
#include <TinkerPieBricks.h>
using namespace tinkerpie;
tpb::KitSensor ir;
const uint8_t UP = 0x18, DOWN = 0x52, LEFT = 0x08, RIGHT = 0x5A; // codes of the small kit remote
void setup() {
Serial.begin(115200);
tinkerpie::begin(); // also starts the SENSOR ports (I2C bus Wire1)
if (!ir.begin(tpb::KitSensor::IR_RECEIVER)) Serial.println("IR Receiver Brick not found at 0x08: check the cable to SENSOR 1-4");
}
void loop() {
if (ir.irAvailable()) {
uint8_t c = ir.irCommand();
Serial.printf("command 0x%02X\n", c);
if (c == UP) motors::tank(50, 50);
else if (c == DOWN) motors::tank(-50, -50);
else if (c == LEFT) motors::tank(-40, 40);
else if (c == RIGHT) motors::tank(40, -40);
else motors::stop();
}
basic::pause(20);
}
More TinkerPie Bricks
DS18B20 Temperature BrickTP-K01 · Environment · KY-001Waterproof-grade digital thermometer chip, read in C over I2C.₹299Pre-order
Shock Switch BrickTP-K02 · Motion · KY-002Detects knocks and vibration with a spring switch.₹299Pre-order
Hall Magnetic Sensor BrickTP-K03 · Magnetic · KY-003Senses a magnet near the A3144 hall switch.₹299Pre-order
Button Switch BrickTP-K04 · Input · KY-004A tactile push button on the bus.₹299Pre-order