Trouble with through-beam sensors

Does anyone have any experience with these photoelectric sensors? We tried using an emitter and receiver to detect the presence of a gear in our robot, but we haven’t had any success using an NPN output receiver to sense if the emitter beam has been broken.

The roboRIO should have a pullup resistor on the signal pin, so we should be seeing a 5V signal with the beam active, and a 0V signal when the beam is broken. However, even when we break the beam (and the status LEDs on the receiver show that the beam is no longer being sensed), the DIO pin is not getting pulled down to 0V.

In the end, we were able to use an IR sensor and some gaffer tape to sense the gear, but our new sensor is also an NPN output, so we’re confused as to why one works and the other doesn’t.

What sensor did you end up using?

We are trying to use the Allen Bradley 42JT and we are having a hard time to figure this out… Having a hard time to wrap our head around any sensor that requires a 10-30VDC input… Any white papers or specific blog/youtube would be appreciated.

http://firstchoicebyandymark.com/fc17-143

Really want the kids to feel that we are building an actual robot, not just a fancy expensive RC car… but we are a second year team and our knowledge is very limited…

sensors are a great next step to automating things.

By far the easiest way to wire these is as NPN. the short version is that Brown goes to 12V on the VRM and Blue goes to Ground on the VRM. the signal wire (usually black but sometimes white) goes to a digital input on the RoboRio. the rio internally pulls the input pin up to 5V, and then when the switch is triggered it makes the input 0V. this may be inverted from what you want, but you handle that in your code.

The problem is most industrial sensors are designed for 24 V. Some will work down to around 10 volts. The Roborio input logic is actually 3.3 Volts. Yes I know the + rail is 5 Volts. Anyway the sensor output pulls down to somethings more than the transition threshold to logic 0 in the roborio. You can play with resistors or use an optocoupler to get a true 0. I will try to find a link on CD where the details are posted. For the most part you can run the sensor from the 12 V VCM so it doesn’t brown out. The NPN output drives to 0 volts, and floats up so it will not over voltage the roborio input.

If that’s the case, would hooking this sensor up to the analog pins allow us to program an ‘on’ and ‘off’ voltage?

That happens to be the exact kind we use on our robot. What we do is we put the sensor output into an Arduino running this sketch and then send the output from that to the RoboRIO.

That’s exactly what we are doing with a Banner QS18 sensor. Last year we were able to connect the white or black wire of a QS30 sensor directly to the DIO signal port and it worked great. This year we tried the same thing with a QS18 and no joy. My guess is that it’s right on the edge of working within the roboRIO DIO voltage range. We switched it to analog and it worked like a champ, voltage > 2.5 = triggered. I was a little concerned pumping 12V into the 5V analog port but it seems ok. If you want to use the DIO port you can add an extra resistor or an opto-isolator as described here:
https://www.chiefdelphi.com/forums/showthread.php?t=142389