In almost any robotics project one of the key components is precise motion, this is where servo motor is needed. It is a device that translates a command in a precise position or an angle of an actuator. In this project, I'll show how to build a servo motor using a regular DC motor with a gearbox and a Hall-sensor position encoder.
The setup consists of a DC-motor with a gearbox, an incremental encoder is attached to the shaft of the motor, it provides angular position. The controller calculates shaft velocity and feeds (angle, velocity) to a feedback loop in order to get a control voltage which is set by PWM.
Overall schema of the setup is depicted on the image below:
Let's simulate our system and see if we can get the desired control and find the parameters of the PID-regulator.
The motor can be modeled by the following equations:
where
- U - input voltage
- L - rotor inductance
- R - rotor coils resistance
- k*w - back EMF term proportional to the angular velocity (w)
where
- J - the momentum of inertia of the rotor
- B - friction due to rotation
- TM - torque of the motor
- TL - torque of the load
- m - the mass of the load
- r - radius of the shaft
Using this python script we get a simulation showing the relation between the voltage, angular velocity, and the position of the shaft. (Also check out other applications of the ode-solver used here)
Comments
Please log in or sign up to comment.