position control of shaft of mitsumi m25n dc motor with encoder using PID

I want to bring back the motor to its set point position if its shaft is moved by hand in anticlockwise or clockwise direction :confused: . I have attached a video for more reference that I found on you tube.

Here is more information about motor:

Link for video:

So, what part do you need help with?

dhanashri:
I want to bring back the motor to its set point position if its shaft is moved by hand in anticlockwise or clockwise direction

What have you tried? When you run your program what happens?

Please post your program. And please post your code between tags so we don't have to download the and

your code looks like this

and is easy to copy to a text editor.

Getting a DC motor to a specific position is not trivial.

...R

The encoder attached to motor has 2 terminals giving pulses as the motor moves. the direction(clockwise or anticlockwise) and the rotation angle is supposed to be calculated using these two pulses.I tried writing code with the help of state machine. But every time pulse count for a single rotation is different. It varies with the speed by which we rotate the motor shaft by our hand. for fast variation count is 40, and for slow it is 1537 :confused:

dhanashri:
But every time pulse count for a single rotation is different. It varies with the speed by which we rotate the motor shaft by our hand. for fast variation count is 40, and for slow it is 1537 :confused:

You must be doing something wrong but you have not posted your program so how can I help?

...R