That’s about as good as the diagrams get. Once you understand what it means, then it makes sense. The device has an NPN transistor output which means that it draws current into itself from a load connected to power and routes that current to ground. One “input” (pin 4) will turn on when the sensor detects a reflection. The other input (pin 2) is on without a reflection and will turn off once a reflection is seen".
The load in industry is usually a device that senses the current. In our case, its usually a pull up resistor. The device can sink maximum of 100 ma, so a resistor around 500 ohms would be good. That would allow it draw around 22 ma. (12-1) / 500 = 0.022 A (ohms law)
In summary, you have a resistor connected to 5V and to pin 4 or 2 of the device.
The voltage at the pin of the device would be measured to detect whether or not an object is present. The measuring is the issue, if you connect that to a logic input on the roboRio, it probably won’t go low enough for a good logic low, (which is less than 0.7 volts). You can connect it to an analog input and tell if its less that 2.5 volts, and then consider it on.
We went through this last year and wound up running it through an opto-isolator which not only have us a nice solid logic low, it also separated the sensor from the 5 (or maybe it was 3.3) volts of the logic input. If you are interested in that circuit, let me know by responding or PM me.
I dug out my sketch. Warning - my drawing and handwriting are pretty bad, but you should be able to make it out. The reflective sensor is on the left and the digital input to the roboRio is on the right, with the opto-isolator in between. I have attached it to this thread.
The VRM is a better choice since it is a boosted supply. The PDP will drop below 10 volts causing the sensor to brown out. The sensor might, might sometimes or might not pull low enough for the roborio to read it as a 0. One of the issues with using +12 volt sensors with 3.3 volt IO. That is the reason for Brian’s modification.
Everything is right in this post other than the roboRIO does not have an internal pullup resistor. You will need to add a pullup resistor between your signal and your positive pin. We had to do the same on our robot. I wish they would have designed the pull up resistor internally like on the cRIO.
The roboRIO does have a pull-up, but it may not have been strong enough for your sensor. I didn’t look for this one, but for the very similar QS18VN6LV the leakage current spec suggests it won’t work on the roboRIO without an additional pull-up (though the one I tested did seem to work plugged in direct).
According to data I read, the saturation of the output transistors in the Banner Sensor is typically 1.2 volts. That may not always be low enough to sensed by the 3.3 volt logic. I suspect that the opto-coupler is lower and that is why it works.