← Home
Docs/Hardware/Assembly & Wiring

Assembly & Wiring Guide

Assembling the vehicle involves 3D printing the open-architecture chassis, mounting the hardware, inserting socketed modules into the labeled female headers on the EVDrive PCB, clamping motor wires into screw terminals, and connecting the keyed sensor harnesses.

Follow these steps in sequence to ensure correct component orientation and secure connections.


0. 3D Printing & Chassis Preparation

Before wiring the electronics, prepare your mechanical platform:

  1. Get the CAD files: Get the original chassis files from Chassis Downloads Page or design your own version.
  2. Slicing recommendations:
    • Filament: PETG or Tough PLA (PETG provides superior impact strength).
    • Infill: 35% – 45% (Gyroid or Grid pattern) to dampen stepper motor vibration.
    • Walls / Perimeters: 4 to 5 perimeters (minimum 1.6mm thickness) for strong screw threads.
    • Layer height: 0.20mm. Print flat with no supports needed.
    • Brim: If your print warps then use a brim to help hold it flat on the bed.
  3. Mounting Motors & Drive Hardware:
    • Fasten the dual NEMA 17 pancake stepper motors using screws.
    • Glue the 12mm ball caster into the rear socket.
    • Slide your wheels onto the motor axles and secure them.
  4. Screw in front bumper and chassis extensions
    • Screw the front bumper or pusher attachment and chassis extensions into the front mounting holes.
    • Optionally screw in the battery and general top mounting plate extensions if needed.
  5. Place PCB into the chassis
    • Insert the PCB into the chassis and align holes with standoffs.
    • Screw in wires into the screw terminals.

1. Socketing the Modules

TMC2209 Stepper Drivers (U3 & U4)

  • Verify module orientation carefully: StepStick modules can be inserted backwards if not checked, which will damage the driver IC.
  • Identify the pin labels on the bottom of the TMC2209 module: locate GND and DIR.
  • Align them with the GND and DIR silkscreen labels printed beside each driver socket on the EVDrive board (U3 is Motor A / Left, U4 is Motor B / Right).
  • Adhere the small aluminum heatsinks included with the drivers onto the top of the main ICs.

ESP32-S3 DevKit (U2)

  • Orient the DevKit board so the USB-C ports face toward the outer edge of the PCB for convenient cable access.
  • Port Selection: The official ESP32-S3-DevKitC-1 provides two USB-C ports. Connect your cable to the UART port (typically the left port) for firmware flashing and Serial Monitor debugging. The secondary port is native USB/OTG.
  • Firmly seat the pins into the dual female headers. Ensure all pins align before applying even downward pressure.

MPU-6050 Gyro Module (U1)

  • Insert the MPU-6050 into the dedicated 8-pin center socket.
  • Ensure the axis indicator arrow printed on the breakout board points toward the front of the chassis (the forward driving direction).

2. Stepper Motor Wiring (J11 & J12)

Motor phase connections use dedicated 4-pin screw terminals (J11 for Motor A / Left, J12 for Motor B / Right). Bare or ferruled motor wire leads clamp directly into the terminals with a precision flathead or Phillips screwdriver.

This screw-clamped connection provides robust wire retention, ensuring motor leads will not pull loose or disconnect during vehicle acceleration, braking, or transport.

The terminal blocks are routed in this exact pin order:

Pin 1: M1B∣Pin 2: M1A∣Pin 3: M2A∣Pin 4: M2B\text{Pin 1: } \mathbf{M1B} \quad\vert\quad \text{Pin 2: } \mathbf{M1A} \quad\vert\quad \text{Pin 3: } \mathbf{M2A} \quad\vert\quad \text{Pin 4: } \mathbf{M2B}

Identifying Motor Coil Wires:

Standard 4-wire NEMA 17 stepper motors have two internal phase coils:

  • Coil 1 (Phase A): Pair of wires connected to M1A (Pin 2) and M1B (Pin 1).
  • Coil 2 (Phase B): Pair of wires connected to M2A (Pin 3) and M2B (Pin 4).

To verify wire pairs using a multimeter:

  1. Set the multimeter to continuity or low resistance mode (200Ω scale).
  2. Measure across pairs of motor leads. The two wires belonging to the same internal coil will measure a small resistance (~2 to 5 ohms) and trigger the continuity beep.
  3. Clamp one coil into terminals Pin 1 (M1B) and Pin 2 (M1A), and the second coil into terminals Pin 3 (M2A) and Pin 4 (M2B).

Direction Adjustment: If a motor rotates backwards relative to forward vehicle movement, either swap one coil pair in the terminal block (e.g., swap wires in Pins 1 and 2) or invert the motor's DIR state in software.


3. Setting Driver Vref (Motor Current)

Before driving under load, verify the reference voltage (Vref) via the onboard trimpot on each TMC2209:

  • Setting Vref too low results in insufficient torque, causing motors to lose synchronization and skip steps under acceleration.
  • Setting Vref excessively high causes pancake motors to overheat rapidly and places unnecessary current demand on the battery pack.
  • Measure between the trimpot wiper screw and board GND using a multimeter DC voltage scale, tuning to recommended current ratings for your specific motor (typically ~0.65V to 0.85V for standard pancake steppers).

4. Mounting & Wiring AS5600 Encoders

The AS5600 measures absolute magnetic field angle using a diametrically magnetized circular magnet positioned at the center of the wheel axle.

Keyed JST-XH Interconnects:

Custom RH Circuits AS5600 encoder breakout boards utilize keyed 4-pin JST-XH connectors that connect directly to headers J1 (Encoder A: GPIO 1 & 2) and J2 (Encoder B: GPIO 41 & 42) on the main board via a dedicated wiring harness (for example, mapping right wheel to J1 and left wheel to J2 in your code):

Encoder PinEVDrive Port PinFunction
VCCPin 1+3V3 logic supply
GNDPin 2Ground reference
SCLPin 3I2C Clock (J1 uses GPIO 2, J2 uses GPIO 42)
SDAPin 4I2C Data (J1 uses GPIO 1, J2 uses GPIO 41)

The keyed JST connection ensures correct pin orientation and locks mechanically into place, making installation clean and preventing intermittent disconnects during runs or transit.

Encoder Direction & Overflow Handling: If an encoder increments in reverse during forward motion, invert the reading sign in software. Because the sensor outputs a 12-bit angle (0 to 40950 \text{ to } 4095), software must account for rollover across the 4095↔04095 \leftrightarrow 0 boundary when tracking total wheel displacement.

Magnet Alignment:

  1. Secure the circular diametric magnet into the center bore of the motor or wheel axle using a small drop of adhesive. The magnet must rotate concentrically on-axis without visible wobble.
  2. Fasten the encoder breakout board to the chassis encoder bracket, maintaining an axial air gap of approximately 1.0mm to 1.5mm between the magnet face and the sensor IC.

5. Power & Voltage Converters

CAUTION: VERIFY POWER POLARITY BEFORE CONNECTION Always verify polarity using a multimeter before attaching battery packs or tightening terminal screws. On all KF301 power terminal blocks (J4, J5, J9), Pin 1 is Ground (-) and Pin 2 is Positive (+). While the PCB incorporates P-channel MOSFETs (Q1 and Q2) for reverse-polarity protection, high-current reverse transients can stress protection components. Always verify positive (+) and negative (-) leads prior to powering the system.

  1. Buck Converter (5V Logic Supply):
    • Connect battery input to the LM2596 buck regulator module.
    • Adjust the onboard potentiometer until the output measures 5.0V DC.
    • Connect the regulated 5V output into terminal block J5 (5V IN) (Pin 1 = GND, Pin 2 = +5V).
    • This rail feeds the onboard 3.3V LDO regulator and is protected by 2A fuse F2.
  2. Boost Converter (12V Motor Supply):
    • Connect battery input to the XL6009 boost regulator module.
    • Adjust the regulator output to 12.0V DC.
    • Connect this output into terminal block J4 or J9 (12V IN) (Pin 1 = GND, Pin 2 = +12V).
    • This rail feeds the stepper driver power stages and is protected by 5A fuse F1.

6. Power Diagnostics & Voltage Troubleshooting

The board includes status indicator LEDs for each power rail:

  • D2 (12V Rail): Illuminates when the motor supply rail is active.
  • D4 (5V Rail): Illuminates when the 5V logic input rail is active.
  • D3 (3.3V Rail): Illuminates when the onboard AP2112K LDO regulator is active.

Diagnostic Note: If a power LED turns off unexpectedly or fails to light, immediately disconnect battery power. Inspect for wiring shorts, check polarity, and verify continuity on fuses F1 and F2.

Battery Discharge vs. Driver Vref

When diagnosing unexpected low voltage or voltage sag under load, understand the primary root cause:

  • Low Voltage Most Likely Means Depleted Batteries: A low voltage reading or substantial voltage drop under motor load does not automatically indicate an issue with driver Vref. In the majority of cases, low voltage indicates that the battery cells are discharged, weak, or exhibiting high internal resistance under load. Always measure open-circuit battery voltage and load voltage first, and test with freshly charged cells before adjusting driver settings.
  • Excessive Vref (Driver Overcurrent): If the battery pack is confirmed fully charged and healthy, but the voltage rail still drops drastically (e.g., dropping 2V to 3V) immediately when the motors are armed in code and rebounds immediately upon disarming, the TMC2209 driver current may be set too high. Reduce the Vref trimpot slightly to bring current draw within recommended operating limits.

7. Pre-Run Inspection Checklist

Complete these verification steps before conducting powered track tests:

  1. Verify TMC2209 driver orientation aligns GND and DIR with silkscreen markings.
  2. Confirm 5A (F1) and 2A (F2) mini fuses are firmly seated in their respective clips.
  3. Verify polarity with a multimeter before connecting supply leads to J5 (5V) and J4/J9 (12V). Pin 1 is GND, Pin 2 is Positive (+).
  4. Power logic and motor rails; confirm indicator LEDs D2 (12V), D3 (3.3V), and D4 (5V) are illuminated.
  5. Verify that motor leads are securely clamped in terminal blocks J11 and J12 with no exposed stray wire strands.
  6. Connect keyed JST encoder harnesses to J1 and J2, confirming secure mechanical latching.
  7. Connect USB cable to the UART port and upload the test sketch to confirm sensor communications.
  8. Mount any optical pointer, dowel, or flag to the chassis clamp if you plan to measure target stopping distances during testing.