Servo Motor Working Principle and Interfacing with 8051 Microcontroller

Servo motors are self-contained mechanical devices that are used to control the machines with great precision. These are found in many applications from toys to industrial automation.  There is various kind of motor, but servo motors are especially designed for specific angular position to control the machines. Usually the servo motor is used to control the angular motion among from 0° to 180° and 0° to 90°. The servo motor working principle based on the PWM (pulse width modulation) pulses.


Servo Motor
Servo Motor

Servo Motor Interfacing with 8051 Microcontroller

A Servo motor is one of the most commonly used motor for precise angular movement. The advantage of using a servo motor is that the angular position of the motor can be controlled without any feedback mechanism. The servo motors are usually used in commercial and industrial applications. They are also widely used as in drive systems such as robots, aeroplanes etc.

Interfacing Servomotor with 8051 Microcontroller
Interfacing Servo Motor with 8051 Microcontroller

Hobby servo motor working principle and operation is very simple, it consisted three wires where two of them (Black and red) used to provide power and the third wire is used to provide control signal. Pulse Width Modulated (PWM) waves are used as control signals and the angular position is definite by the width of the pulse at the control input. In this article, we are using a servo motor having angle of rotation from 0-180° and angular position can be controlled by varying the duty cycles among 1ms to 2ms.

Here the servo motor interfacing with 8051 microcontroller, the black wire connected to the ground pin and the motor get the power from the red wire. The control of servo motor connected port0 of 8051 microcontroller. The 11.0592MHz crystal oscillator is used to provide the clock pulsed to the microcontroller and 22pf ceramic capacitors used to stabilize the operation of crystal. 10KΩ and 10uf capacitor is used to provide the power on reset to the microcontroller.

Controlling a Servo Motor with Angle rotations

Servo motor working principle mainly depends upon duty cycles. It uses Pulse Width Modulated (PWM) waves as control signals. The angle of rotation is resolute by the pulse width of  the control pin. Here the servo motor used for angle of rotation from 0 to 180 degrees. We can control the precise angular position by varying the pulse among 1ms to 2ms.

Controlling a Servo Motor with Angle Rotations
Controlling a Servo Motor with Angle Rotations

Servo Motor Programming With angular rotations

#include<reg51.h>
Sbit  servomotor_pin=P0^5;
Void delay (unsigned int);
Void servo_delay  (unsigned int);
Void main()
{
Servomotor_pin=0x00;
Do
{
// turn to 0°
Servomotor_pin=0x01;
Sevo_delay(50);
Servomotor_pin=0x00;
Delay(1000);
//turn to 90 degrees
Servomotor_pin=0x01;
Sevo_delay(82);
Servomotor_pin=0x00;
Delay(1000);
//turn to 180 degrees
Servomotor_pin=0x01;
Sevo_delay(110);
Servomotor_pin=0x00;
Delay(1000);
While(1);
}
}
Void delay(unsigned int a)
{
Unsigned int p;
For(p=0;p<a;p++)
For(p=0;p<250;p++);
}
Void servo_delay (unsigned int a)
{
Unsigned int p;
For(p=0;p<a;p++)
For(p=0;p<250;p++);
}

Servo Motor Working Principle

The servo motor working principle mainly depends upon the ‘Fleming left hand rule’.  Basically servo motors are adapted with DC motors, a position sensor, a Gear reduction, and an electronic circuit. The DC motors achieve powered from a battery and run at high speed and low torque. We assembled shaft and gear connected to DC motors then we can increase and decrease the motor speed gradually.

The position sensor senses the location of the shaft from its fixed position and sends the information to the control circuit. The control circuit decodes the signals accordingly from the position sensor and compares the actual location of the motors with the preferred position and accordingly controls the direction of rotation of the DC motor to get the necessary position. Generally the servo motor requires 4.8V to 6 V DC supply.

The Servo Motor Controlling by a Serial Port Commands

The main intention of this project is to control servo motor by using a personal computer. It needs a single control line from the microcontroller and serial input line, from the personal computer serial port to send commands to the circuit. The timing source is provided by the crystal oscillator. Designed servo motor circuit interfaced to the computer with help of the serial cable and level shifter then open ‘Hyper Terminal’ software in the PC as to select the comport of the computer.

Servo Motor Controlling by a Serial Port Commands
Servo Motor Controlling by a Serial Port Commands

Once the commands are sent from the personal computer (PC) to the microcontroller through the hyper terminal with a level shifter, the microcontroller obtains this data and compares them with the predefined data and generates corresponding signals to activate the motor driver to drive it at the desired speed. Many microcontroller projects developed based on servo motor such as balancing robots, runway helicopters and so on.  We can use servo motor for security purpose by interfacing with wireless camera as we can possible to control camera 360 digress.

Self Balancing Robot

The self balancing robot is capable of balancing itself with the help of the servo motors. This robot has assembled using with structural, mechanical and electronic components that produces visibly unbalanced platform that is highly disposed to tipping in one alignment. The wheels of the robot are capable of independent rotation in two ways, which driven by a servo motor. Information about the angle of the device relative to the ground will be obtained from tilt sensors on the device.

Self Balancing Robot
Self Balancing Robot

The tilt sensor may be an accelerometer, gyroscopic sensor, or IR sensor (to distance measure to the ground). The sensors sends information to the control unit, which will process the feedback using a basic proportional, integral, derivative (PID) algorithm to generate compensating position control signals to the servo motors in order to balance the device.

Servo Motor Applications

  • It is used in Press machines for cutting the pieces to size
  • It is used in the Sugar filling station
  • It is used in Labeling applications
  • It is used Packing system with random timing function
  • It is used Used in aeroplanes

Advantages of Servo Motor

  • If a motor gets heavy load the driver will increase the current to the motor coil as its efforts to rotate the motor. Mainly, there is no out-of-step condition.
  • High-speed operation is possible by the servo motors.

This is all about servo motor working principle and  interfacing with 8051 microcontroller.Furthermore, for any technical help regarding this article or electronics projects that are designed using interfacing devices such as RTC, OLED, flash memory, customized LCD, touch screen displays, and etc. You can approach us by giving your comments in the comment section below.

Comments are closed.