Wiring help with Ada Fruit IR Beam Break Sensors in DIO

So we just got these IR Beam Break Sensors from Ada Fruit and are now trying to hook them up in the DIO. Does anyone know how to connect them into the DIO of the Rio and how to bring power to the light part of these sensors?

The emitter (one with two conductors) needs to be wired to a 3v or 5v source.
You could steal 5v off the Rio or VRM (if you have one).

The detector side should wire to a DIO port on the Rio.

  • Red to 5v
  • Black to gnd
  • Yellow to signal

Treat code like a normal discrete input.

Note you’ll indicate a true value (logic high) when the detector side CANNOT see the Emitter (beam is broken). There is an internal pull-up resistor on the discrete input channels within the roborio.

Some info on the DIO ports of the Rio is here:

You should be able to pull +5V from another DIO (or even from the same one). You have to watch the total current draw from all these ports on the RIO, but should be fine if you just have one or two of these sensors.

1 Like

A word of warning, we had these on our robot last week at the Northern Lights regional. They worked great for us in our shop for weeks, but when we got to competition, they became a nightmare. They would detect fine in the pit, then we’d go out to the field, and suddenly wouldn’t trigger. After spending all of Thursday and Friday troubleshooting, I found a note here about venue lights giving off IR, so I glued plastic standoffs to the receivers to shroud them; finally they worked better (but still not perfect).

After this experience, we’ve since decided to ditch the IR and replace them with these CAN Time of Flight sensors. We heard good things about them and should have them hopefully tomorrow to integrate. Moral of the story, a good, reliable sensor is worth the added cost.

Would you expect the Rev 2M Distance sensor to have the same problem? 2m Distance Sensor - REV Robotics

We use a PWM wire (included in the KOP). Cut the male end off and separate the red, black, and white wires. Take the red wire from the PWM wire and solder it to the red wire from the transmitting side and the red wire from the receiving side (make a Y). Do the same with the black wires (make a Y). Solder the remaining white wires together.

Plug the female PWM cable into one of the DIO ports. Check the diagram on the rio to see which way to plug it in (black is ground).

1 Like

The PWF tof sensor and the REV sensor both use the same underlying technology (940nm class 1 IR laser). However, I would be more inclined to use the CAN connected sensor due to the issues with the I2C bus on the roborio.

Agreed, they have nearly identical STM32 ToF chips (the Rev senses up to 2M, the PWF senses up to 4M). But as mentioned, the PWF CAN interface will totally avoid the roboRIO I2C issues this year (and may clean up your wiring more if you have multiple sensors on your robot). If you do have the Rev sensor (or the I2C version of the PWF sensor), just make sure to use the MXP I2C port as mentioned in the link above.

1 Like

We’ve used these for 2 years in our indexers with no problems. Perhaps it has to do with the location and their likelihood of coming in contact with peripheral light. Definitely test them, and do it in a variety of lighting, but our experience has been good.

A shroud sounds like a good idea. We have typically drilled a hole in 0.25" polycarb and glued them to the other side, so we have a natural 0.25" deep shroud around the receiver.


The MXP I2C lines also appear to have issues, as discussed later in that thread. The best solution seems to be a coprocessor such as a raspberry pi or pi pico that handles the I2C transactions and reports data back via serial/NT/dio.

Ah good call, that’s my bad for not reading all the way through it (we just avoided I2C this year)

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.