![]() |
Smart Car Controller
1.0
Library to manage a two wheeled robotic vehicle (DC Motors)
|
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:
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