Hello, I am trying to use an Arduino to detect a signal from an IR Beam sensor, that is operating at a 24VDC logic. Now the IR Beam has Vs=24Vdc, gnd and a separate line having the common, NC, and NO. This means it has an onboard relay but the distances from my Arduino to the IR beam dont permit me to send a signal over one pin to the common of the IR and detect it back using another digital pin thats configured as input. The other operating mode for the IR Beams is the open collector configuration, i did some research and ordered BC547 to use as a switch mode transistor for detecting whenever the IR Beam is triggered. But i can't get the circuit to work. Any ideas on how to connect the arduino to the 24vdc ir beam safely without damaging the arduino. Heres my code and a link to the schematic i tried as well the manual to the IR beams am using. https://www.centsys.co.za/upload/product_link_files/0.07.A.0027.-Photon-infrared-beams-manual-insert-22072013-BM-for-web.pdf
const int IRBeamPin = 2;
void setup() {
pinMode(IRBeamPin, INPUT_PULLUP);
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, LOW);
Serial.begin(9600);
}
void loop() {
int IRBeamState = digitalRead(IRBeamPin);
if (IRBeamState == LOW) {
Serial.println("IR beam interrupted");
digitalWrite(LED_BUILTIN, HIGH);
// Additional code for actions to be taken when the beam is interrupted
}
else {
Serial.println("IR beam not interrupted");
digitalWrite(LED_BUILTIN, LOW);
// Additional code for actions to be taken when the beam is not interrupted
}
delay(100);
}
THE IR has a transmitter and reciever. The SPDT is present in the reciever IR. so i need a suggestion for the type of optocoupler i can wire in series with a resistor in series to feed the anode of the led in the opto coupler. I need it as a single IC
Yes thanks for poiniting it out. Now an open collector implementation using a transistor, i can be able to read the state change in the IR using an INPUT_PULLUP in the Arduino. I need an example circuit to help implement that.
Yes it's OK but Iwould put a 4.7K ohm pullup resistor next to the arduino, it will help reduce noise pickup.
Connect one end of the resistor to 5V and the other end to the Arduino IRBeampin
Yes it's OK but Iwould put a 4.7K ohm pullup resistor next to the arduino, it will help reduce noise pickup.
Connect one end of the resistor to 5V and the other end to the Arduino IRBeampin
Okay, I will implement this tomorrow morning and revert back. Thanks in advance.
Along with the external pullup resistor add a 0.1uF ceramic cap from the input to ground to bypass environmental electrical noise picked up by the long wire (antenna) to ground.
No. When the relay contacts close the capacitor will discharge a very large current through them, more than they are designed to handle.
Eventually the contacts will become pitted and corroded. Never put a capacitor directly across relay contacts
Notedd, the solution worked, with one IR pair, my ideal one is to daisy chain 3 IR sensors so i can detect a long vehicles appropriately. Would ferrite beads help?