How to interface Servo Motor with AVR Microcontroller (ATmega16)

Servo motors find huge applications in industries in the field of automation, control & robotics. The servo motors are well known for their precise control and work on the principle of servo mechanism. The servo motors can be made to run at precise angle using PWM. The PWM (pulse width modulation) is the basic working principle behind a servo motor (For more details about PWM refer Phase correct PWM mode). This article explores the interfacing of servo motor with ATmega16. Also to know more about servo mechanism see Interfacing Servo Motor with 8051.
How to interface Servo Motor with AVR Microcontroller (ATmega16)
There are different types of servos available in the market. This article bounds its scope to interfacing a commonly available servo, widely used by hobbyist with ATmega16. Such a servo consists of three wires positive supply, ground and a control signal. Unlike other motors, Servo motors don’t require any driver. When a PWM signal is applied to its control pin the, the shaft rotates to a specific angle depending on the duty cycle of the pulse.
In the above figure the ON time for pulse is 1ms and off time pulse is 18ms this rotates the shaft to -90 degree. Similarly if the on time of pulse is 1.5ms and the off time of pulse same the servo rotates to 00 and if ON time pulse increases to 2ms it rotates to +900. This gives a complete 180 degree rotation. The motor maintains its position for every corresponding signal.
How to interface Servo Motor with AVR Microcontroller (ATmega16) schematic
Note: Before starting with servo first check the lowest ON pulse which rotates servo to -90 degree and the highest ON pulse which rotates the servo to +90 degree while keeping the OFF pulse constant. While experimenting with VS2 servo motors it was found that for -90degree the ON pulse required was 50us and OFF pulse was 18ms. And for +90 degree the ON pulse was 2050us and keep the OFF time same as 18ms. Things may differ on the type and quality.

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top