Project: Servo Motor Controller - OUWECAD/MOWE GitHub Wiki

Table of Contents

Project Description
Available CLI Commands


Project Description

This project provides two-axis servo motor control for projects and experiments involving gimbals or individual motors. The provided firmware works with continuous rotation servos (0-360) and can be installed on any HO01R1 module to make it act as a servo controller. P3 TX (port 15 up) is the PWM output of first motor and P4 TX (port 16 up) is the PWM output of second motor. They can be controlled independently. A couple of CLI commands are provided to control the motors and setup the speed. Baudrate should be set to 921600.

In continuous rotation servos, the pulse width controls motor speed. The firmware can be easily adjusted, however, to work with angle-based servos where pulse width controls motor angle.

Available CLI Commands

  • motor port start: will enable PWM output for the motor. Note that the motor starts with about 25% speed.

  • motor port stop: will disable PWM output for the motor. Note that other commands will not work until you start the motor again.

  • motor port min: will run the motor at minimum speed, i.e., stop the motor without disabling PWM.

  • motor port maxCW: will run the motor at maximum speed clockwise.

  • motor port maxCCW: will run the motor at maximum speed counter clockwise.

  • motor port speed x: will run the motor at x speed rpm. The speed can be a positive or negative floating point number.

Notes:

  • Port can be p3, P3, p4, or P4.
  • You can define minimum and maximum pulse width (in msec) and motor full scale (in rpm) in the header file aos_pd_tim.h.
  • PWM frequency is set to 50 Hz and can be changed in aos_pd_tim.c.
  • Your motor might need some pulse width calibration. If you run the motor port min command and your motor is still spinning, adjust the motor potentiometer until the motor halts.