Gray Matter LogoGray Matter Workshop

Mechanism Setup

KEY CONCEPT

Mechanism Setup - Verifying Hardware Configuration

Before writing any control code, verify that your motors and encoders work correctly: right direction, right zero position, basic movement.

↳ TAKEAWAY

Always verify hardware setup before adding control algorithms. Otherwise you will be debugging control issues when the problem is hardware configuration.

Warning: Stop Code Before Hardware Setup

Before performing hardware setup tasks, stop any running code and turn ONthe "CANivore USB" setting in TunerX. This ensures proper communication with physical hardware during testing and configuration.

Steps:Stop any running robot code → Open TunerX → Go to CANivore settings → Enable "CANivore USB"

Setup Steps by Mechanism

📝 Important Note: Encoder Replacement

If you replace your encoder with a new one, you will need to repeat these setup steps to ensure proper direction and zero position configuration.

1️⃣ Encoder Direction

With the device facing you, as shown in the picture below, rotate the arm counterclockwise and check that the encoder position increases.

Expected Behavior:

  • • Counterclockwise rotation → Position increases
  • • Clockwise rotation → Position decreases
Unit circle showing counterclockwise rotation direction
Counterclockwise rotation direction

🔧 Implementation Sequence

1

Rotate Counter-Clockwise

Manually rotate the mechanism counter-clockwise and observe if the encoder position increases.

2

Fix Direction if Needed

If position goes down instead of up, go to "Info" → "Sensor Direction" → press "Apply" button to invert the encoder direction.

3

Zero the Encoder

Put arm to zero position, then in TunerX go to "Info" → press "0 encoder" button → press "Apply" button.

2️⃣ Verifying Motor Setup

Next, check that the motor spins the right way. With positive voltage, it should spin counterclockwise. You can test this in Tuner, with the device facing you as in the picture.

Counterclockwise rotation direction for motor verification

🔧 Motor Direction Verification

Positive Voltage Test

Apply +6V to your motor and observe movement direction.

Expected:Positive voltage should move the mechanism in the "positive" direction (counter-clockwise for arms).

Encoder Consistency

Verify encoder readings match motor movement.

Expected: Positive motor voltage → positive encoder change, negative motor voltage → negative encoder change.

✅ Ready for Control

Once your mechanism moves in the correct direction and provides accurate feedback (encoder for arms, motor consistency for flywheels), you're ready to add control code.

💡 Next Step: PID control. It uses this sensor feedback to reach target positions or velocities automatically.

CHECKPOINT · 5 ITEMS