IR receiver/transmitter

Hello,

I want to send IR light from an IR transmitter ("clear-transparent" LED) to an IR receiver ("black" LED) and when the IR link is disconnected from an object to give me a signal. Both LEDs have two pins (anode,cathode). I will connect the transmitter to +5Volts and the GND so that it continuously sends light. I will connect the the receiver to the GND and the pin 2 of the Arduino to sense when I have +5Volts and when I have 0Volts. Should I use any PULL_UP resistors of the Arduino? What resistors should I use?

Thank you...

Post links to the datasheet of the used hardware!

Show us a good schematic of your circuit.
Show us a good image of your wiring.
Give links to components.
Posting images:

I use 220 Ohms resistors (the pots).
I use these elements:

L53F3C

and

L53P3BT

The code I use is this:

int ledPin = 13;  // LED connected to digital pin 13
int inPin = 7;    // pushbutton connected to digital pin 7
int val = 0;      // variable to store the read value

void setup() {
  pinMode(ledPin, OUTPUT);  // sets the digital pin 13 as output
  pinMode(inPin, INPUT);    // sets the digital pin 7 as input
  Serial.begin(9600);
}

void loop() {
  val = digitalRead(inPin);   // read the input pin
  digitalWrite(ledPin, val);  // sets the LED to the button's value
  Serial.println(val);
  delay(2000);
}

Taken and configured from here:

https://www.arduino.cc/reference/en/language/functions/digital-io/digitalread/

Thank you…

Power rails are split :frowning:

Ok, I connected the middle up... Nothing changed to the serial..

Thank you...

Make sure you have not mixed up the LED and the transistor.

Make sure you have the anode/cathode and emitter/collector identified properly.

You may have damaged the components if the potentiometer is/was set to 0 ohms.

Buy some fixed resistors!

digitalWrite(ledPin, val) ; // sets the LED to the button's value

Your digitalWrite does nothing.

You may need to add amplification to the photo transistor.

Your cct. will give 0/1 when the IR light is interrupted.

Plain wires into a female header is a poor idea.

Yes I have checked everything again and again

I follow this circuit:

http://www.reconnsworld.com/ir_ultrasonic_basicirdetectemit.html

I put and I pull objects... nothing happens. The Serial doesn't change state...

Thank you

The circuit uses a 10k resistor with the transistor.

Measure the DC voltage collector to emitter, ‘use a DVM’, what do you get with/without IR light?

Try new components.

Ok, everything, the receiver was burnt/fault. I changed it and everything ok...

Thanks!!

Always blame yourself.

Always follow proper schematics.

Always buy extra components.

Treat yourself, buy a DVM.

Congratulations!

Hello,

I have connected the above circuit to a bigger circuit/project that it was for. I use the code below:

void setup() {
  Serial.begin(9600);           //  setup serial
}

void loop() {
  Serial.println(analogRead(A0));          // debug value
  delay(2000);
}

in order to detect when there is an object cut the IR beam or not. The problem is that although the first time I was getting >1000 when there was an object and <600 when there was not an object. Now I get:

16:02:30.721 -> 26
16:02:32.734 -> 25
16:02:34.721 -> 25
16:02:36.730 -> 26
16:02:38.718 -> 25
16:02:40.697 -> 25
16:02:42.713 -> 16
16:02:44.695 -> 22
16:02:46.712 -> 22
16:02:48.691 -> 21
16:02:50.706 -> 20
16:02:52.686 -> 22
16:02:54.697 -> 22
16:02:56.687 -> 26
16:02:58.701 -> 24
16:03:00.681 -> 24
16:03:02.692 -> 26
16:03:04.673 -> 25
16:03:06.686 -> 25
16:03:08.662 -> 25
16:03:10.677 -> 25
16:03:12.659 -> 25
16:03:14.674 -> 26
16:03:16.657 -> 20
16:03:18.642 -> 20
16:03:20.653 -> 20
16:03:22.644 -> 20

24 or 25 or 26 when there is an object and the rest of the values when there is not an object. I cannot understand what is wrong…

Thank you

Perhaps your circuit wiring is bad or there is a component failure.

Let’s see a good image of the wiring.