Why do real IR remotes work so well compared to my experimental device? - Page 1
Forum section: electronics / beginners

author: dentaku
author_rank: Frequent Contributor
timestamp: February 21, 2015, 05:44:12 pm
content: Lately I've been learning about IR remotes. I have a few dark bleu-ish IR emitters and receivers in my bins of stuff so I captured all the codes from a Sony remote control and made a little single pushbutton device with my Arduino UNO that can turn the volume up on a Sony TV using the IRemote Arduino library.I see that real remotes work MUCH better than my makeshift device. I even unsoldered the clearnot blue-ishemitter from a real remote (the TV it goes with is dead so I didn't care about it) and it works a bit better but you still have to point it at the TV perfectly and it doesn't work more than about 3 meters away.Question...What makes official remote controls work so much better? I can point an official Bell expressVu remote away from the TV and it still works.here's the code if anyone's interested. I have a 100ohm resistor on the IR LED. Sony's send all commands three by the way.Code://** IRremote: IRsendDemo - demonstrates sending IR codes with IRsend* An IR LED must be connected to Arduino PWM pin 3.* Version 0.1 July, 2009* Copyright 2009 Ken Shirriff* http://arcfn.comSony codes I captured from the TV's remote290 - muteA90 - power10 - #1810 - #2410 - #3C10 - #4210 - #5A10 - #6610- #7E10 - #8110 - #9910 - #02F0 - upAF0 - down2D0 - leftCD0 - right490 - vol+C90 - vol-90 - ch+890 - ch-*/#include <IRremote.h>const int buttonPin = 2; // the number of the pushbutton pinint buttonState = 0; // variable for reading the pushbutton statusIRsend irsend;void setup(){Serial.begin(9600);pinMode(buttonPin, INPUT); // initialize the pushbutton pin as an input}void loop() {buttonState = digitalRead(buttonPin);if (buttonState != LOW) {irsend.sendSony(0x490, 12); // Sony TV vol+ codedelay(40);irsend.sendSony(0x490, 12);delay(40);irsend.sendSony(0x490, 12);delay(40);}}

author: Mechanical Menace
author_rank: Super Contributor
timestamp: February 21, 2015, 05:50:57 pm
content: 2 guesses here. You're not supplying as much power to the LED as an official remote does or the LED you're using has a narrower beam.

author: Alex Eisenhut
author_rank: Super Contributor
timestamp: February 21, 2015, 05:57:04 pm
content: I don't know. What is the IR emitter datasheet? Is it known good?Is the Arduino IR library known to work with Sony? Sony *always* has to be different somehow, remember.And your 100 ohm resistor to what? In series with the LED? Directly from a 3.3V IO pin? That's a lot of current for a single IO pin to supply, IR LEDs have a low Vf and typically need more current than visible LEDs.Point your remote to a video camera/cell phone, you should see how "bright" your remote is compared to a "real" one.I'd bet a dollar you simply don't have enough electron juice going through your LED, you're going to either need to parallel a few IO pins or make a transistor amplifier.

author: dentaku
author_rank: Frequent Contributor
timestamp: February 21, 2015, 06:29:02 pm
content: Quote from: Alex Eisenhut on February 21, 2015, 05:57:04 pmThey're just random IR LEDS that look like they are from old RadioShack stock.I actually have the original packaging form one of them and it saysMaximum voltage and currentsReverse voltage: 5VContinuous forward current: 150mAForward voltage: 1.3V typ., 1.7V maxRadiant power output: 15 -1 15mWWavelength at peak emission: 950nmI tested one with my little transistor/diode/cap etc. tester and Uf is 1.33V so it matches the datasheet. A green LED was closer to 2V for example.I'm just powering it directly from the 5V of the Arduino.http://www.righto.com/2009/08/multi-protocol-infrared-remote-library.htmlMaybe I should try using a transistor to switch the IR LED and use an external power supply like a 9V battery through a 180ohm resistor instead of powering the emitter from the 5V of the Arduino?This page also says IR LEDs usually require more current that regular ones.http://www.learningaboutelectronics.com/Articles/What-is-the-forward-current-of-an-LED

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: February 21, 2015, 06:38:35 pm
content: IR remotes use short duty cycles with peak currents up to half an amp. You will typically find a cap of several hundred uF in a remote to supply the brief high current, and a switching transistor. For a 3V supply, a series resistor below 10 ohms is typical

author: dentaku
author_rank: Frequent Contributor
timestamp: February 21, 2015, 07:01:16 pm
content: Quote from: mikeselectricstuff on February 21, 2015, 06:38:35 pmSo since the pulses are usually so short you can use them with rather high currents?I just pointed my brother's phone at a real remote and then at mine and the difference in brightness is noticeable.

author: electr_peter
author_rank: Unknown
timestamp: February 21, 2015, 07:11:26 pm
content: Other than current/brightness, there can be timing issues in your IR output. Arduino may not provide the timing you want - you have to check and adjust/optimise it. Have you checked with a scope?

author: tom66
author_rank: Super Contributor
timestamp: February 21, 2015, 07:44:21 pm
content: Quote from: dentaku on February 21, 2015, 07:01:16 pmI have worked on a product which uses 1.2A per IR LED, with two IR LEDs. (It's an IR blaster which controls other devices, not battery powered.) The ripple current was high enough that we needed to put an LC filter onto that portion of the circuit as otherwise our 5V rail would drop out under load causing the MCU to reset.

author: dentaku
author_rank: Frequent Contributor
timestamp: February 22, 2015, 02:37:59 am
content: I just used a 2N2222A and a 180ohm current limiting resistor to switch the IR LED using it's own 9V battery and now I can turn the volume up even with the device facing backwards so I guess 50mA is about right for this device.It's a ridiculous looking remote considering it's an UNO with a tiny breadboard, a big yellow pushbutton and two 9V batteries and all it can do is control one function on nothing but Sony TVsI've got a nice 4X6 keypad from an old marine GPS that I should hook up so I can control more stuff.

author: free_electron
author_rank: Super Contributor
timestamp: February 22, 2015, 02:42:16 am
content: Random ir leds ? They may be the wrong wavelengthOr you are not pumping enough juice through tem

author: dentaku
author_rank: Frequent Contributor
timestamp: February 22, 2015, 04:03:34 am
content: Quote from: free_electron on February 22, 2015, 02:42:16 amYes, like I said in my last post it works well now that I tried controlling the IR LED with a transistor and a 9V battery instead of just powering it directly from the 5V of the Arduino which couldn't safely supply the needed current anyway.

author: Alex Eisenhut
author_rank: Super Contributor
timestamp: February 22, 2015, 05:12:55 am
content: Quote from: dentaku on February 22, 2015, 04:03:34 amWell hold on there, the Arduino IO *pin* might not be able to supply the current, but what is providing the 5V to the system? Are you saying that can't supply about a 100mA more? You could clean up the whole thing by just using the available 5V supply rail.

author: Psi
author_rank: Super Contributor
timestamp: February 22, 2015, 05:29:03 am
content: N channel mosfet will be in order

author: BravoV
author_rank: Super Contributor
timestamp: February 22, 2015, 05:43:49 am
content: Although its not an accurate or the "right" method, a quick & dirty way to see if the IR is working is to see through you digital camera or cell phone's camera.See if your IR led is "bright" enough compared to other one.

author: coppice
author_rank: Super Contributor
timestamp: February 22, 2015, 05:55:48 am
content: How close to 38kHz is your modulation? Most receivers don't lose much sensitivity until you are a couple of kHz off, but some are quite narrow band.

author: hexreader
author_rank: Frequent Contributor
timestamp: February 22, 2015, 07:09:50 am
content: I have tested your code on my arduino and if you remove one of the two "/" characters on the first line, it works perfectly.It gives an accurate 40kHz modulation and the correct output for vol+I suspect that the problem lies with IR LED drive current as others have suggested. 39 Ohms using +5V and driver transistor is a good, safe combination for reasonable range. Most IR LEDs can handle 100mA continuously.I use two IR LEDs each with its own 10 Ohm resistor. Each LED can handle 100mA average, and 1A for very short duration. Your program outputs a 1/3 duty cycle, so I am able to drive 30mA per LED and still stay within 100mA average spec. This may be a risky thing to do in an experimental environment, as a permanent high will overload the IR LEDs.What you can achieve depends on the spec of the IR LEDs that you are using.In summary, use a transistor, 5V supply, 39 Ohms (or less if you dare) and maybe multiple IR LEDs.

author: DavidDLC
author_rank: Frequent Contributor
timestamp: February 22, 2015, 07:42:02 am
content: Some remote controls will send the same information several times with some delay between them, in case the receiver does not get the correct information the first time.At least I saw that behavior with a Sony remote control when capturing the waveform using a oscilloscope, then I read about this method.David.

author: hexreader
author_rank: Frequent Contributor
timestamp: February 22, 2015, 07:50:36 am
content: Quote from: DavidDLC on February 22, 2015, 07:42:02 amYes, the OP has already covered that in his code. He sends the same command three times with 40mS gap between messages.The code is just fine.

author: DavidDLC
author_rank: Frequent Contributor
timestamp: February 22, 2015, 08:12:42 am
content: Great, I didn't check the code.David.

author: coppice
author_rank: Super Contributor
timestamp: February 22, 2015, 08:34:21 am
content: Quote from: hexreader on February 22, 2015, 07:09:50 am40kHz is far enough off frequency to substantially desensitive the receiver. You don't need to be super close to 38kHz, but 2kHz off really starts to affect results.

author: hexreader
author_rank: Frequent Contributor
timestamp: February 22, 2015, 08:50:17 am
content: Quote from: coppice on February 22, 2015, 08:34:21 amSorry to disagree, but 40kHz is exactly on frequency for Sony protocol

author: miguelvp
author_rank: Super Contributor
timestamp: February 22, 2015, 09:09:06 am
content: Not sure why all the disagreementsbut the OP got it working but adding more juice.Quote from: dentaku on February 22, 2015, 04:03:34 am

author: hexreader
author_rank: Frequent Contributor
timestamp: February 22, 2015, 09:13:38 am
content: Quote from: miguelvp on February 22, 2015, 09:09:06 amDoh ! ....

author: PA0PBZ
author_rank: Super Contributor
timestamp: February 22, 2015, 09:40:24 am
content: Why is it that OP posted that he solved it in reply #8 and then the thread goes on suggesting the same and other solutions over and over again? Does anyone actuallyreadthe thread before posting?

author: AndreasF
author_rank: Frequent Contributor
timestamp: February 22, 2015, 01:17:07 pm
content: Quote from: PA0PBZ on February 22, 2015, 09:40:24 amThis:http://blog.codinghorror.com/because-reading-is-fundamental-2/I especially liked the Banana experiment.

author: SeanB
author_rank: Super Contributor
timestamp: February 22, 2015, 01:42:43 pm
content: Bananas, I just finished the last one in the bunch.Back to the OP consideration, I have often seen IR transmitters with limited power using a very nice trick, having a local RC circuit with a typical value 10R resistor and a 1000uF capacitor feeding the LED power, so that you can have a very high transmit power, but the current drawn from the supply is limited by the resistor, so it is low enough not to reset the MCU because of the high internal resistance of the main supply. You do need though to keep duty cycle low, which is easy on an IR transmitter as there even with a key pressed continuously most IR transmitter protocols are going to have a low sub 10% duty cycle.

author: dentaku
author_rank: Frequent Contributor
timestamp: February 22, 2015, 02:04:27 pm
content: Quote from: Alex Eisenhut on February 22, 2015, 05:12:55 amYou're right, it doesn't matter how much current the IO pin can safely supply anymore because it's just connected to the base of the transistor. I don't know why I didn't think of that. An UNOs 5V rail can safely supply 200mA according tohttp://playground.arduino.cc/Main/ArduinoPinCurrentLimitations

author: dentaku
author_rank: Frequent Contributor
timestamp: February 22, 2015, 04:00:16 pm
content: I've done some testing and a 12ohm resistor works well when powering the IR LED from the +5V rail of the Arduino.The TV picks up the signal just fine without having to point the emitter perfectly in the right direction.I would have never dared to use a 12ohm resistor on an LED before reading some of your answers but I guess IR LEDs pulsed very quickly are quite different than just constantly lighting regular LEDs.

author: Alex Eisenhut
author_rank: Super Contributor
timestamp: February 22, 2015, 05:12:49 pm
content: Quote from: dentaku on February 22, 2015, 04:00:16 pmWell you can't *see* what's going on, you can't tell if it's working, not working, or if you just blew it up. Radio Shack, RIP, used to sell thisit's magic, you charge it up with visible light from a fluorescent or sunlight, then that pink strip lights up in the presence of IR. I can't find a picture of it glowing.But now that electronic cameras are everywhere, you just use that. When I bought that strip, the only video camera I had was a B/W Panasonic tube camera hooked up to my Amiga...I'm old.

author: dentaku
author_rank: Frequent Contributor
timestamp: February 22, 2015, 09:55:54 pm
content: Quote from: Alex Eisenhut on February 22, 2015, 05:12:49 pmI pointed my brother's Samsung Galaxy phone at it and compared it to a Bell remote.I guess I'm old too because I've had a Vic-20, C-64 and Amiga 500

author: Wim_L
author_rank: Regular Contributor
timestamp: February 22, 2015, 10:24:57 pm
content: Quote from: dentaku on February 22, 2015, 04:00:16 pmIt's not specific to IR LEDs. Regular visible or UV LEDs can also be used with short high-current pulses.