Skip to content

How Sensors Talk to the roboRIO: DIO, Analog, and CAN

learnfrc.com
learnfrc.comAuthor
Veer Bajaj
Veer BajajMaintainer

Every sensor on an FRC robot reports through one of a few electrical interfaces, and knowing them helps you wire and program correctly the first time.

The roboRIO has 10 built-in DIO ports (0-9). On the roboRIO these ports operate at 5V logic : a ‘high’ signal is ~5V and ‘low’ is 0V (the input threshold reads high above ~2.0V and low below ~0.8V). DIO is used for:

  • Switches (limit switches, beam breaks) that are simply open or closed.
  • Quadratureencoders, which send two fast on/off pulse trains.
  • Duty-cycle (PWM) absolute encoders , where the width of a repeating pulse encodes position.

Every DIO port has a built-in pull-up resistor between power and signal, so a normally-open switch wired between signal and ground reads true (high) when open and false (low) when pressed — a detail that trips up many rookies.

The roboRIO has 4 built-in analog input channels (0-3) that read a continuous voltage from 0-5V with 12-bit resolution. Analog sensors output a voltage proportional to what they measure — for example, an analog potentiometer or an analog absolute encoder where 0V = 0 degrees and 5V = one full rotation.

The CAN (Controller Area Network) bus is a single daisy-chained, terminated pair of wires that connects many smart devices: motor controllers (Talon FX, Spark MAX/Flex), the Power Distribution Hub/Panel, the Pigeon 2.0 IMU, the CTRE CANcoder, and CAN distance sensors. Each device has a unique ID. CAN is powerful because:

  • A device can do its own processing and report rich data (position, velocity, temperature, current).
  • You add devices without using up roboRIO ports.
  • Modern CTRE devices support CAN FD for higher bandwidth.

The trade-off is bus utilization and latency : too many devices polled too fast can saturate the bus, so frame/update rates are configurable.

Use DIO for switches and most encoders, analog for simple potentiometers, and CAN for anything that benefits from on-device smarts or that you want to read without wiring back to the roboRIO. As a rule of thumb, prefer the interface the manufacturer designed the sensor for, and always confirm a sensor’s logic level is compatible before wiring it to a 5V DIO port.

  • The roboRIO offers 10 built-in DIO ports, 4 built-in analog inputs, and a CAN bus; pick the interface a sensor was built for.
  • roboRIO DIO ports are 5V logic with built-in pull-ups, so an open normally-open switch reads true and a pressed switch reads false.
  • CAN devices do their own processing and report rich data, but the bus has finite bandwidth you must budget.

This lesson was adapted from learnfrc.com.