Issues with the 42EF-D2MPAK-F4 Sensor

Hey, I’m a member of Team Mercury, 1089, and this year we’ve had some complications wiring up the 42EF Photoelectric sensor that was provided in the FIRST Choice selection. We fully understand how to wire it (brown=+12V, blue=GND, White/Black Signal 12V=inverse of each other) and where to wire each up to. However the signal wires output 12v, too high for the DIO port on the RIO to handle (Max input voltage 5.25V roughly). To circumvent this we had attempted to rout the signal wire through a logic-level converter sold by Sparkfun: (The converter is advertised for 5V to 3.3V, however, the high and low values can be defined based on an input voltage on the HV pin and the LV pin, allowing 12V to 5V conversions). The issue came once we wired the sensor and the Sparkfun together. The Sparkfun does convert the voltage from 12V to 5V (Yay!), however, it converts it to a constant 5V (oh…), which isn’t the best for reading a sensor’s output in a DIO port. We decided to scrap the Sparkfun’s entirely at this point, instead opting for using an Opto-coupler/Isolator to do the trick, which should work and if not just making our own resistor divider. Has anyone else hooked up this sensor successfully? If so how did you guys do it?

I haven’t personally used this sensor, but we have used a different 12V sensor in 2017. We did a resistor divider like you mentioned. Just use 3 identical resistors to get it down to 12V/3 = 4V. Simple solution is the best IMO.

You can use the “Voltage Detectors” that puglsy14 found in this post. They are more convenient to use than individual resistors.