Skip to main content

Program Flow

Basic Workflow:

Firmware is present in affbotics_software/firmware/avg/BLDC_driver/src/main.cpp

  • BLDC driver board communicates using Modbus over RS485
  • The Modbus I registers 0x2000 can be Writen with a value from -200 to 200 for setting the velocity of the motor.
  • Where -ve values spin the motor in the opposite direction
  • comment the line #define IAM_LEFT for Right motor or leave it uncommented for Left motor

Am a Geek:

  • Modbus Register address and SLAVE_ID can be changed by changing #define values
  • Motor PID values can be tweaked if needed using motor.PID_velocity.P, motor.PID_velocity.I, motor.PID_velocity.D
  • change the phase angle motor.P_angle.P and direction motor.initFOC(0, Direction::CW); if required.