No constant IR lightbeam


I am fairly new to this whole topic and a (probably/hopefully) very simple problem is giving me a hard time:

I have this transmitter/receiver combination: and use the following code:

#include <IRremote.h>

#define PIN_IR 3
#define PIN_DETECT 11
#define PIN_STATUS 13
unsigned long time;

IRsend irsend;
void setup()

byte oldStatus;
void loop() {
  byte newStatus=digitalRead(PIN_DETECT);
  if (newStatus!=oldStatus)
    digitalWrite(PIN_STATUS, newStatus);
    Serial.print("TimeStamp: ");
    time = millis();
    Serial.print(" / Status: ");

But the control light on the receiver only flickers randomly and very low, giving the following output: (it is not moving, nothing is breaking the beam)

Timestamp: 8760 / Status: 0
Timestamp: 8761 / Status: 1
Timestamp: 9072 / Status: 0
Timestamp: 9072 / Status: 1
Timestamp: 9457 / Status: 0
Timestamp: 9457 / Status: 1
Timestamp: 9630 / Status: 0
Timestamp: 9631 / Status: 1
Timestamp: 9640 / Status: 0
Timestamp: 9673 / Status: 1
Timestamp: 9816 / Status: 0
Timestamp: 9817 / Status: 1

The sending control led is constantly on, the receiver is only slightly blinking. I tested the receiver with the receiving demo from the library and it works like a charm, so the issue is with the sending I guess.

As I said I really don’t have a clue but is it possible that the sender is already creating a 38khz signal itself? So I basically “double” it with the above code? But only putting the pin on HIGH doesn’t work either.

BTW if I move the receiver back and forth it’s giving me a constant red LED too on the receiver?!

Can somebody alter the code that the correct signal is being sent?

Thank you!!

What are you trying to do? That sort of receiver is not suitable for a breaking beam type circuit. It is designed for sending data.

Well it's sender and receiver but the sending is rather random...

Common IR receivers are specifically designed to reject continuous signals -- that's what Mike is saying.

Link to a part that will accept a continuous signal:

Visit this site to learn how common IR remote control works:

To use beams (aka light barriers) you need the TSSP4038 from Vishay (already posted), for the reasons already highlighted.

The one you bought is probably a cheaper/lower quality IR receiver. (Why: because they didn't provide the model name, which suppliers usually do when selling quality products). If you are lucky it may work OK with TVs remotes etc. For Vishay the model nos are on the top of the device.(very small).

Also, it is more likely that your receiver isn't working as you wish - not the emitter.

If you change your code to generate & look for on/off pulses of say 600 uSecs ON and 2000 uSecs OFF, you [u]may[/u] get something. However, [u]most[/u] standard IR receivers are designed to reject any continuous modulated IR signal as noise.

Finally, IR reveivers output a HIGH when idle and a LOW when receiving modulated IR.

Hi All,

As I said I really don’t have a clue but is it possible that the sender is already creating a 38khz signal itself?

No not a chance at all!!

It looks like the transmitter part, if I can call it that is a simple LED on/off device. It needs to be modulated at perhaps 38KHz, as the receiver looks like that type! that receives the same! so just turning the transmitter LED on continiously will not do the job. My first robot used a similar set up to detect objects in it’s way., but it looked for a reflection of the IR beam. I used 2 IR LEDs driven by a 38KHz PWM output and a Vishay TSOP4838-IR Receiver Module. Detects 38kHz modulated infrared. Built in pre-amp and filter. 4.5-5.5V operation.

Also see TSOP39238 IR Receiver Module. Amplified photodiode detects 38kHz modulated infrared. 2.5-5.5V operation.

You can find my early bots here under Electronics, or look at this thread: Note what is said about IR in daylight, etc….

Hope it helps, regards.


OK here’s a pic… Sorry this was in my Picaxe days, long before I know what an Arduino was, things have got a lot better.