Line tracker Sensor 2019?


@MarkBalla We did get it working without reducing the voltage. Not saying it should be done but in ignorance it was done and didn’t hurt anything


So I just purchased these in hoping they should take the 12v signal and take it down to 5v to use on the DIO rather then build my own circuit.

Should this work?

How to wire and program Photoelectric sensors? (beginner)
Issues with the 42EF-D2MPAK-F4 Sensor

To verify - you are converting the output? If so, yes.

However, “making your own circuit” is literally as easy as three equal resistors in series.


Yes, these divide the signal voltage by 5 and will work. The DIO are 3.3V inputs. See page 15 of the Roborio manual. If there is a 5V or 5.25V spec, it is probably an Absolute Maximum meaning that exceeding that voltage will damage the circuit. Manufacturers do not guarantee proper operation between the nominal range (3.3V ±5%) and the Absolute Max.

It would be a good idea to wrap these with electrical tape or put a piece of large heatshrink tubing so it doesn’t short out your signal on some part of the robot frame.


Thanks for all of the information posters. I’m doing my best to put all of the information together…so if someone could verify the below for accuracy it would be very appreciated.

These sensors Allen Bradley 42EF-D2MPAK-F4 can be interfaced directly with the roborio with three wires in total:

  • Power - 12V best supplied through the VRM using the 500ma ouput
  • Ground - GND on one of the DIO ports
  • Signal - S on the DIO port (but must first be taken down to 5V max)

Also suggested are the QTRXL-HD-01A Reflectance Sensor which can be interfaced directly with the roborio with three wires in total:

  • Power - 5V best supplied through the 5V on one of the DIO ports
  • Ground - GND on one of the DIO ports
  • Signal - S on the DIO port

Do I have all of that right? Thanks in advance for your responses.


We bought 2 of the Pololu 16 x 8mm to test with. So far, we have not been able to detect the white gaffers tape with them from above about 5/8". Has anyone been able to get success anywhere near 2" high?


We’re using opto-isolators to take the 12V down to 5v for the KOP light sensor. These HAVE TWO LEDs and two NPN photo transistors so one board will do two sensors. I really wouldn’t advise feeding 12v straight into a DIO pin!

The voltage dividers might do it fine as well. We just wanted to be sure.


Here is NI’s official response. 5.25 is the maximum allowed into the DIO.


The pololu sensors have no optics. That is what makes them so short range. It also makes them more sensitive to stray light. Placing a lens in front of it would help if you can figure out the right strength.
My guess is this would help.
A bar magnifier will work with a line array of sensors. A 1/2 ball magnifier should work better than a bar if there is just one sensor. The reason I suggest these instead of a regular lens is that the focal distance for these types is the back side of them. So you can simply tape them to the front of the sensor. A regular lens would need to be held at around it’s focal distance from the sensor.
I have not done this as I would rather spend the money on the nicer ones with all the details worked out. But $40 vs $4 may be worth it.


Interesting. The way the Pololu sensors are laid out it would be hard separate the emitter from the receiver with regard to this lens…and how might that lens affect the emitter.

@blturner what “nicer ones” are there as alternatives that you would consider?



The nicer ones have separate small lenses on the emitter and sensor. As long as the focus of the two of them overlap it will work. It’s hard to get them not to overlap so I did not mention it.
The Allen Bradley one mentioned above and the Keyence ones that have been in the KOP in the past.
Here is one.



Here is a fixed link to the sensor.


I’m interested in using these too - I assume you have them hooked up and they work?
The low voltage side hook up looks really straight forward using 5V, Ground and signal with the DIO port.
I’m not sure about the 12V side - yes, the Allen-Bradley sensor signal output goes to the HV1 on the Level Converter, but I’m not 100% sure about the 12V and ground connection (HV and GND) connection source - VRM, or something else obvious that I’m not figuring out?



You want the 12v supply voltage to be coming from a boosted source, not the battery voltage that fluctuates as we drive.
The sensor works down to about 10.5v or so, but becomes undependable as the voltage dips below that, which is pretty common for FRC robot batteries.
So, either a VRM or similar custom circuit voltage booster is recommended to prevent the sensor from cutting in and out as you drive.


Yes thanks - I’m probably not being clear.
I will be connecting the Allen-Bradley sensor to a VRM, my question is the 12 volt input I saw in a picture for the step down to 5 volts when using the device from Sparkfun:


That 12v input can just be battery voltage, if it’s feeding a step down.


Just to be clear, 5.25 V is the “Absolute Maximum”, beyond which permanent damage to the Roborio may occur. It reflects a “Nominal” of 5.00 V with a tolerance of ± 5 %, an industry standard.

5.00 V is the value that users should be aiming for when finding solutions for attenuating the 12 V signal, not 5.25 V. Some (hopefully very small) number of users who use 5.25 V as the target will damage their Roborio’s.


The grounds on both sides of the Sparkfun Optoisolator can be connoted together for this application. You’d feed 12v as the supply on the sensor side from the VRM. On the output side you’d give it 5v for the RoboRio’s DIO port.


Has anyone measured the voltage coming out of the signal line when the Allen / Bradley’s are plugged into the 12v 500ma?


For our team, The Rev Color Sensor V2 worked perfectly. Its a bit hard to program it since we used I2C to talk to the sensor.