Mini-Project 4: A Switchable Channel for Lights and Vision
Wire and code the REV PDH switchable channel to power LEDs, a fan, or a vision camera on demand.
Sign in to track progress, earn XP, and save lessons.
The REV PDH (REV-11-1850) has one special switchable low-current channel (15A continuous) that you can turn on and off from code. This is perfect for things that should not always be live: addressable LED strips for signaling, a cooling fan, or a Limelight/camera that you want to power-cycle without re-deploying. (The CTRE PDP does not expose a software-switchable channel; on a PDP you would use a separate relay/switch.)
Wiring: Run the load's positive lead from the PDH's switchable channel output (clearly silk-screened on the board) and the negative to any PD negative WAGO. Use 18 AWG for a sub-5A load like an LED strip and respect the 15A channel ceiling. As a low-current channel it must be protected per R620 (ATC/ATO fuse 10A or lower for these channels).
Code it (WPILib):
PowerDistribution pdh = new PowerDistribution(1, ModuleType.kRev);
// Turn the channel on (e.g. when a game piece is acquired)
pdh.setSwitchableChannel(true);
// Turn it off (e.g. when empty)
pdh.setSwitchableChannel(false);
A real example: a status light tied to robot state.
@Override public void robotPeriodic() {
boolean haveGamePiece = intakeSensor.get();
pdh.setSwitchableChannel(haveGamePiece);
}
Now an LED strip on the switchable channel lights up the instant the intake sensor sees a game piece, giving the driver and human player a clear visual cue from across the field, with zero extra relays.
A power-cycle helper for a flaky camera:
public void rebootCamera() {
pdh.setSwitchableChannel(false);
// re-enable 2 seconds later via a Command
new edu.wpi.first.wpilibj2.command.WaitCommand(2.0)
.andThen(() -> pdh.setSwitchableChannel(true))
.schedule();
}
Gotchas:
- Treat the switchable channel as OFF until your code drives it true. If your light or camera never comes on, you probably never called
setSwitchableChannel(true). - Do not put anything safety-critical (radio, roboRIO, RSL) on a switchable channel. The radio and roboRIO should be powered through the PD's dedicated fused outputs, never through a switched path.
- Confirm the channel actually toggles by watching the load and by reading current draw on the dashboard from Mini-Project 3.
This tiny project teaches a powerful pattern: hardware behavior driven directly by robot state, with no extra wiring beyond a single switched lead.
Key takeaways
- The PDH has exactly one software-controllable switchable channel (15A continuous); the PDP has no software-switchable channel.
- pdh.setSwitchableChannel(true/false) toggles it from code.
- Never put the radio, roboRIO, or RSL on a switchable channel; reserve it for LEDs, fans, or cameras you want to power-cycle.
Go deeper
Lesson quiz
RequiredAnswer all 3 questions correctly to complete this lesson.
1.How many independently switchable output channels does the REV Power Distribution Hub (PDH) provide for software control of devices like lights or a vision camera?
2.Which WPILib PowerDistribution method turns the PDH's switchable channel on or off?
3.What is the maximum current rating of the PDH's switchable channel, which constrains what loads (lights, a vision coprocessor) you can put on it?
Answer every question to submit.