Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
Take a look at raspberrypi.stackexchange.com/questions/3980 for suggestions about driving an LED from the RasPi GPIO port... – BobT Jan 4 '13 at 23:50
A simple LED is easy, because it does not need much power. A IR LED needs more power. – ceving Jan 5 '13 at 11:24
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 '13 at 15:35
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 '14 at 8:06
up vote 2 down vote accepted

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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