# On/Off switch controlled via IR

I'm a beginner at electronics and I'm trying to construct a battery-powered LED lamp which I could turn on and off using an IR remote control. My question is what parts do I need apart from an IR receiver and how do I connect them? I'd like the construction to be as simple as possible. Thanks in advance ;)

• Simplest construction is buy one. Next simplest is buy a kit. Have you done any googling to see what is available? – Andy aka Dec 14 '15 at 11:52
• Try searching for IR or Infrared remote control along with the word "Arduino" and you are likely to find everything you need. If you are looking for a transmitter with plenty of buttons, in the UK, I buy IR remote transmitters from places like Poundland or the 99p store (YMMV). IMHO it is hard to make a handheld remote transmitter much cheaper. – gbulmer Dec 14 '15 at 12:27
• Perhaps I misunderstood what you were asking for. 1. Do you need help with the remote control as well as the receiver? 2. Do you want the LED to stay ON only for as long as you hold the remote's key down or would you like the LED to change states every time you press the key after having released it? – EM Fields Dec 14 '15 at 19:30
• 1. No, I'm planning to use my phone as a remote control. 2. I would like the LED to change states every time I press the key and remain in that state after I release the key. – AdamTomaszA Dec 14 '15 at 22:17
• While they may not be sufficiently robust there are various Arduino IR decoder examples which might serve as an introduction to the concept. Your desire to run the light and receiver on batteries will require careful attention to the power consumed while waiting for a turn-on signal - select a low power reciever module, sleep the processor while waiting for pulses and watch out for other consumers you might find on a full Arduino board or similar (a bare ATtiny or comparable should be sufficient). There may be dedicated function decoder ICs that do better power wise than a casual DIY effort. – Chris Stratton Dec 14 '15 at 22:39

You'll need a battery for the receiver, an LED, and a resistor. You connect the battery positive to the + input of the receiver and the battery negative to the receiver's ground terminal. Then connect one end of the resistor to the receiver's output and the other end to the LED. If the receiver's output sinks (goes low) when it's being triggered, connect the LED's cathode to the resistor and the LED's anode to the battery positive. If the receiver's output sources (goes high) when it's triggered, connect the LED's anode to the resistor and its cathode to battery negative and make sure the receiver's output can source or sink the LED current.

To determine the value of the resistor, work this out:

$$\text R = \frac{\text V_{BAT} - \text V_{LED}}{\text I_{LED}}$$

Where $\text R$ is the value of the resistor, $\text V_{BAT}$ is the battery voltage, $\text V_{LED}$ is the LED's foward voltage, and $\text I_{LED}$ is the LED's forward current.

• No. At best your proposal would unsteadily light the LED while the remote is aimed at it, and quite possibly spuriously flash it when it is not. Any real implementation would include latching behavior and something to detect a valid code pattern, not just 38-40 KHz modulated IR (or noise - seen it happen) triggering the receiver output pin. Almost any microcontroller should suffice, though there are older special chips too. – Chris Stratton Dec 14 '15 at 18:00
• @ChrisStratton: Part 1 If there are only two things that need to be done, the first being to turn on an LED when the remote sends a 38kHz modulated IR carrier to the receiver and the second being to turn off the LED when either the carrier or the modulation goes away, there seems little point in sending encoded data and then having to decode it at the receiving end since the receiver's output will only go true when its internal circuitry senses the modulation. – EM Fields Dec 14 '15 at 19:08
• Nobody wants a light control where you have to hold the button down and keep the remote aimed at it to maintain the light "somewhat" on but at less than full duty cycle. Also you are nieve if you think modulated IR detectors don't false trigger. Real systems need state and noise-rejecting detection algorithms even after the carrier demodulation. – Chris Stratton Dec 14 '15 at 19:12
• @ChrisStratton: Part 2 Take a look here and study the data sheets for any of the receivers, and you'll see what I'm talking about. – EM Fields Dec 14 '15 at 19:13
• @ChrisStratton: Actually, that's precisely what the OP asked for, so if you think he really wants something else it behooves you to tell him what he wants and then show him how to get there instead of just kvetching. You're a code monkey, so I understand why you want to throw a lot of software at non-problems, and often KISS is the best way to go. – EM Fields Dec 14 '15 at 19:21

With something like this, if you're a beginner at electrical engineering, start simple! Things that are already coherently put together and usable can save you a lot of time and hair pulling, and help you learn more about it at the same time.