PWM vs CAN Control
Two control methods
Section titled “Two control methods”Motor controllers can be commanded two ways, and the choice affects wiring, capability, and debugging.
PWM (Pulse Width Modulation)
Section titled “PWM (Pulse Width Modulation)”With PWM, the roboRIO sends a single pulse signal to each controller over a 3-wire cable plugged into one of the roboRIO’s PWM ports (0-9). The pulse width (typically 1.0-2.0 ms) tells the controller how fast and which direction to drive.
Pros:
- Simple and easy to understand.
- Easy to troubleshoot - one controller per port.
- No device IDs to configure.
Cons:
- One wire run per controller (lots of wires).
- No feedback data comes back to the roboRIO over PWM.
- Limited to 10 controllers (the number of PWM ports).
WPILib recommends PWM as a starting point because it is less complex and easier to debug.
CAN (Controller Area Network)
Section titled “CAN (Controller Area Network)”CAN is a digital network that daisy-chains many devices on just two wires (CANH and CANL). The roboRIO, the PD, and every CAN motor controller share the same bus.
Pros:
- Far less wiring - one bus serves dozens of devices.
- Rich two-way data : the controller reports velocity, position, current, temperature, and faults.
- Advanced features : closed-loop control, motion profiling, current limiting, follower mode.
- Easier configuration through vendor tools.
Cons:
- Each device needs a uniqueCAN ID (set with Phoenix Tuner X for CTR, REV Hardware Client for REV).
- A single broken connection can take down everything downstream on the bus.
Which to choose?
Section titled “Which to choose?”Most competitive teams use CAN for motor controllers to unlock current limiting and telemetry, while sometimes using PWM for a simple device like an LED blinker driver. Beginners often start with PWM and migrate to CAN as they get comfortable.
Sources
Section titled “Sources”Key takeaways
Section titled “Key takeaways”- PWM sends one pulse signal per controller over a 3-wire cable to roboRIO ports 0-9 - simple but no feedback.
- CAN is a two-wire digital bus that daisy-chains many devices and returns rich telemetry.
- CAN unlocks current limiting, closed-loop control, follower mode, and far less wiring.
- Each CAN device needs a unique ID (set via Phoenix Tuner X or REV Hardware Client).
This lesson was adapted from learnfrc.com.
