IR beam break barrier with 2 sensors
SKU 5980-IRBBSENSOREAN 8219671076890Item type: AssembledElectronic components
Description
Package containing an infrared LED emitter and a receiver. Placed facing each other, at a maximum distance of 25 centimeters, they allow creating an infrared barrier capable of detecting interruption of the beam emitted by the transmitter. Compared to PIR sensors, beam interruption is much faster and allows better control. The receiver is a transistor with open collector output to which you can connect a relay, an LED, or another device that draws a maximum of 100 mA. They can also be used with Arduino or another microcontroller.
Example sketch for Arduino
/*
IR Breakbeam sensor demo!
*/#define LEDPIN 13
// Pin 13: Arduino has an LED connected on pin 13
// Pin 11: Teensy 2.0 has the LED on pin 11
// Pin 6: Teensy++ 2.0 has the LED on pin 6
// Pin 13: Teensy 3.0 has the LED on pin 13#define SENSORPIN 4
// variables will change:
int sensorState = 0, lastState=0; // variable for reading the pushbutton statusvoid setup() {
// initialize the LED pin as an output:
pinMode(LEDPIN, OUTPUT);
// initialize the sensor pin as an input:
pinMode(SENSORPIN, INPUT);
digitalWrite(SENSORPIN, HIGH); // turn on the pullupSerial.begin(9600);
}void loop(){
// read the state of the pushbutton value:
sensorState = digitalRead(SENSORPIN);// check if the sensor beam is broken
// if it is, the sensorState is LOW:
if (sensorState == LOW) {
// turn LED on:
digitalWrite(LEDPIN, HIGH);
}
else {
// turn LED off:
digitalWrite(LEDPIN, LOW);
}if (sensorState && !lastState) {
Serial.println("Unbroken");
}
if (!sensorState && lastState) {
Serial.println("Broken");
}
lastState = sensorState;
}
Documentation and useful links
Technical details
| Distance | about 25 cm |
|---|---|
| Power supply | from 3.3 to 5.5 Vdc |
| Transmitter consumption | 10 mA @ 3.3V, 20 mA @ 5V |
| Load applicable to receiver output | 100 mA |
| Transmitter/Receiver LED angle | 10° |
| Response time | <2 ms |
| Dimensions (mm) | 20x10x8 |
| Cable length | 234 mm |
| Weight | 3 grams (single sensor) |












