I have a Pololu 131:1 geared brushed Dc motor with a 64 counts digital encoder. voltage is 12v and am using 4A from dual L298 H-bridge.
I want to move for precisely one revolution with the H-bridge and Arduino.
When i tried controlling the position with the encoder, the motor passes the final position with some error which i have failed to correct.
I donot know how to stop exactly at 360, I kindly need help?
Is this a quadrature encoder or a single channel 'tachometer' style encoder?
You will need to either implement some type of dynamic control system such as PID which can ramp up and down the speed based on the magnitude of error. So, when starting position is far from the final position, it will move quickly, but slow down as it approaches the final position.
Or for a more one-off type of purpose (meaning you are stopping and starting at the same positions everytime) you could just use a certain count to trigger slowing down or stoping.
Finally, have you tried using the brake feature of the L298?
It is a hall effect sensor which has two channel digital outputs. The specifications of the motor are Pololu - 131:1 Metal Gearmotor 37Dx57L mm 12V with 64 CPR Encoder (No End Cap)
[/quote] Finally, have you tried using the brake feature of the L298?
I have tried it but using maximum speed, the error is still like 90 degrees, which is too big. Using the smallest speed, it gives no error.
mamike:
I donot know how to stop exactly at 360, I kindly need help?
What control algorithm are you using currently?
The most certain and reliable approach would be to adopt a closed-loop control system, and PID would be the most obvious algorithm to use. With this approach you would configure the PID algorithm with the target position, and it would accelerate and decelerate the motor to achieve that. If you don't want / can't deal with the complexity of a full PID algorithm you could achieve similar effects by writing your own feedback algorithm to control the speed. Your target speed would be determined by the difference between current and target position. The motor power would be determined by the difference between current speed and target speed. It would take more code than using the existing PID library, and would not work as well, but would avoid you having to get your head around the complexity of PID and then figure out how to make PID do what you want.