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
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 has a built-in breaker and is the only thing standing between a short circuit and a very bad afternoon.
-
Main switch to the Control Hub. One XT30 lead. If you have an Expansion Hub, it gets its own lead from the switch — it does not draw power through the Control Hub.
-
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. 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 battery, or any auxiliary power source.
- Exposed conductors, or a battery not securely mounted.
- Power that does not pass through the main switch.
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.
Next
Your robot is wired. The next lesson covers what to do when it stops working — the diagnostic order that finds a fault in minutes instead of hours.