I would like to use one GPIO port to send IR signals in order to control some hifi components. Most IR codes are based on a 36kHz signal. I found an test of someone how measured the maximum speed of a GPIO port. The text is only in German but the result is, that the GPIO port has a maximum speed of about 11MHz. So it should be possible to encode the IR codes fully in software. But there is still the question how to drive the IR led.

I found an short article which describes a circuit for a 5V power supply. I am wondering if the 5V of the Rpi can be used. Does anybody know a circuit that can be used with the Rpi without damaging the device?

I need a range of about 5m. This is quite much. Is the Rpi able to power such an IR led?

  • 1
    Take a look at raspberrypi.stackexchange.com/questions/3980 for suggestions about driving an LED from the RasPi GPIO port...
    – BobT
    Jan 4, 2013 at 23:50
  • A simple LED is easy, because it does not need much power. A IR LED needs more power.
    – ceving
    Jan 5, 2013 at 11:24
  • 1
    If you look at the referenced links (in the comments) you'll see that there are some driver circuits described. These should be able to drive any reasonable current requirements.
    – BobT
    Jan 5, 2013 at 15:35
  • 1
    I've tried to do this and the problem I ran into is that while the Pi can do GPIO at that speed, it can't do it consistently. There's some signal wobble as the Pi won't operate in real-time. So you get really close to the signal you want to send, but not exactly it.
    – Fred
    Mar 16, 2014 at 8:06

1 Answer 1


Like the comments on you post suggest (in the links). The best way to do that is to switch a transistor which in it's turn drives the LED. That way the GPIO pins do not have to deal with the currents that might flow through the LED.

I found a nice document that explains this into great detail (but in the end it doesn't differ very much from the info already given to you). This document is written with a PIC in mind that controls the transistor, so you might need to change the value of the resistor connected to the base of the transistor.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.