I have a DC motor (MTR11_200) encoder rotating at 100 RPM with and encoder(EH_30_M) which sending 200 PPR how to fix the DC motor to turn at specific angle using this information?
how to fix the DC motor to turn at specific angle using this information?
You develop a small control system. From the "neutral" position the demand to move can be translated into a demand to increment "so-many" pulses. So, you turn on the motor and count the pulses (digitally) and when the required pulse count is met, you turn off the motor. However, there may be overshoot so you will need to reverse your motor direction (possibly using a H bridge) to bring it back to the target position demanded.
This then becomes a problem that may be solved with a 3 term (PID) controller should the position continue to oscillate and there are many algorithms to solve this with usually the simplest being that as you approach the target count you slow down the speed of the motor.
What you are asking about is known in this industry as a servo motor. The motors are often equipped with an encoder to the motor shaft if the control is one of a rotary one. (Note that there are plenty of servo motor applications where the encoder may be of a different type. For example for a linear actuator the motor turns a lead screw which in turn creates linear motion and a linear encoder monitors the linear position.
Servo motors are optimized in several ways to make them suitable for the application. One aspect is that they must be designed to tolerate being in a static position while current is applied to their windings. Servo motors also carefully specify their rotational inertia because this must be matched to the rotational inertia of the load to provide the most stable operation.
Another whole part of this field is the driver electronics used to operate servo motors. This is usually divided into two parts. A driver module translates control signals to the voltage and current required to drive the windings of the servo motor. The second part is the servo controller. This contains the PID algorithm to send commands to the driver module to make the servo motor go to a specific position or to run at a particular rotational velocity. The controllers are normally fully programmable so that they can be characterized to the motors, loads and the speeds at which the components of the system can accelerate and stabilize once at a position or velocity.
The input to the controller in operational mode will typically be in the form of initialization to find a home position and then commands to go to a particular position or run at a particular velocity. Normally this is all done in units of encoder pulses but some controllers have the capability to convert physical system units to encoder pulses on the fly as commands are fed to the controller.
For example, you can convert pulses into angle, first. 200 increments equals to 360 degrees, or -100/99 pulses equals to -180/ approx. +180 degrees.
SetpiontPulses =(200/360)*Angle_degrees; // setpoint in pulses
You may use modulo function for calculation:
SP-PV = (SetpiontPulses - MeasuredPulses + 300)%200 - 100;
where % is a modulo operator. What you'll get is the shortest angle difference (setpoint-measured) expressed in pulses -100 to 99, total of 200 increments, as 0 is also a valid position.
You feed this difference into a PID controller. You would also need an encoder with zero marking and a counter module.