TS0P4838 and IR Emitter Problem


I'm trying to create a proximity sensor using a TSOP4838 and an IR Emitter. I was able to test my TSOP4838 using the IRremote.h to detect/receive values from a remote controller. The problem now is that I can't seem to pass values to the TSOP4838 (receiver) if the signal is coming from the Ir emitter itself.

The pin configuration that I've used for the
pin1= to dgital pin 2
pin2= GND
pin3 = VCC / 5V

The Ir emitter is connected to pin 3.

Any help would be appreciated.

No links to the hardware you used!
What does "the Ir emitter itself" means? A remote control is an IR emitter. How did you plan to realize your proximity sensor? Sending out an IR signal and measuring the time until you detect it? That won't work. An infrared signal needs about 3ns run 1 meter. So if proximity doesn't mean several kilometers for you, an Arduino won't detect it.

The IR emitter I’m pertaining to is the IR led.
Here’s a link for the TSOP IR receiver


I can detect values through it using a normal remote but if I used the IR led, I can’t detect anything.

I’ll be using it for small range detection.
Attached is the image of the current setup.

You have not provided enough information.

What code are you using to drive the IRLEd? Are you modulating the signal?

This IR receiver is not designed for measuring proximity (Unless you are just planning to detect whether the device is in range or not - but this will be very inaccurate due to several factors).

To measure range you will need something like TSSP4P38.

#include <IRremote.h>

#define PIN_IR 3
#define PIN_DETECT 2
#define PIN_STATUS 13

IRsend irsend;
void setup()

void loop() {
  digitalWrite(PIN_STATUS, !digitalRead(PIN_DETECT));

that’s the code I’m using from this site Detecting an IR Beam Break with the Arduino IR Library . The problem is it doesn’t work…I’ve also tried applying this code

int  irPIN=3; //IR LED
int  rPIN=2;  // IR Receiver TSOP 4838
int  rs=13;
void setup()
  pinMode(rPIN, INPUT);
  pinMode(irPIN, OUTPUT);
  pinMode(rs, OUTPUT);
void loop()
    digitalWrite(rs, LOW);

The LED on pin 13 should turn on whenever the IR receiver receives something.
If I’ll be modulating the 38KHz signal, should I go for a 555 timer?
This is my first time driving IR via arduino, I was able to try it using BoE-Bot (Parallax).

I really need some enlightenment here :x

IR receivers generally need modulated pulses to on off

e.g. 500 uSecs on and then 500 uSecs off

...which is then built up to a binary code.

The next problem you will have is that it will be very difficult to send the IR and measure it from the same Arduino....because you only start measuring when the IR has stopped.

The next thing to look out for is the when modulated IR is being received, the OUT pin of the IR receiver will be LOW and when nothing is being received the OUT pin will be HIGH.

Finally, the particular model you are using (TSOP4838) will not work well with continuous modulated IR or a long series of Pulses/bits.

If you want to continue with this approach...use an interrupt to detect the changes in the pin from the IR receiver....see examples on attachInterrupt.

okay I'll check that. perhaps I should also get another IR receiver by tomorrow if I still can't make this TSOP4838 to work well. All the projects I've seen using this receiver is used with a remote control.

By any chance if TSSP4P38 isn't available here, do you have other suggestions ?

The project I'm working on is to detect something, then if it does it must send a signal to the buzzer.

I followed these instructions to get my 4838 working.

It may give you some ideas.


I suggest you play with the examples of the IRremote library to become familiar with this sensor. Also look here to study about IR remote control SB Projects

Don't rush off and buy stuff until you really understand more of the issues.

Do some searching for proximity sensors. There are many types available. The problem you have is that you are using the wrong type of sensor.

For example there are ultrasound sensors available and many other IR proximity sensors for different situations. You need to use google and read some datasheets and search for some other (similar) examples on this and other forums.

So...you really need to do the following...

Step 1: Pause
Step 2: (re)search & learn
Step 3: Try again with new info & knowledge

Hello again, TSOP4838 doesn't work with the IR led (emitter) that I initially planned, good thing my buddy has a photodiode receiver, the code works I can now detect if the object is near or not.

Thank you for the help guys , perhaps I'll work on the TSOP4838 during the holidays.