Skip to content
Programming, Controls & Sensors·Lesson 21 of 51

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

An overview of the three physical interfaces FRC sensors use and the trade-offs of each.

Sign in to track progress, earn XP, and save lessons.

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.

Digital I/O (DIO)

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.
  • Quadrature encoders, 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.

Analog Input

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.

CAN bus

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.

Choosing an interface

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.

Key takeaways

  • 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.

Lesson quiz

Required

Answer all 3 questions correctly to complete this lesson.

1.On the roboRIO, which type of port is best suited for a sensor that reports a continuously varying value as a voltage, such as a potentiometer or analog ultrasonic rangefinder?

2.How is the CAN bus physically wired on an FRC robot?

3.Each DIO and analog port on the roboRIO breaks out three pins. What are they?

Answer every question to submit.