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.

  • Do you have a 3-pin IR receiver? – Majenko Sep 16 '16 at 21:36
  • @Majenko Yes i do (VS18388) – Mads Nielsen Sep 16 '16 at 21:37
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.

  • 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? – Mads Nielsen Sep 16 '16 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. – Majenko Sep 16 '16 at 21:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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