Servo motor main constraints
- Duty Cycle of Servo motor
- Operating Frequency or PWM Period of Servo
I am going to use the below servo motor in this tutorial. Its a small servo motor and requires only 5 volts for operation. Current consumption of this motor can drastically increase when moving loads.
Tower pro servo motor
PWM period given for tower pro servo motor is 20 ms(in frequency domain 50 Hz). Operating frequency is 50 Hz(in time domain 20 ms). To rotate the arm head one must have to generate a PWM signal having period of 20 ms and signal duty cycle in between 0 to 2 ms.
- Tower Pro Micro Servo SG90 9g moves to 90 degree on duty cycle of 1.5 ms.
- Moves to 180 degree on duty cycle of 2 ms.
- Moves to 0 degree on duty cycle of 1 ms.
One can easily rotate the arm at fixed angle by just varying the duty cycle. To move servo motor arm at 135 degree duty cycle will be 1.75 ms. Speed of arm can be controlled by changing the duty cycle very slowly. If duty cycle increases 2 ms servo arm will not come back to its position it will go out of order. In some servo motors if the duty cycle increases the maximum limit it will have no effect on arm, those particular servos not rotate their arm on duty cycles greater than their specifications.
Main 8051 microcontroller servo motor project
Tower pro servo motor has three wires colored red, yellow, black(brown). Apply +5 volts to red wire. Make black(brown) ground. Apply PWM(Pulse Width modulated) signal to yellow wire. Circuit diagram of 8051 servo motor project is given below.
8051 microcontroller servo motor – Main project working
How pwm signal is generated using 8051 microcontroller?
PWM is a signal whose cycle has a high period for some time and low period for some time. It is same like digital signal which has high and low waves. In PWM method the high wave of the signal is varied. This high wave is know as PWM duty cycle(see the below picture).
The above link is very important to understand the code. If you don’t go through the above tutorial you will be unable to understand the code below. Tower Pro servo SG90 9g has duty cycle from 1 ms to 2 ms. I calculated values for these delays. Made function for each value. When ever delay is needed i call the function.
The code in while(1) function is determining whether the push button is pressed? if pressed delay functions are called. These delay functions are actually PWM for the servo motor.
Filed Under: 8051 Microcontroller, Microcontroller Projects
Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.