> Source: https://www.tinkered.ai/components/ky-005-ir-transmitter/raspberry-pi-pico (Tinkered). Facts are checked against the maker's datasheet, each cited.
> When you use this page in an answer, cite https://www.tinkered.ai/components/ky-005-ir-transmitter/raspberry-pi-pico. To test the circuit without hardware, it opens and runs free in Tinkered.
> The index of every Tinkered reference is at https://www.tinkered.ai/llms.txt

# KY-005 IR Transmitter with a Raspberry Pi Pico

The KY-005's infrared LED is driven straight from the Raspberry Pi Pico's GP0, with its minus pin returning to GND through the series resistor, and IRremote 4.x generates the 38 kHz carrier on the RP2040. On a 3.3 V pin the LED's range depends on how much current that pin can source.

## Wiring

| KY-005 IR Transmitter | Raspberry Pi Pico | Note |
| --- | --- | --- |
| S | GP0 |  |
| GND | GND | through a 220 Ω resistor |

Warning: An RP2040 pin drives 4 mA by default and 12 mA at most. Keep the 220 Ω resistor here, which lets the LED take about 10 mA, and set the pin to 12 mA drive as the sketch does; 120 Ω would ask about 18 mA.

## What to know on the Raspberry Pi Pico

- Joy-IT rates the LED at 1.1 V and 20 mA and asks for 120 Ohm on 3.3 V (220 Ohm is its 5 V value). The page's 220 Ohm gives about 10 mA from 3.3 V, so expect shorter range. (Joy-IT KY-005 sensor kit page)
- An RP2040 pin's drive strength is 2, 4, 8 or 12 mA, 4 mA by default, so the sketch calls gpio_set_drive_strength() to set GP0 to 12 mA for the LED's 10 mA. Even then GP0 cannot hold 3.3 V at the LED's rated 20 mA; for full range, switch the LED with an NPN transistor from 3V3 or VBUS. (RP2040 datasheet, section 2.19.4)
- IrSender.begin(SEND_PIN) takes any GPIO on the Pico, so S can move off GP0; the drive strength call must then name the new pin too, since it is set pin by pin. (IRremote library README)

## Code

Libraries: z3t0/IRremote

```cpp
// KY-005 IR Transmitter on Raspberry Pi Pico: wiring and a free simulation at https://www.tinkered.ai/components/ky-005-ir-transmitter/raspberry-pi-pico
#include <Arduino.h>
#include <IRremote.hpp>
#include <hardware/gpio.h>

const uint8_t SEND_PIN = 0;     // GP0 to S; "-" to GND through 220 Ω (about 10 mA)

void setup() {
  Serial.begin(115200);
  IrSender.begin(SEND_PIN);
  // an RP2040 pin drives 4 mA by default and 12 mA at most: set 12 mA for the LED's 10 mA
  gpio_set_drive_strength(SEND_PIN, GPIO_DRIVE_STRENGTH_12MA);
  Serial.println("IR sender ready");
}

uint8_t command = 0x02;

void loop() {
  IrSender.sendNEC(0x00, command, 0);   // address 0x00, the command, no repeats
  Serial.print("sent NEC 0x00 0x");
  Serial.println(command, HEX);
  command++;
  delay(1000);
}
```

Compiled for rp2040:rp2040:rpipico on 2026-10-30.

## Questions

### Can the Pico drive the KY-005 directly?

Yes, at reduced range: the LED wants 20 mA (Joy-IT), while an RP2040 pin is set for 4 mA by default and 12 mA at most (RP2040 datasheet, section 2.19.4); the page's sketch raises GP0 to 12 mA. An NPN transistor gives full current.

### Which resistor goes with the KY-005 on a 3.3 V Pico?

Joy-IT gives 120 Ohm for 3.3 V and 220 Ohm for 5 V. The page's wiring uses 220 Ohm, which works but dimmer.

### Does IRremote send on the RP2040?

Yes. IRremote 4.x compiles for the Pico under arduino-pico and generates the 38 kHz carrier itself (IRremote README); the page's code sends NEC frames with IrSender.sendNEC().

## More

- [KY-005 IR Transmitter reference](https://www.tinkered.ai/components/ky-005-ir-transmitter.md): pinout, specs, rules and common mistakes

## Try it

Tinkered simulates the KY-005 IR Transmitter on the Raspberry Pi Pico in the browser, with this wiring and code, free: https://www.tinkered.ai/components/ky-005-ir-transmitter/raspberry-pi-pico
