In this guide, you’ll learn how to wire an electric bike hub motor from scratch.
We cover key e-bike components (battery, controller, motor, throttle) and how to assemble the wiring harness. Topics include choosing proper wire gauge, color-coding phase and sensor leads, and throttle wiring.
Safety is emphasized: install a main fuse near the battery positive terminal.
These steps help intermediate DIYers build or repair their e-bike’s electrical system.
Featured Summary
Identify components: Battery, controller, hub motor, throttle, display, sensors.
-
Wire gauge & fuse: Use thick power wires (10–14 AWG) for battery/controller and 24–26 AWG for sensor/throttle leads. Install a high-current fuse close to the battery positive.
-
Battery–Controller: Connect battery red (positive) and black (negative) to the controller’s power inputs. Ensure polarity is correct.
-
Controller–Motor: Match phase wires (often blue, yellow, green) and hall sensor wires (red=+5V, black=GND, yellow/green/blue signals).
-
Throttle & sensors: Wire the 3-pin throttle (red +5V, black GND, yellow signal). Connect brake-lever cut-offs (2-wire) and PAS if available.
-
Connect & secure: Solder or crimp connections, use heat-shrink tubing and tape for insulation. Bundle wires neatly with zip-ties.
-
Test thoroughly: Check continuity and polarity before powering. On first power-up, verify the motor spins smoothly and throttle responds. Troubleshoot any errors (e.g. swap hall wires or throttle leads) as needed.
Key Components and Planning
Major E-Bike Components
An electric bike’s wiring harness links the battery, controller, hub motor, throttle, and sensors.
The battery is a DC power source (typically 36–48 V). The controller regulates current to the motor. The hub motor (rear or front wheel) contains three phase wires and usually hall sensor wires for smooth commutation.
The throttle (handlebar-mounted) controls speed, often a 3-wire hall-effect device. Brake levers and a PAS (pedal assist) sensor provide safety cutoffs and assist signals. Understanding each part simplifies wiring.
Battery and Controller (Power Connections)
Wire the battery to the controller with heavy-gauge wires. Use red (+) and black (–) cables; 10–12 AWG is common for 36–48 V systems.
Always include a fuse or circuit breaker on the positive battery lead. This protects against short-circuits and fires. The fuse should sit very close to the battery terminal.
Controllers often have two red wires for the battery: both should connect (one may be for a power switch). For safety, always unplug or turn off the battery when the bike is not in use.
Hub Motor Wiring (Phase and Hall)
A brushless hub motor typically has three thick phase wires plus five sensor wires.
The phase wires carry power: they are usually color-coded (often blue, yellow, green) and sized ~12–14 AWG.
The thinner Hall sensor wires (24–26 AWG) provide rotation feedback. These are commonly 5V (red), GND (black), and three signal wires (often blue, green, yellow). (Some motors add a 6th wire for an internal speed or temperature sensor, which can be left unconnected if unused.) Always match these wires to the controller’s corresponding plug.
Incorrect phase or hall wiring can prevent the motor from running or cause jitter. Figure: A brushless hub motor’s wire harness. Notice the three colored phase wires (blue, green, yellow) and the 5-wire Hall sensor bundle. These connect to the controller for power and position sensing.
Throttle, Brakes, and PAS
The throttle usually has three wires: +5V (red), ground (black), and signal (yellow or green). Some throttles also have an LED power wire (not always used).
The controller typically has a matching 3-pin plug. A hall-effect throttle requires separate power, ground, and signal wires. (Potentiometer throttles are rarer and need only two or three wires depending on controller type.) Brake levers with cut-off switches use two small wires (often red and black) to ground the throttle signal when engaged.
These connectors are optional; the motor will run without them, but installing them adds safety. Similarly, a pedal-assist sensor (PAS) plug may provide cadence/power-cut signals. Identify each plug on the controller and wire accordingly. The controller documentation or color-guide helps match each connector correctly.
Understanding Hub Motor Wiring
Phase Wires
The three phase wires (often colored differently) must connect to the controller’s corresponding outputs. The order doesn’t matter for running, but swapping two phases will reverse direction. Typical colors are blue, yellow, green. You may see A/B/C labels on motor or U/V/W on controllers. Use a wire stripper and solder or heavy crimp to join matching wires. After connecting, insulate each with heat shrink.
Hall Sensor Wires
Inside many hub motors, Hall sensors track rotor position. These wires are low-current (thus finer gauge). Usually there are 5 wires: Red (+5V), Black (GND), Yellow, Green, Blue (sensor outputs). The controller has a matching 5-pin plug. It’s crucial to match colors or pinouts exactly. If colors differ, you may need to identify +5V and GND first (red/black) and then trial-match the three signals. If a controller offers a 6th wire for a speed sensor, leave it alone if your motor has only 5 wires.
Wire Gauge and Connections
Use thicker wires for power. For example, 12 AWG copper is commonly rated ~20–30 A and suits 36–48 V, 250–750 W e-bikes. Lower-power (~250–500W) systems may use 14–16 AWG for motor leads. Thinner 24–26 AWG wire is adequate for sensor, throttle, brake, and display leads. Always ensure the main battery and motor wires are sized for your system’s maximum current.
Controller Connections Explained
Battery to Controller (Power Leads)
Connect the battery pack to the controller’s power input: red to +, black to –. Use high-current cables (10–14 AWG) and secure the connections. Insert a fuse on the positive lead. Many DIYers mount a bolt-on fuse holder or use a solid-link breaker near the battery terminal. Confirm that battery voltage matches the controller rating. Tighten all terminal screws, and double-check polarity: reversing wires can damage the controller.
Motor to Controller (Phases and Halls)
Match each motor phase wire to the controller’s output plugs (often plug-and-play with bullet connectors). If connectors differ, splice and secure them. Then connect the Hall sensor harness: plug the 5-pin Hall connector into the controller. If the plug doesn’t match, ensure red wire goes to +5V pin and black to ground pin; then connect the three signal wires. Once everything is plugged in, coil any excess wire and use zip-ties to keep it tidy.
Throttle and Controls

Mount the throttle on the handlebar and route its 3-wire cable to the controller’s throttle port. Connect red to +5V (often fused internally), black to GND, and yellow/green to the throttle signal pin. If your throttle has an LED power wire, it plugs into a “lights” or “+5V” output on the controller (optional).
Attach brake cut-off switches: each brake lever cable has two wires. Plug them into the controller’s brake connectors (usually labeled E-Brake). These act as normally-closed switches: pressing the lever opens the circuit, signaling the controller to cut motor power. Also connect PAS (pedal assist) sensor wires if you have a cadence or torque sensor. Finally, any display or speedometer wires plug into their respective ports.
Building the Wiring Harness
Planning and Tools
Before cutting any wire, plan your harness layout.
Position the battery and controller on the frame. Measure wire lengths from each component to the controller, allowing slack for steering movement. Label or mark wires if needed.
Tools needed: wire strippers, crimpers, soldering iron (or jumper connectors), heat shrink tubing, electrical tape, zip-ties, and a multimeter.
For high-current joints, soldering is recommended for reliability. Heat-shrink tubing (or liquid electrical tape) provides insulation over each joint. Crimp connectors can be used for plug-and-play parts (but be sure to cover crimp joints with heat-shrink too).
Assembling Connections
Cut cables to length and strip about 5–10 mm of insulation from each end. For phase wires and battery leads, either crimp on heavy-duty bullet connectors or solder the joints.
A common approach: solder then cover with at least 2 layers of heat-shrink tubing. Thinner wires (hall sensors, throttle) can be crimped with small connectors or soldered. Always solder/bend wires to relieve stress before insulating. After each connection is made, wrap it with glue-lined heat shrink (shrinks firmly around the joint) or multiple wraps of electrical tape. This prevents shorts and adds mechanical strength. Use silicone-filled connectors or dielectric grease for connections exposed to moisture, if your bike will see wet conditions.
Securing the Harness
Route wires along the frame tubes, following existing cable paths if possible. Bundle them with zip-ties or cable clamps. Avoid sharp edges and moving parts (chainrings, forks). Check that no wires are pinched when turning the handlebars. It’s wise to leave some slack at the stem or in frame pivot points to prevent stretching. Neatly bundling wires not only looks professional but also prevents rattling and fatigue. Finally, tie any excess coiled wires near the controller or battery so they can’t snag.
Step-by-Step Wiring Instructions
Plan Your Layout
Sketch a simple diagram of component locations and wire routes. Inspect all connectors and make sure you have all parts (controller, battery, motor, throttle, etc). Prepare tools and safety gear (disconnect battery).
Mount Components
Secure the battery pack and controller to the frame. Many controllers mount under the down tube or on a rear rack. Ensure good ventilation and that cables can reach.
Connect Battery Cables
Wire the main positive (red) and negative (black) leads from the battery to the controller. Before finalizing, insert an appropriate fuse or breaker on the positive line. Double-check polarity one more time.
Connect Motor Phases
Join each motor phase wire (e.g. blue→blue, green→green, yellow→yellow). Solder or crimp and insulate each connection. Connect the motor’s Hall sensor plug to the controller’s matching socket.
Connect Throttle and Controls
Plug the throttle’s 3-pin lead into the controller. Attach brake switch leads and PAS sensor if available. Ensure the throttle wire colors align (+5V, GND, signal).
Verify and Secure
Before powering up, use a multimeter to check for shorts (no connection between + and –) and confirm continuity on key wires. Tighten all connectors. Secure the bundle with zip-ties along the frame. Cover any remaining exposed copper with tape or shrink wrap.
Initial Testing
With the bike elevated so wheels spin freely, reconnect the battery and turn on the system. Lightly twist the throttle: the motor should spin smoothly in the correct direction. Test the brake switches (motor should cut when brakes are squeezed) and PAS if applicable. If something doesn’t work, re-check wiring color matches and connector pins.
Testing and Troubleshooting
Check Voltages
Use a multimeter to confirm the battery voltage and the presence of +5V on the throttle wire. When you twist the throttle, the signal wire voltage should rise (typically ~1V at zero to ~4V at full throttle).
No Motor Response
If the throttle produces voltage but the motor doesn’t spin, ensure the controller is receiving power and that all phase wires are solidly connected. A spinning motor without throttle input may indicate a throttle miswire or safety switch engagement.
Motor Hum or Cogging
This may mean the hall sensors or phases are mismatched. Double-check the Hall sensor wire order; try rotating the plug one pin if the order is unknown. For sensorless controllers, motor may start jerkily at very low speeds.
Fuses or Breakers
If a fuse blows immediately, disconnect and inspect for shorts. Check that no bare wires are touching metal and that polarity is correct.
Brake Switches
If the motor cuts out as soon as you apply throttle, a brake switch may be stuck or miswired (check that the brake wires aren’t inadvertently grounded).
By methodically testing each function, you can isolate any wiring mistakes. Keep documentation of your connections for future reference.
Advanced Tips and Best Practices
Label Wires
For complex builds, mark each wire end (e.g. using colored tape or stickers). This simplifies future troubleshooting or upgrades.
High-power Upgrades
If you plan to increase voltage or current (e.g. swapping to a 1000W motor or 72V battery), upsizing your fuse and wire gauge is critical.
Temperature Sensors
Some motors include a built-in NTC (thermistor). If present, connect it to the controller’s temp sensor input for automatic cut-off on overheating.
Weather Protection
Use waterproof connectors or conformal coating on the controller PCB. Tuck the controller in a dry location. Dry connections deter corrosion.
Maintenance
Periodically check wire insulation, especially at bends or clamps. Re-tighten any terminals after initial use. Lubricate or dust-off connectors if exposed.
Professional References
Consult controller wiring diagrams or manufacturer specs for color codes (if using a specific brand). Forums and manuals often provide pinouts for generic controllers.
By following this comprehensive wiring procedure, you’ll have a robust e-bike harness ready for use. A well-built wiring harness not only powers your bike reliably but also ensures safe operation. Always proceed with caution when dealing with high-current systems, and double-check every connection.