Ir sensor module

Recently I got 2 ir sensor module like the one in http://henrysbench.capnfatz.com/henrys-bench/arduino-sensors-and-input/arduino-ir-obstacle-sensor-tutorial-and-manual/. I want to create a ir beam break circuit, not sure whether these can be used if I put them heads to heads

Yeah, you can use them that way. But you would need to remove the IR led from one (or pair it with another IR led / desolder the LED and place it on the opposite side).

But they are not smart modules and are very much effected by (sun) light.

I want to create a ir beam break circuit,

not sure whether these can be used if I put them heads to heads

I don’t think that’s going to work.

Think about it.

The way it works :

// IR Obstacle Collision Detection Module
// Henry's Bench

int LED = 13; // Use the onboard Uno LED
int isObstaclePin = 7;  // This is our input pin
int isObstacle = HIGH;  // HIGH MEANS NO OBSTACLE

void setup() {
  pinMode(LED, OUTPUT);
  pinMode(isObstaclePin, INPUT);
  Serial.begin(9600);
  
}

void loop() {
  isObstacle = digitalRead(isObstaclePin);
  if (isObstacle == LOW)
  {
    Serial.println("OBSTACLE!!, OBSTACLE!!"); / if obstacle, run this code
    digitalWrite(LED, HIGH);
  }
  else
  {
    Serial.println("clear");    / else, 'clear'
    digitalWrite(LED, LOW);
  }
  delay(200);
}

head to head
detector-1 led on => >==detector-2 phototransistor receives light from detector-1 (‘obstacle !’
detector-1 detects light from detector-2 ==< <=detector-2 led on
(detector-1 = ‘obstacle !’)

You could however invert the logic to say:

 if NO obstacle 
                BEAM BREAK !!