Home
Species

BLDC Development Status Report - September 6, 2025

Session Focus: SimpleFOC Library Integration and Troubleshooting
Hardware: RP2040-Zero + SimpleFOCMini + 2204-260KV + AS5600 Encoder
Status: Hardware Validated, Software Integration Issues Identified


Session Summary

Extended debugging session focused on integrating AS5600 encoder with SimpleFOC library for closed-loop BLDC control. While hardware functionality was successfully validated, persistent SimpleFOC library integration issues prevent proper motor operation.


Hardware Validation - CONFIRMED WORKING

AS5600 Encoder Integration

Status:FULLY FUNCTIONAL

  • Testbench Setup: 3D printed fixture successfully positions AS5600 over 2204 motor shaft
  • I2C Communication: Direct I2C reads work flawlessly on GP28/GP29
  • Magnet Coupling: Properly positioned diametrically magnetized magnet on motor shaft
  • Position Readings: Smooth, accurate angle measurements (0-6.28 radians)

Validation Code (PROVEN WORKING):

Wire.beginTransmission(0x36);  // AS5600 address
Wire.write(0x0C);              // Angle register
Wire.endTransmission();
Wire.requestFrom(0x36, 2);
int raw = ((Wire.read() & 0x0F) << 8) | Wire.read();
float angle = raw * 0.00153398;  // Converts to radians correctly

Motor Control Hardware

Status:CONFIRMED FUNCTIONAL

  • Power System: 9V 2A supply + 2200µF capacitor working correctly
  • Driver Board: SimpleFOCMini v1.1 responds to control signals
  • Motor Response: 2204-260KV motor energizes and holds position as commanded
  • Thermal Management: Motor stays cool (<25°C) when properly controlled

Pin Configuration - VALIDATED

Motor Control: GP0,1,2,3 (phases A,B,C + enable)
AS5600 I2C: GP28 (SDA), GP29 (SCL) + 3V3, GND

SimpleFOC Library Issues - BLOCKING PROGRESS

Critical Problem: FOC Auto-Calibration Hangs

Symptom: motor.initFOC() consistently freezes system

  • Behavior: Code execution stops, no serial output, motor energized but stuck
  • Recovery: Requires manual RP2040 bootloader reset (BOOT button)
  • Consistency: 100% failure rate across multiple attempts
  • Impact: Prevents proper electrical angle calibration

Motor Control Dysfunction

Symptom: Motor holds position but won’t execute velocity commands

  • Command Response: Serial commands processed correctly
  • Sensor Integration: Sensor: readings update properly (2.09→3.18→2.31)
  • Motor Behavior: Actively holds position (not free-spinning)
  • Velocity Output: Actual: 0.0 consistently, regardless of target
  • Indicates: Control loop running but not translating to motor movement

Library Integration Disconnect

Direct I2C vs SimpleFOC Comparison:

  • ✅ Direct I2C: Perfect sensor communication, smooth readings
  • ❌ SimpleFOC MagneticSensorI2C: Appears to work but doesn’t integrate properly
  • Conclusion: Library abstraction layer has compatibility issues

Failed Troubleshooting Attempts

Configuration Variations Tested

  1. PID Parameter Adjustment: Multiple gain combinations tested
  2. Control Mode Changes: Velocity, position, torque modes attempted
  3. Manual Calibration: motor.zero_electric_angle and sensor_direction set
  4. Sensor Initialization: Different SimpleFOC sensor class parameters
  5. Hardware Swapping: Multiple AS5600 boards tested (identical behavior)

Code Approaches Attempted

  1. SimpleFOC Standard Integration: Using MagneticSensorI2C class
  2. Custom Sensor Class: Attempted bypass of SimpleFOC sensor abstraction
  3. Minimal Configuration: Stripped down to essential parameters only
  4. Library Version Compatibility: Checked SimpleFOC API differences

Environmental Factors Ruled Out

  • Hardware Connections: Verified multiple times, swapped components
  • Power Supply: Stable 9V, adequate current capacity
  • I2C Communication: Proven functional with direct access
  • Motor Specifications: 2204-260KV confirmed correct type for application

Current Technical Status

What Works

  1. Hardware Platform: RP2040-Zero + SimpleFOCMini integration confirmed
  2. Sensor System: AS5600 encoder providing accurate position feedback
  3. Motor Hardware: 2204-260KV motor responds to electrical control
  4. Thermal Performance: System operates within safe temperature limits
  5. I2C Communication: Direct sensor access functions perfectly

What’s Broken

  1. SimpleFOC Calibration: Auto-calibration routine consistently hangs
  2. Velocity Control: Motor holds position instead of executing speed commands
  3. Sensor Integration: SimpleFOC library doesn’t properly use sensor data
  4. Control Loop: Disconnect between SimpleFOC commands and motor response

Root Cause Assessment

Primary Issue: SimpleFOC library integration incompatibility

  • Not Hardware: All components function correctly in isolation
  • Not Wiring: Direct I2C access proves connections are correct
  • Not Configuration: Multiple parameter combinations attempted
  • Likely Software: Library initialization or version compatibility problem

Recommendations for Next Session

Immediate Priorities

  1. SimpleFOC Documentation Research: Deep dive into library initialization requirements
  2. Working Example Analysis: Find confirmed working SimpleFOC + AS5600 examples
  3. Library Version Testing: Try different SimpleFOC library versions
  4. Alternative Approaches: Consider VESC, ESC32, or other BLDC control libraries

Alternative Paths

  1. Custom FOC Implementation: Bypass SimpleFOC entirely using direct motor control
  2. Different Library: Arduino-FOC, ESP32-FOC, or other implementations
  3. Commercial Controllers: VESC or ODrive integration
  4. Hybrid Approach: Direct I2C sensor + manual motor control

Questions for Investigation

  1. Does SimpleFOC require specific initialization sequence for RP2040?
  2. Are there known compatibility issues with SimpleFOCMini + RP2040-Zero?
  3. What does motor.shaft_velocity actually measure and when is it updated?
  4. Why does auto-calibration hang - is there a timeout or error condition?

Hardware Assets Ready for Next Session

Confirmed Working Components

  • RP2040-Zero microcontroller (with working I2C code)
  • SimpleFOCMini v1.1 driver board (responds to control signals)
  • 2204-260KV gimbal motor (appropriate resistance, good thermal behavior)
  • AS5600 encoder with magnet (accurate position feedback confirmed)
  • Power system (9V supply + capacitor, stable operation)

Test Code Available

  • Direct I2C AS5600 access (proven working)
  • SimpleFOC velocity test framework (serial commands, safety features)
  • Hardware validation routines (sensor tests, motor response checks)

Documentation Updated

  • Pin assignments confirmed (GP0,1,2,3 motor control, GP28,29 I2C)
  • Hardware specifications validated (resistance measurements, thermal limits)
  • Issue timeline documented (progression from working to problematic states)

Knowledge Gaps Identified

SimpleFOC Library Understanding

Admitted Limitation: Insufficient knowledge of SimpleFOC internal behavior

  • Assumed: Standard motor control theory would apply
  • Reality: Library has specific initialization and calibration requirements
  • Impact: Troubleshooting attempts were theory-based, not library-specific

Required Research Areas

  1. SimpleFOC initialization sequence for RP2040 + AS5600 combination
  2. FOC calibration requirements and why auto-calibration might fail
  3. Velocity control implementation in SimpleFOC and measurement methods
  4. Error handling and debugging features within SimpleFOC library

Session Handoff Notes

For Next Agent

Start Here: Hardware is confirmed functional, focus on SimpleFOC library integration Working Code: Direct I2C AS5600 test (proves sensor system) Problem Code: Any SimpleFOC velocity control attempts Key Insight: Motor actively holds position but won’t execute movement commands

Critical Files

  • SimpleFOC velocity test code (with safety features and serial commands)
  • Direct I2C sensor test (proven working reference)
  • Hardware validation results (thermal measurements, resistance values)

Timeline Context

  • August 31: Motor compatibility research, overheating discovery
  • September 5: AS5600 testbench completed successfully
  • September 6: SimpleFOC integration attempts, library issues identified

Status: Ready for SimpleFOC expertise or alternative BLDC control approach research.


End of Session Report - Hardware Platform Validated, Software Integration Requires Specialized Knowledge