Skip to content

CAN system

Estimated time: 30 minutes

This page describes how to set up the CAN system for communicating with the motors and encoders from your computer.

CANivore assembly

Tools:

  • WAGO tool
  • Electrical tape
  • Zip ties

Assemble the CANivore using the following procedure:

  1. Locate the CAN cables in the cable kit: one with a female connector and one with a male connector
  2. Connect the female CAN cable to the green (G) and yellow (Y) slots on the CANivore
  3. Attach the male CAN cable to the termination resistor using 2 inline wire connectors
  4. Cover the resistor with electrical tape and secure the tape with a zip tie

See video (2x speed):

Tip

Press down on the white spring mechanism with the WAGO tool to open the wire slot:

Then, insert the wire while the slot is held open.

Tip

Double-check the polarities of the CAN wires (green and yellow):

Tip

Avoid leaving exposed metal, as shown with the green wire in the photo below:

Tip

Gently tug on each of the 6 new connections to make sure they are secure.

CANivore setup

First install Phoenix Tuner X on a Windows computer following the official instructions. We have previously tested both of these installation methods:

Note

Windows is only needed for initial setup of the motors and encoders. Our main codebase runs on Ubuntu.

After successfully installing Phoenix Tuner X, connect the CANivore USB-to-CAN adapter to your Windows computer. Then, open Phoenix Tuner X and enable the "CANivore USB" toggle:

The CANivore should now appear in the Phoenix Tuner X:

Click the checkbox next to the lightbulb to select the device, then click the up arrow in the top-right corner to open the firmware update dialog:

In the dialog, click the button to update the device to the latest firmware:

Note

There are multiple ways to update firmware in Phoenix Tuner X. If you are prompted to upload a file, try again using the method described above.

After the firmware update is complete, the border should turn green:

You can now assign a meaningful name to the device, such as "Drivetrain".

Next, click the "LIC" button in the bottom-right corner and use the dialog to activate your Phoenix Pro license:

Note

We use a "CANivore bus" Pro license, which enables all devices connected to an activated CANivore to access Pro features like field-oriented control. The "single device" license activates only one device.

Tip

The official CANivore setup guide can also be a helpful resource for this section.

Tip

The Phoenix Tuner X software is maintained by CTR Electronics. Their contact information can be found here.

Motor setup

Please connect and set up one motor at a time using the following procedure:

  1. Locate the two CAN wires on each motor: one with a male connector and one with a female connector
  2. Attach the termination resistor to the female connector
  3. Attach the CANivore to the male connector
  4. Make sure the connector polarities are correctly aligned (yellow to yellow, green to green)

See video (2x speed):

The resulting CAN bus should look like this:

flowchart LR
    C("CANivore") <--> M("Motor") <--> R("Resistor")

Once connected, the motor should appear in Phoenix Tuner X:

Update the motor's firmware using the same procedure as with the CANivore:

The border should turn green after the firmware update:

Then, use the following table to assign the motor's device ID and device name accordingly:

Caster No. Motor No. Motor Name
1 1 Front Right Steer
2 Front Right Drive
2 3 Front Left Steer
4 Front Left Drive
3 5 Back Left Steer
6 Back Left Drive
4 7 Back Right Steer
8 Back Right Drive

Repeat this process to set up all 8 motors.

Note

Our convention is to list steer motors (odd numbers) before drive motors (even numbers):

Steer motor Drive motor

Note

For reference, this will be the eventual layout of the motors and encoders within the frame:

Encoder setup

Please connect and set up one encoder at a time, following a process similar to the motor setup. Connect the encoder to the CANivore and the termination resistor. See video (2x speed):

The resulting CAN bus should look like this:

flowchart LR
    C("CANivore") <--> E("Encoder") <--> R("Resistor")

The encoder should appear in Phoenix Tuner X:

Update the encoder's firmware using the same procedure as before:

After the firmware update, the border should turn green:

Use the following table to assign the encoder's device ID and device name:

Caster No. Encoder No. Encoder Name
1 1 Front Right
2 2 Front Left
3 3 Back Left
4 4 Back Right

Repeat this process to set up all 4 encoders.

CAN bus wiring

After completing the firmware setup, connect the CAN wires of all devices in the following order:

flowchart LR
    C("CANivore") <--> C1("Caster 1") <--> C2("Caster 2") <--> C3("Caster 3") <--> C4("Caster 4") <--> R("Resistor")

Within each caster module, the motors and encoders should be connected in the following order:

flowchart LR
    subgraph C1 ["Caster 1"]
        M1("Motor 1 (steer)") <--> E1(Encoder 1) <--> M2("Motor 2 (drive)")
    end
    C("CANivore") <--> M1
    M2 <--> C2("Caster 2")
flowchart LR
    subgraph C2 ["Caster 2"]
        M3("Motor 3 (steer)") <--> E2(Encoder 2) <--> M4("Motor 4 (drive)")
    end
    C1("Caster 1") <--> M3
    M4 <--> C3("Caster 3")
flowchart LR
    subgraph C3 ["Caster 3"]
        M5("Motor 5 (steer)") <--> E3(Encoder 3) <--> M6("Motor 6 (drive)")
    end
    C2("Caster 2") <--> M5
    M6 <--> C4("Caster 4")
flowchart LR
    subgraph C4 ["Caster 4"]
        M7("Motor 7 (steer)") <--> E4(Encoder 4) <--> M8("Motor 8 (drive)")
    end
    C3("Caster 3") <--> M7
    M8 <--> R("Resistor")

Note

We recommend connecting the devices in the same order we used. However, the devices can actually be connected in any order, as long as the sequence starts with the CANivore and ends with the termination resistor.

See video (4x/16x speed):

Note

In the video above, the motors are arranged as 2, 1, 4, 3 instead of the expected order (1, 2, 3, 4) because the wires are facing upwards. Once the casters are installed in the frame later, the wires will face inwards and the motor numbers will align with the expected order.

After everything is connected, double-check that all 12 devices appear in Phoenix Tuner X:

Motor testing

For each caster module, start by testing the steer motor:

  1. Open the steer motor in Phoenix Tuner X
  2. Set the control mode to "DutyCycleOut"
  3. Click the red "Disabled" button to change it to "Enabled"
  4. Set the "Output" to a small value, such as 0.1

See screenshot below:

This should cause the caster to steer:

Note

If you decide to experiment with other control modes, be careful! The default min/max limits are very high for some modes. You might want to firmly hold down the module or secure it in place just in case.

Next, test the drive motor by following the same procedure as for the steer motor:

This should cause the wheel to turn:

Repeat this process to test all 8 motors across the 4 modules.

Note

If you hear abnormally loud gear grinding sounds while the wheel is turning, it’s likely due to gear misalignment. Please revisit Step 8 in the caster module assembly guide and make sure the wheel mounts were installed properly.

Tip

Forgot which motor is which? You can click the "Blink" button in Phoenix Tuner X to make the selected motor's lights blink rapidly.

Tip

We recommend physically labeling each motor with a sticker showing its number.

Encoder testing

For each caster, test its encoder by manually steering the module while monitoring the encoder position under "General Signals" (look for the "Position" reading and click "Refresh" to update). Start by steering until the encoder position reading is close to 0:

Once the encoder position is close to 0, steer the module through one full revolution. See video (2x speed):

After clicking "Refresh" again, the encoder position should now read close to 1:

To test further, steer the module for several more revolutions and verify that the encoder reading accurately reflects the number of revolutions. Repeat this process for all 4 encoders.

Tip

If your encoder detects less rotation than expected, the encoder magnet might be loose. This can occur if the Loctite 609 retaining compound has not fully cured yet.

Tip

To avoid having to repeatedly refresh the position reading, you can also use the plotting functionality:

Setup complete

After you have verified that all of your motors and encoders are functioning as expected, your drive system should be ready for installation into the frame. Please disconnect all wires before proceeding. You will reconnect them in the same way later, after the modules are installed in the frame.

Note

Sealed lead-acid (SLA) batteries should not be left in a discharged state, as it can degrade the battery. Please charge the battery after use. Refer to the Usage page for charging instructions.