2

I'm trying to get my raspeberry pi to control a floor fan via IR. I'm stuck on getting the IR codes to be emitted through the IR LED. I'm not able to get the IR LED to turn on at all. I'm checking that it's burning by using an app on my phone. (I've verified the app is working by testing it with the fan's remote, I can see the remote's ir bulb going off when pressing the button)

I've setup my breadboard to turn on a normal LED which works but when I swap the LED with an IR LED I don't get anything. Below is the setup for the normal LED. I've tried 100 - 1kohm resistors, but no luck. I've swapped out the IR LED for others, I've checked and double checked the direction of the IR LED (and tried it both ways to be sure). I've gone through many tutorials with no luck.

It seems like this should be really easy which makes me think I'm missing something pretty simple. This is my first project with a raspberry pi and working with circuits. Any help would be very much appreciated.

enter image description here

Kywillis
  • 131
  • 3
  • 1
    Is any chance you know the model of your IR diode? May we see the picture? Be aware of the fact that the GPIO limit on RPi3 is 16mA (0.016A) and may be insufficient for some IR diodes. Have you tried to check it with any continuity tester? – smajli Apr 23 '20 at 20:28
  • Hi @Kywillis, welcome and nice to meet you. Ah, let me see. (1) Our stupid human eyes cannot see IR light. Perhaps you can use a digital camera to try your luck, (2) Nowadays, almost everybody is using TSAL6200. You might to read my answer to know more details: "TSAL6200 940nM High Power IR Emitter Diode (If = 1A max at 3V) (See Section 5) ": https://raspberrypi.stackexchange.com/questions/103452/rpi3-lirc-library-and-uart-ir-transceiver-setup-problem. – tlfong01 Apr 24 '20 at 01:38
  • (3) As you can see from the IR emitter diode, the max forward current is roughly 1A, so need to use perhaps a NPN BJT such as 2N2222 to help, or you might fry your Rpi, (4) Almost always, you must use a series current limiting resistor, say 220Ω to play safe. (5) The popular NEC IR protocol is a bit complicated. You need to use the LIRC driver to make your job easier. LIRC documentation is not not for newbies. (6) For newbies, I would recommend to start off experimenting with a pair of cheapy IR transceivers. Again see my answer above. – tlfong01 Apr 24 '20 at 01:44
  • (7) You said (a) it is your first Rpi project, (b) it should be easy, (c) you have gone through many tutorials but no luck. My comment is that blinking a stupid LED is indeed easy, but but "blinking" an IR LED is 10 times harder, and the LIRC learning curve is very steep. (8) If you are like me, locking down in a ghost city: https://www.youtube.com/watch?time_continue=1&v=LNNPNweSbp8&feature=emb_logo,(9) then take your time and go slowly. (10) Have a great locking down project. Cheers. – tlfong01 Apr 24 '20 at 01:49
  • 1
    I 'm definitely going slowly, no worries there. I've gone through the steps of installing and trying to record my remote using LIRC. I got the recording to work with a simple remote (I had dots showing up as I held down a button). With the remote to the fan there was only a single dot. I gave up on LIRC and moved onto pigpio. I was able to record my remote with that. – Kywillis Apr 24 '20 at 13:35
  • 1
    this is a link to the IR LEDs I'm trying to use: https://www.amazon.com/gp/product/B00M1PN5TK/ref=ppx_yo_dt_b_asin_title_o08_s00?ie=UTF8&psc=1 – Kywillis Apr 24 '20 at 13:39

2 Answers2

2

Check the specs for your IR LED.

Mine needs far more than the 20 mA or so available from a Pi GPIO to illuminate.

joan
  • 71,024
  • 5
  • 73
  • 106
  • this is a link to the IR LEDs I'm trying to use: https://www.amazon.com/gp/product/B00M1PN5TK/ref=ppx_yo_dt_b_asin_title_o08_s00?ie=UTF8&psc=1. How would I provide more than 20 mA to the LED? If you have a link to a picture of a board layout that would be great. – Kywillis Apr 24 '20 at 13:40
  • I can not see any useful information on that page. I'd assume they need 100 mA. Look at https://arduinodiy.wordpress.com/2015/12/12/driving-an-ir-led-constant-current-source-or-not/ – joan Apr 24 '20 at 15:20
2

You could help yourself a huge amount in the future by NOT buying electronic components from Amazon (or anyone else) that does not supply a spec sheet for the parts they sell. There are many vendors that specialize in electronic components, and sell them at reasonable prices. As an added incentive, you'll also find that the more reputable vendors also deal in reputable parts from reputable manufacturers - instead of no-names that sell electronics and shoelaces out of the same dump. I hope I've made my point clear :)

All of that said, the laws of physics suggest that there won't be huge differences between 5mm 940nm (IR) LEDs, regardless of who makes them. And if you consulted a reputable vendor of electronic components, you could find a list similar to this one, and a spec sheet like this one. The spec sheet for this 5mm 940nm IR LED indicates that you will need to source or sink about 100mA of current to drive this part properly.

As @joan has stated, you won't get 100 mA from a GPIO pin on the Raspberry Pi. Instead, you will need to use the GPIO output to drive a switch capable of handling the voltage and current this LED requires. This is a frequently-asked-question here, and here's one answer that's fairly close.

Please review this answer. If you have further questions, I would suggest that you edit your question to add a proper schematic instead of photos of wires and parts; the photos simply don't communicate enough information to allow us to help you much.

Seamus
  • 21,900
  • 3
  • 33
  • 70