1

So i have taken apart this old remote i found, and removed the IR-LED and replaced it with wires.

I thought that i would just be able to put the wire that used to go to the positive side of the IR-LED, to a pin on my Arduino UNO (and negative to GND), and just use the same IR decoding library to decode the signal, as if it was from an IR sensor.

But as it turns out, i receive undecipherable nonsense (or so it seems), like 5+ different codes from pressing the same button on the remote.

If i connect the 2 pins from the remote to the IR-LED on my breadboard, and an IR receiver to my Arduino i receive the signal you would expect, which in my case is "24137D" in HEX (1 on the remote) every time.

So my question is: Why does this happen and is it even possible to do what i am trying to do. Why? Why not? And if possible how is this done?

Here is the code i am using:

#include <IRremote.h> //https://github.com/z3t0/Arduino-IRremote
#define IR_Pin 7
IRrecv irrecv(IR_Pin);
decode_results results;
void setup() {
 Serial.begin(9600);
 pinMode(IR_Pin, INPUT);
 irrecv.enableIRIn();
}
void loop() {
 if(irrecv.decode(&results)) {
 Serial.println(results.value, HEX);
 irrecv.resume();
 }
}

Maybe the answer is obvious and i just don't understand how IR works. If so feel free to link some documentation that can help me.

Thank you.

asked Sep 16, 2016 at 21:35
2
  • Do you have a 3-pin IR receiver? Commented Sep 16, 2016 at 21:36
  • @Majenko Yes i do (VS18388) Commented Sep 16, 2016 at 21:37

1 Answer 1

3

Your IR receiver is decoding the high frequency pulsed On-Off-Keying waveform for you. The Arduino doesn't do that.

An IR signal consists of high frequency (say 36KHz) on-off light pulsed at a lower (data) frequency (different combinations to make 1 and 0)

enter image description here

The receiver you have takes that high frequency signal, amplifies it, filters it, and gives you just the resulting 1 and 0 signals. From that the Arduino can use simple time measurements to work out the code.

Without the filtering that the receiver provides the Arduino will have to do all that work by itself - and while that may be technically possible, it's seldom done. You may be able to find a library that can do it, but it's unlikely.

answered Sep 16, 2016 at 21:40
2
  • Thank you for the quick response. Is there a fixed timing that i could simply implement like eg. delay(10) digitalRead(IR_Pin) //Repeat x times and so on? Commented Sep 16, 2016 at 21:53
  • No. You would need to implement a system that triggered an interrupt on every rising edge, count the microseconds between each triggering, work out which is the leading and falling pulses of each block, and calculate the times between them all. Commented Sep 16, 2016 at 21:54

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.