I would like to control the speed of a DC motor directly from the Arduino Uno. The DC motor has a relative encoder with Channel A and B to indicate the direction of rotation. Also, would position control be possible? How should I go about coding this?
The way I plan on controlling the motor is two signals: one is a PWM, other is ground. The signals are reversed in the program to change the direction of rotation.
To control the speed, would I need to take the derivative from the encoder data?
I am currently looking at PID and encoder library mentioned on the Arduino site. The PID controller examples I see use an analog input with an analog PWM output. This would not work for forward and reverse direction. Do I need the motor to rotate in both directions for speed control?
Please advise. Thank you.