IR receiver "works" even after I've physically blocked the communication

Hello all,

I'm having a bit of an issue, and wanted to see whether or not what I'm noticing with my set up is somehow due to a faulty script.

I have a fairly simple set up—just an IR LED emitter and an IR receiver, which responds to 38KHz modulated IR pulses. I've pasted my code below. The goal of my set up was to (1) see if my receiver is working and (2) see what degree of physically blocking the communication between the emitter and the receiver (placing my hand between them, for example, and varying the distance) is enough to cause a total signal loss (so a static HIGH output from the receiver).

// This procedure sends a 38KHz pulse to the IRledPin
// for a certain # of microseconds. We'll use this whenever we need to send codes

void pulseIR(long microsecs) {
  // we'll count down from the number of microseconds we are told to wait

  cli();  // this turns off any background interrupts

  while (microsecs > 0) {
    // 38 kHz is about 13 microseconds high and 13 microseconds low
    digitalWrite(6, HIGH);  // this takes about 3 microseconds to happen
    delayMicroseconds(10);         // hang out for 10 microseconds
    digitalWrite(6, LOW);   // this also takes about 3 microseconds
    delayMicroseconds(10);         // hang out for 10 microseconds

    // so 26 microseconds altogether
    microsecs -= 26;
  }

  sei();  // this turns them back on
}



void SendPowerCode() {

  pulseIR(1500);
  delayMicroseconds(200);
  pulseIR(1440);
  delayMicroseconds(200);
  pulseIR(600);
  delayMicroseconds(1060);
  pulseIR(1400);
  delayMicroseconds(240);
  pulseIR(1400);
  delayMicroseconds(260);
  pulseIR(560);
  delayMicroseconds(1100);
  pulseIR(540);
  delayMicroseconds(1100);
  pulseIR(540);
  delayMicroseconds(1100);
  pulseIR(540);
  delayMicroseconds(1100);
  pulseIR(520);
  delayMicroseconds(1140);
  pulseIR(520);
  delayMicroseconds(1120);
  pulseIR(1360);


  delay(70); // wait 70 milliseconds before sending it again

  pulseIR(1500);
  delayMicroseconds(200);
  pulseIR(1440);
  delayMicroseconds(200);
  pulseIR(600);
  delayMicroseconds(1060);
  pulseIR(1400);
  delayMicroseconds(240);
  pulseIR(1400);
  delayMicroseconds(260);
  pulseIR(560);
  delayMicroseconds(1100);
  pulseIR(540);
  delayMicroseconds(1100);
  pulseIR(540);
  delayMicroseconds(1100);
  pulseIR(540);
  delayMicroseconds(1100);
  pulseIR(520);
  delayMicroseconds(1140);
  pulseIR(520);
  delayMicroseconds(1120);
  pulseIR(1360);
}

void setup () {
  pinMode (6, OUTPUT);
}

void loop () {
  SendPowerCode();
}

After setting up the circuitry and hooking up my oscilloscope, I can see that my receiver is working. However, no matter how I try physically block the communication between them—even going as far as completely wrapping one of them in heat-shrink tape—the signal does not drop. How is this possible? Is there something wrong with the script?

Have you removed power from the IR receiver? After removing the power to the IR is there still a signal to process?

Thank you for the reply. I just did, and the signal was completely lost.

ArianKS:
Thank you for the reply. I just did, and the signal was completely lost.

1/2 split!

Perhaps, the sender is always sending a signal for the receiver to receive?

Perhaps, the circuit of the receiver is causing oscillations to build up in the circuit?

Idahowalker:
Perhaps, the sender is always sending a signal for the receiver to receive?

Good point. To check that, I completely disconnected the sender (IR LED). The signals stopped (constant HIGH on the oscilloscope).

Idahowalker:
Perhaps, the circuit of the receiver is causing oscillations to build up in the circuit?

To test this out, if I disconnect the IR LED, after some time the signal should be lost, right?

Are you sure the material you are using for blocking is opaque to IR? Are you sure the IR is not going around your blocking by bouncing off, for example, walls?

If the send signal was removed and the receiver IR was hooked up to power and there was no signal produced in the receiver then the odds of an oscillation build-up are very very low. I'd look to discover why the sender is always seeming to send.

johnwasser:
Are you sure the material you are using for blocking is opaque to IR? Are you sure the IR is not going around your blocking by bouncing off, for example, walls?

I've tried (1) my fingers (2) electrical tape to completely wrap around the IR emitter. I'll try aluminum next.

 SendPowerCode();

It makes sense why the sender is always sending, the send code is always being ran. Seems things work like how they were programmed to work.


Have you moved the sender to another room and closed the door to the room the receiver is in?

Idahowalker:

 SendPowerCode();

It makes sense why the sender is always sending, the send code is always being ran. Seems things work like how they were programmed to work.

Yes, but when I actually physically block the sender—or at least in theory—nothing should be received by the receiver.

I had problems a bit similar to this, something was wired up wrong.
Instead of cutting the power to the emitter, can you leave everything as it is and just unplug the emitter. Does that change anything?

Oh, and I picked this up from one of Nick Gammons posts:

tone(pinEmitter,38000);

It works great for me.

Steve

steve1001:
I had problems a bit similar to this, something was wired up wrong.
Instead of cutting the power to the emitter, can you leave everything as it is and just unplug the emitter. Does that change anything?

What do you mean by not cutting the power to the miter but at the same time unplugging it?

I've no idea of your circuit or set up, so just throwing some things out here, shot in the dark.
Power everything up as you have been doing. Then just withdraw the emitter, without changing anything else. Does anything change at the receiver end?

steve1001:
Oh, and I picked this up from one of Nick Gammons posts:

tone(pinEmitter,38000);

It works great for me.

Steve

Holy crap this worked (as in now if I put the same physical barrier, the receiver stops receiving the signal).

But why?

(Guess Arduino works in magical ways)