Wiring it up, in the right order
Battery to switch to hub to motors — and the encoder port mistake that ruins autonomous.
By the end you can
- Wire a robot in the correct order, from battery to mechanisms
- Explain why a motor's power and encoder must share a port number
- Wire a complete drivetrain in the simulator with zero inspection errors
On this page · 6 sections
Wiring has an order. Follow it and problems are obvious; skip around and you end up chasing a fault through a finished robot.
The order
-
Battery to the main switch. Nothing else gets wired until this exists. The switch is how you (and field staff) kill the robot instantly; the 20A fuse in the battery lead is what protects against a short circuit.
-
Main switch to the Control Hub. One XT30 lead into the hub. If you have an Expansion Hub, it needs its own 12V feed too: the usual way is a short XT30 cable from the Control Hub's spare XT30 port to the Expansion Hub, or a power distribution block after the switch. Either way, all power still passes through the main switch.
-
Motors. Power cable and encoder cable, both to the same numbered port. See below, because this is where teams lose autonomous.
-
Servos. Lowest port numbers first, and write down which is which. You will need those names in code.
-
Sensors. I2C sensors on separate buses where possible (bus 0 already holds the Control Hub's built-in IMU). Digital sensors on digital ports.
-
Route and secure everything. Cable ties, away from moving parts. A cable that can be pinched by a lift will eventually be pinched by that lift.
The encoder port rule
Each motor has two cables that plug into the hub:
- Motor power
- A two-pin cable that carries the current making the motor turn.
- Encoder
- A four-pin cable that reports how far the motor has turned.
They plug into separately numbered ports — and the numbers must match. Motor power in port 2 means encoder in port 2.
Mismatched numbers are silent and brutal
If power is on port 1 and the encoder is on port 2, everything looks fine. The motor turns. Telemetry shows encoder counts changing. But your code is reading a different motor's encoder.
TeleOp usually still feels normal. Autonomous drives the wrong distance, or a lift runs into its hard stop, and you spend an evening blaming your PID constants. Check the port numbers first — always.
Things that fail inspection
Check these before you leave for the event
- No main switch, or a switch mounted where it cannot be reached.
- More than one robot battery, or a second power source feeding anything the robot controls.
- Exposed conductors, or a battery not securely mounted.
- Power that does not pass through the main switch.
The Passing electrical inspection lesson covers the full list.
Now wire one
Build a complete four-motor drivetrain below. The battery, main switch, and Control Hub are already placed and correctly powered — add the motors and wire them.
Remember: each motor needs both cables, on matching port numbers.
Wiring challenge
Wire a four-motor drivetrain
Add four drive motors and connect each one's power and encoder to matching ports. The inspection report must be clear of errors.
Requirements
- Four drive motors, power and encoder connected0/4
Try breaking it on purpose
Once it passes, deliberately move one encoder to the wrong port number and watch what the inspection report says. Recognising that error on screen makes it much easier to spot on a real robot at 9pm the night before a meet.
Powering the Expansion Hub in the simulator
Each hub has a Battery in port and a Power out port. Wire the Expansion Hub's Battery in to the Control Hub's Power out — REV's usual daisy-chain — or straight to the main switch. Either passes, as long as the power comes through the switch.
Next
Your robot is wired. The next unit looks at what is on the end of those cables: how DC motors, gearboxes and encoders actually work, and how to choose and power servos. When something stops working, the troubleshooting lesson has the diagnostic order that finds a fault in minutes instead of hours.
Sources and further reading
- REV: XT30 power cable — power in and out of each hub
- FIRST Robot Wiring Guide — power distribution, strain relief and switch placement
- REV: Encoder basics
- Game Manual 0: Wiring Guide
Finished this lesson?
Mark it complete to track your progress.