Smart Car Controller  1.0
Library to manage a two wheeled robotic vehicle (DC Motors)
Confirming Motor Setup

The first part of setup is to use the MotorTest example sketch to ensure that the motors are turning in the correct direction and the encoders are working correctly.

MotorTest allows control of the vehicle motors using the Serial Monitor through the command line interface to invoke test the functions (type ? for help text listing the functions).

Independently commanding the motors to move in a Forward and Reverse direction provides confirmation that they are wired correctly. If they rotate the wrong (opposite) direction, simply reverse the wiring between the speed controller and motor or between the processor I/O pins and the speed controller.

The encoder feedback can also be tested now - you are looking for the software to print counts for both encoders when the motors are running.

The encoder feedback is printed every second, so the maximum number of pulses per second is worked out by observing the counts and recording the lowest of the two motor counts reported at the maximum speed setting (PWM 255). It is normal for the counts to be different due to differences in the electrical and mechanical characteristics of the two motors.

At this stage it is also worth experimenting and noting 2 additional PWM settings:

  • The lowest viable PWM setting that will keep a motor turning when it has already started. This is worked out by starting from a high value and slowly reducing until the motor no longer turns. This value is a good starting point to set the low value for PID control limits in the next setup stage.
  • The PWM value needed to start a motor. Internal mechanical and electrical friction means that there is a minimum threshold below which the PWM is insufficient to get a motor started. This value is a lower bound for the 'kicker' setting in the next configuration step.

Once again, these values may be different for each motor and in this case you need to pick the highest of the two PWM values.

Next: Determining Calibration Parameters