Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Servo motor and AVR Atmel Atmega 16

1,874 views

Published on

Robo India in this presentation is explaining the theory and working principles of Servo motor.

How to use a servo motor with AVR family microcontroller Atmel Atmega 16.

Your queries and views are welcomed, we are found at-
website: http://roboindia.com
mail- info@roboindia.com

Published in: Engineering
  • Be the first to comment

Servo motor and AVR Atmel Atmega 16

  1. 1. ROBO INDIA http://roboindia.com
  2. 2. • Servo motor is nothing but a simple motor based on servo mechanism. • Servomechanism is a closed loop feedback systems uses +ve feedback to control its motion. • With the help of servomechanism, servo motor give precise control of angular position.
  3. 3. • Motor have a dedicated encoder • Simplest servomotors use position-only sensing via a potentiometer Click here to visit -ROBO INDIA
  4. 4. TCCR1A|=(1<<COM1A1)|(1<<COM1B1)|(1<<WGM11); //NON Inverted PWM TCCR1B|=(1<<WGM13)|(1<<WGM12)|(1<<CS11)|(1<<CS10); //PRESCALER=64 MODE 14(FAST PWM) ICR1=4999; //fPWM=50Hz (Period = 20ms Standard). DDRD|=(1<<PD4)|(1<<PD5); //PWM Pins as Out Click here to visit -ROBO INDIA
  5. 5. TCCR1A|=(1<<COM1A1)|(1<<COM1B1)|(1<<WGM11); • COM1A1 = 1 • COM1B1 = 1 • WGM11 = 1 1 0 1 0 0 0 1 0 Click here to visit -ROBO INDIA
  6. 6. TCCR1A|=(1<<COM1A1)|(1<<COM1B1)|(1<<WGM11); • WGM10 = 0 //Used in Waveform Generation • WGM11 = 1 //Used in Waveform Generation • COM1A1 = 1 • COM1B1 = 1 1 0 1 0 0 0 1 0 Click here to visit -ROBO INDIA
  7. 7. • The COM1A1,COM1A0,COM1B1 and COM1B0 control OC1A and OC1B 1 0 1 0 0 0 1 0 Click here to visit -ROBO INDIA
  8. 8. TCCR1B|=(1<<WGM13)|(1<<WGM12)|(1<<CS11)|(1<<CS10); • WGM12 = 1 • WGM13 = 1 • CS11 = 1 • CS10 = 1 0 0 0 1 1 0 1 1 Click here to visit -ROBO INDIA
  9. 9. TCCR1B|=(1<<WGM13)|(1<<WGM12)|(1<<CS11)|(1<<CS10); • WGM10 = 0 // TCCR1A • WGM11 = 1 // TCCR1A • WGM12 = 1 // TCCR1B • WGM13 = 1 // TCCR1B 0 0 0 1 1 0 1 1 Click here to visit -ROBO INDIA
  10. 10. • WGM10 = 0 // TCCR1A • WGM11 = 1 // TCCR1A • WGM12 = 1 // TCCR1B • WGM13 = 1 // TCCR1B Click here to visit -ROBO INDIA
  11. 11. • FAST PWM Mode • TOP Value = ICR1 //Timer count from 0 to ICR1 Click here to visit -ROBO INDIA
  12. 12. TCCR1B|=(1<<WGM13)|(1<<WGM12)|(1<<CS11)|(1<<CS10); CS12 = 1 : CS11 = 1 : CS10 = 0 0 0 0 1 1 0 1 1 Click here to visit -ROBO INDIA
  13. 13. TCCR1B|=(1<<WGM13)|(1<<WGM12)|(1<<CS11)|(1<<CS10); • Prescaler is 64. • Means16MHz/64 = 250khz (4 uS period) 0 0 0 1 1 0 1 1 Click here to visit -ROBO INDIA
  14. 14. 𝑓 𝑝𝑤𝑚 = 𝑓 𝑐𝑝𝑢 𝑛(1 + 𝑇𝑂𝑃) Click here to visit -ROBO INDIA
  15. 15. 𝑓 𝑝𝑤𝑚 = 𝑓 𝑐𝑝𝑢 𝑛(1 + 𝑇𝑂𝑃) fpwm = 20ms (50 Hz) fcpu = 16000000Hz n = 64 TOP = 4999 // RESULT Click here to visit -ROBO INDIA
  16. 16. 𝑓 𝑝𝑤𝑚 = 𝑓 𝑐𝑝𝑢 𝑛(1 + 𝑇𝑂𝑃) fpwm = 20ms (50 Hz) fcpu = 16000000Hz n = 64 TOP = 4999 // RESULT Click here to visit -ROBO INDIA
  17. 17. 𝑓 𝑝𝑤𝑚 = 𝑓 𝑐𝑝𝑢 𝑛(1 + 𝑇𝑂𝑃) fpwm = 20ms (50 Hz) fcpu = 16000000Hz n = 64 TOP = 4999 // RESULT Click here to visit -ROBO INDIA
  18. 18. 𝑓 𝑝𝑤𝑚 = 𝑓 𝑐𝑝𝑢 𝑛(1 + 𝑇𝑂𝑃) fpwm = 20ms (50 Hz) fcpu = 16000000Hz n = 64 TOP = 4999 // RESULT Click here to visit -ROBO INDIA
  19. 19. TCCR1A|=(1<<COM1A1)|(1<<COM1B1)|(1<<WGM11); //NON Inverted PWM TCCR1B|=(1<<WGM13)|(1<<WGM12)|(1<<CS11)|(1<<CS10); //PRESCALER=64 MODE 14(FAST PWM) ICR1=4999; //fPWM=50Hz (Period = 20ms Standard). DDRD|=(1<<PD4)|(1<<PD5); //PWM Pins as Out Click here to visit -ROBO INDIA
  20. 20. • Servo Angle 0 need 0.388ms(388uS) pulse Value of OCR1A = 388us/4us = 97 • Servo Angle 90 need 1.264ms(1264uS) pulse Value of OCR1A = 1264us/4us = 316 • Servo Angle 180 need 2.140ms(2140uS) pulse Value of OCR1A = 2140us/4us = 535 Click here to visit -ROBO INDIA
  21. 21. To share your views and queries please write us- Website: http://roboindia.com Email- info@roboindia.com Click here to visit -ROBO INDIA

×