The document provides information about using an Atmel 89S52 microcontroller to control servo motors. It includes sections about servo motors, the Atmel 89S52 microcontroller, and sample Keil code. The Atmel 89S52 has features like 8K bytes of flash memory, 256 bytes of RAM, timers/counters, and I/O ports that make it suitable for controlling servo motors. The Keil code section implies the document contains or references code written for the Atmel 89S52 in Keil software.
this presentation gives a clear idea of how the servo motor and servo drive working explained in detail and attached video have a clear idea of how servo motor works......enjoy, i hope you will like this.... :)
this presentation gives a clear idea of how the servo motor and servo drive working explained in detail and attached video have a clear idea of how servo motor works......enjoy, i hope you will like this.... :)
Excessive vibration issues in two pole electric motorsAdam Bron
The effects of electric motor failure may be very severe. In case of high speed motors one of most common problems is extensive vibration and its effects. Here we look into the problem to see if it's always related to motor only.
Servo Motors Adjust, is a company specialized in the repair and adjustment
of Servo Motor and special high revolution motors.
– We repair and revise motors from robots, Baldor servo motor, Baumuller, Bosch, Control
Techniques, Fanuc, Indramat, Lenze, Yaskawa, Tamagawa, Mitsubishi, Siemens, Elmo etc.
– Our highly specialized technical department covers all areas of industry, tools machines,
automotive, robotics, stamping and press, food and glass industry, printing and packaging,
textile, Paper Mills, etc..
– Our 24-hours messenger service allows us to quickly and efficiently receive and deliver
products.
– For special products, we have at customerʼs disposal motors and drives exchange, assigned
to reduce the inactivity period.
– When we receive a motor for itʼs repair, we include all details and test data in our
computerised system in order to have a historical technical data sheet.
Excessive vibration issues in two pole electric motorsAdam Bron
The effects of electric motor failure may be very severe. In case of high speed motors one of most common problems is extensive vibration and its effects. Here we look into the problem to see if it's always related to motor only.
Servo Motors Adjust, is a company specialized in the repair and adjustment
of Servo Motor and special high revolution motors.
– We repair and revise motors from robots, Baldor servo motor, Baumuller, Bosch, Control
Techniques, Fanuc, Indramat, Lenze, Yaskawa, Tamagawa, Mitsubishi, Siemens, Elmo etc.
– Our highly specialized technical department covers all areas of industry, tools machines,
automotive, robotics, stamping and press, food and glass industry, printing and packaging,
textile, Paper Mills, etc..
– Our 24-hours messenger service allows us to quickly and efficiently receive and deliver
products.
– For special products, we have at customerʼs disposal motors and drives exchange, assigned
to reduce the inactivity period.
– When we receive a motor for itʼs repair, we include all details and test data in our
computerised system in order to have a historical technical data sheet.
Institute of infrastructure technology research and management (IITRAM) Ahmedabad. This is the project report given to us in the control sytem lab. This is basically a Servo postion control. Here we are using PID controller.
A simple project on Obstacle Avoiding Robot is designed here. Robotics is an interesting and fast-growing field. Being a branch of engineering, the applications of robotics are increasing with the advancement of technology.
An automatic whiteboard cleaner is a device that is generally used to clean the board automatically with the help of a mechanically driven duster. By the use of this automatic whiteboard cleaner, we can save time and energy. It is a new technology that is generally used now a day. The principal object of the present automatic whiteboard cleaner is to provide an attachment for the whiteboard in the form of a power-driven erasing apparatus which can be set in operation by the throw of a switch, thus eliminating the drudgery of manually cleaning the whiteboard. The utility model relates to teaching aid. The prior whiteboard has no automatic cleaning function, a teacher wastes time in writing and erasing, and the use is not ideal. The method of cleaning the board manually also decreases the interaction time between the teachers and students. A teacher spends about one minute on average to clean the board fully. But here our proposed structure is simple; more economical; the use is convenient, clean, and sanitary; and the effect of saving time is good.
Mr. C.S.Satheesh, M.E.,
Servomotor
Control motors
Two Phase AC Servo Motor
Three Phase AC Servo Motor
DC Servo Motor
AC Servo Motor
Control Type Synchro.
Torque Transmission Type Synchro
Synchros
Presentation for unit V in Mechatronics excluding case study. Stepper motor, servo motor, design procedure, Traditional and Mechatronic design approach
Here, I am uploading our b.tech final year project paper which is published in IRJET Journal.
We done a project on Vector speed control of induction motor.
This paper is completely written in simple words and this is the most easiest way of explaining.
And also ,here i am providing a youtube link how we done this project and its matlab simulation circuit and result analyzing...etc..,
Our teammates are :-1)Samala Ranjith
2)Sammoji Rajinikanth
3)Shyamala Karunakar Reddy
4) K V V P Chari (our guide)
Similar to Pdpm,mayank awasthi,jabalpur,i it kanpur, servo motor,keil code (20)
Pdpm,mayank awasthi,jabalpur,i it kanpur, servo motor,keil code
1. Servo Control using Atmel 89S52
Submitted by
Mayank Awasthi
B.Tech(ECE)
PDPM IIITDM, Jabalpur
M. Tech, IIT Roorkee
(Communication Systems)
Contact no. 9410321979
Under the supervision of
Mr. Susmit Sen
Senior Research Engineer
Centre for Robotics
IIT Kanpur
i
2. ACKNOWLEDGEMENT
First of all, we would like to express our sincere thanks to our guide Mr. Susmit
Sen for his intellectual guidance, continuous interest, generous support, infinite
patience, and constant encouragement throughout this work. He has devoted his
valuable time to discuss this project, his expertise and broad knowledge in
Mechatronics & Robotics played a major role in the realization of this work. We
appreciate Mr. Susmit Sen for his confidence boosting start up to our project
work and encouragement in creative endeavors.
We especially appreciate the company of our classmates, seniors, workshop &
lab assistants and who have made useful to this work by way of discussions and
suggestions from time to time.
Group Member
Mayank Awasthi
B.Tech(ECE)
PDPM IIITDM, Jabalpur
Contact no. 9336441681
ii
3. CONTENTS
I. Servo Motors ………………...................
II. Atmel 89S52 Microcontrollers ………..
III. Keil code ………………………………..
IV. References ……………………………
iii
4. SERVO MOTORS
A Servo is a small device that incorporates a three wire DC motor, a
gear train, a potentiometer, an integrated circuit, and an output shaft
bearing. Of the three wires that stick out from the motor casing, one is for
power, one is for ground, and one is a control input line. The shaft of the
servo can be positioned to specific angular positions by sending a coded
signal. As long as the coded signal exists on the input line, the servo will
maintain the angular position of the shaft. If the coded signal changes, then
the angular position of the shaft changes.
A very common use of servos is in Radio Controlled models like cars,
airplanes, robots, and puppets. They are also used in powerful heavy-duty
sail boats. Servos are rated for Speed and Torque. Normally there are two
servos of the same kind, one geared towards speed (sacrificing torque), and
the other towards torque (sacrificing speed). A good example of this is the
HS-625MG servo and the HS-645MG servo.
Servos come in different sizes but use similar control schemes and are
extremely useful in robotics. The motors are small and are extremely powerful
for their size. It also draws power proportional to the mechanical load. A
lightly loaded servo, therefore, doesn’t consume much energy.
A typical Servo looks like a rectangular box with a motor shaft coming out of
one end and a connector with three wires out of the other end. The three
wires are the power, Control, and Ground. Servos work with voltages
between 4 and 6 volts. The control line is used to position the servo. The
servo motor comes in different sizes, which affect the overall size of the
servo. The gears of a servo vary from servo to servo. Inexpensive servos
have plastic gears, and more expensive servos have metal gears which are
much more rugged but wear faster. The potentiometer of a servo is the
feedback device. The electronics of a servo are pretty much the same in all
servos, but the output shaft bearing of a servo has either a plastic on plastic
bearing that will not take much side load or a metal on metal bearings that
stand up better under extended use, or ball bearings which work best. We
highly recommend ball bearing servos if your application demands heavy side
loads.
iv
5. Servos are constructed from three basic pieces; a motor, a potentiometer
(variable resister) that is connected to the output shaft, and a control board.
The potentiometer allows the control circuitry to monitor the current angle of
the servo motor. The motor, through a series of gears, turns the output shaft
and the potentiometer simultaneously. The potentiometer is fed into the servo
control circuit and when the control circuit detects that the position is correct,
it stops the motor. If the control circuit detects that the angle is not correct, it
will turn the motor the correct direction until the angle is correct. Normally a
servo is used to control an angular motion of between 0 and 180 degrees. It is
not mechanically capable (unless modified) of turning any farther due to the
mechanical stop build on to the main output gear.
The amount of power applied to the motor is proportional to the distance it
needs to travel. So, if the shaft needs to turn a large distance, the motor will
run at full speed. If it needs to turn only a small amount, the motor will run at a
slower speed. This is called proportional control.
How Do Servos Work ?
v
6. Servos are controlled by sending them a pulse of variable width. The control
wire is used to send this pulse. The parameters for this pulse are that it has a
minimum pulse, a maximum pulse, and a repetition rate. Given the rotation
constraints of the servo, neutral is defined to be the position where the servo
has exactly the same amount of potential rotation in the clockwise direction as
it does in the counter clockwise direction. It is important to note that different
servos will have different constraints on their rotation but they all have a
neutral position, and that position is always around 1.5 milliseconds (ms).
The angle is determined by the duration of a pulse that is applied to the
control wire. This is called Pulse width Modulation. The servo expects to see
a pulse every 20 ms. The length of the pulse will determine how far the motor
turns. For example, a 1.5 ms pulse will make the motor turn to the 90 degree
position(neutral position).
When these servos are commanded to move they will move to the position
and hold that position. If an external force pushes against the servo while the
servo is holding a position, the servo will resist from moving out of that
position. The maximum amount of force the servo can exert is the torque
rating of the servo. Servos will not hold their position forever though; the
position pulse must be repeated to instruct the servo to stay in position.
When a pulse is sent to a servo that is less than 1.5 ms the servo rotates
to a position and holds its output shaft some number of degrees
counterclockwise from the neutral point. When the pulse is wider than 1.5 ms
the opposite occurs. The minimal width and the maximum width of pulse that
will command the servo to turn to a valid position are functions of each servo.
Different brands, and even different servos of the same brand, will have
different maximum and minimums. Generally the minimum pulse will be about
1 ms wide and the maximum pulse will be 2 ms wide.
vi
7. Another parameter that varies from servo to servo is the turn rate. This is the
time it takes from the servo to change from one position to another. The worst
case turning time is when the servo is holding at the minimum rotation and it
is commanded to go to maximum rotation. This can take several seconds on
very high torque servos.
HS-322HD Servo Motors Specifications:
This servo comes with mounting hardware, mounting grommets, and 4 servo
horns. The HS-322HD servo has heavy duty gears for smoother operation and
longer life when compared to normal servos. This servo has a Hitech/JR
connector which mates directly with a 0.1" 3-pin header. The servo spline has 24
teeth and mates with Hitec compatible accessories.
Specifications
Voltage
Operating Speed Output Torque Weight
Range
0.19sec/60 degrees at 3kg.cm (41.6oz.in) at 43.0g
4.8V - 6V
4.8V 4.8V (1.51oz)
Wire Color Meaning
On all Hitec servos the Black wire is 'ground', the Red wire (center wire) is
'power', and the yellow (third) wire is 'signal'.
vii
8. ATMEL 89S52 MICROCONTROLLER
The AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller with
8K bytes of in-system programmable Flash memory. The on-chip Flash allows
the program memory to be reprogrammed in-system or by a conventional
nonvolatile memory programmer.
By combining a versatile 8-bit CPU with in-system programmable Flash on
a monolithic chip, the Atmel AT89S52 is a powerful microcontroller which
provides a highly-flexible and cost-effective solution to many embedded control
applications.
The AT89S52 provides the following standard features: 8K bytes of Flash, 256
bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers, three 16-bit
timer/counters, a six-vector two-level interrupt architecture, a full duplex serial
port, on-chip oscillator, and clock circuitry.
PIN Configuration
Pin configuration of ATMEL 89S52
viii
9. Clock and Instruction Cycle :
In 8051, one instruction cycle consists of twelve (12) clock cycles. Instruction
cycle is sometimes called as Machine cycle by some authors.
Fig 5.2 : Instruction cycle of 8051
In 8051, each instruction cycle has six states (S 1 - S 6 ). Each state has two
pulses (P1 and P2)
I/O Port Configuration
Each port of 8051 has bidirectional capability. Port 0 is called 'true
bidirectional port' as it floats (tristated) when configured as input.
Port-1, 2, 3 are called 'quasi bidirectional port'.
Timers / Counters
8051 has two 16-bit programmable UP timers/counters. They can be configured
to operate either as timers or as event counters. The names of the two counters
are T0 and T1 respectively. The timer content is available in four 8-bit special
function registers, viz, TL0,TH0,TL1 and TH1 respectively.
In the "timer" function mode, the counter is incremented in every machine cycle.
Thus, one can think of it as counting machine cycles. Hence the clock rate is
1/12 th of the oscillator frequency.
In the "counter" function mode, the register is incremented in response to a 1 to 0
transition at its corresponding external input pin (T0 or T1). It requires 2 machine
cycles to detect a high to low transition. Hence maximum count rate is 1/24 th of
oscillator frequency.
The operation of the timers/counters is controlled by two special function
registers, TMOD and TCON respectively.
ix
10. Timer Mode control (TMOD) Special Function Register:
TMOD register is not bit addressable.
TMOD
Address: 89 H
Various bits of TMOD are described as follows -
Gate: This is an OR Gate enabled bit which controls the effect of on
START/STOP of Timer. It is set to one ('1') by the program to enable the interrupt
to start/stop the timer. If TR1/0 in TCON is set and signal on pin is high then
the timer starts counting using either internal clock (timer mode) or external
pulses (counter mode).
It is used for the selection of Counter/Timer mode.
Mode Select Bits:
M1 and M0 are mode select bits.
x
11. Timer/ Counter control logic:
Fig 8.1 Timer/Counter Control Logic
Timer control (TCON) Special function register:
TCON is bit addressable. The address of TCON is 88H. It is partly related to
Timer and partly to interrupt.
Fig 8.2 TCON Register
The various bits of TCON are as follows.
TF1: Timer1 overflow flag. It is set when timer rolls from all 1s to 0s. It is cleared
when processor vectors to execute ISR located at address 001BH.
TR1: Timer1 run control bit. Set to 1 to start the timer / counter.
TF0: Timer0 overflow flag. (Similar to TF1)
TR0: Timer0 run control bit.
IE1: Interrupt1 edge flag. Set by hardware when an external interrupt edge is
detected. It is cleared when interrupt is processed.
IE0: Interrupt0 edge flag. (Similar to IE1)
IT1: Interrupt1 type control bit. Set/ cleared by software to specify falling edge /
low level triggered external interrupt.
IT0: Interrupt0 type control bit. (Similar to IT1)
xi
12. Timers can operate in four different modes as follows:
Timer Mode-0:
In this mode, the timer is used as a 13-bit UP counter as follows.
Fig. 8.3 Operation of Timer on Mode-0
The lower 5 bits of TLX and 8 bits of THX are used for the 13 bit count.Upper 3
bits of TLX are ignored. When the counter rolls over from all 0's to all 1's, TFX
flag is set and an interrupt is generated.
The input pulse is obtained from the previous stage. If TR1/0 bit is 1 and Gate bit
is 0, the counter continues counting up. If TR1/0 bit is 1 and Gate bit is 1, then
the operation of the counter is controlled by input. This mode is useful to
measure the width of a given pulse fed to input.
Timer Mode-1:
This mode is similar to mode-0 except for the fact that the Timer operates in 16-
bit mode.
Fig 8.4 Operation of Timer in Mode 1
Timer Mode-2: (Auto-Reload Mode)
This is a 8 bit counter/timer operation. Counting is performed in TLX while THX
stores a constant value. In this mode when the timer overflows i.e. TLX becomes
FFH, it is fed with the value stored in THX. For example if we load THX with 50H
then the timer in mode 2 will count from 50H to FFH. After that 50H is again
reloaded. This mode is useful in applications like fixed time sampling.
xii
13. Fig 8.5 Operation of Timer in Mode 2
Timer Mode-3:
Timer 1 in mode-3 simply holds its count. The effect is same as setting TR1=0.
Timer0 in mode-3 establishes TL0 and TH0 as two separate counters.
Fig 8.6 Operation of Timer in Mode 3
Control bits TR1 and TF1 are used by Timer-0 (higher 8 bits) (TH0) in Mode-3
while TR0 and TF0 are available to Timer-0 lower 8 bits(TL0).
Interrupts:
8051 provides 5 vectored interrupts. They are -
1.
2. TF0
3.
4. TF1
5. RI/TI
Out of these, and are external interrupts whereas Timer and Serial port
interrupts are generated internally. The external interrupts could be negative
edge triggered or low level triggered. All these interrupt, when activated, set the
corresponding interrupt flags. Except for serial interrupt, the interrupt flags are
cleared when the processor branches to the Interrupt Service Routine (ISR). The
xiii
14. external interrupt flags are cleared on branching to Interrupt Service Routine
(ISR), provided the interrupt is negative edge triggered. For low level triggered
external interrupt as well as for serial interrupt, the corresponding flags have to
be cleared by software by the programmer.
Each of these interrupts can be individually enabled or disabled by 'setting' or
'clearing' the corresponding bit in the IE (Interrupt Enable Register) SFR. IE
contains a global enable bit EA which enables/disables all interrupts at once.
Interrupt Enable register (IE): Address: A8H
EX0 interrupt (External) enable bit
ET0 Timer-0 interrupt enable bit
EX1 interrupt (External) enable bit
ET1 Timer-1 interrupt enable bit
ES Serial port interrupt enable bit
ET2 Timer-2 interrupt enable bit
EA Enable/Disable all
Setting '1' Enable the corresponding interrupt
Setting '0' Disable the corresponding interrupt
Priority level structure:
Each interrupt source can be programmed to have one of the two priority levels
by setting (high priority) or clearing (low priority) a bit in the IP (Interrupt Priority)
Register. A low priority interrupt can itself be interrupted by a high priority
interrupt, but not by another low priority interrupt. If two interrupts of different
priority levels are received simultaneously, the request of higher priority level is
served. If the requests of the same priority level are received simultaneously, an
internal polling sequence determines which request is to be serviced. Thus,
within each priority level, there is a second priority level determined by the polling
sequence, as follows.
xiv
16. KEIL CODE
*********************************************************************
For 11.0592 MHz crystal 1 machine cycle
For microcontroller is 1.085usec
thus for 20 msec we require count of 18433
thus count for timer
65535-18433 = 47102 = B7FE h
for 1ms = FC65 h …. 0 degree
for 2ms = F8CB h …. 180 degree */
//Here Servo is connected to P0.6
//Switches are connected at P1.5 and P1.6
#include<atmel89x52.h>
sbit servo=P0^6;
void timer1_ovf(void) interrupt 3 // timer 1 for 20ms
{
TH1=0xB7;
TL1=0xFE;
servo=1;
TR0=1;
}
void timer0_ovf(void) interrupt 1 // timer 0 for various shaft position
{
if(P1^5==1)
{
TH0=0xFC; //0 degree shaft position
TL0=0x65;
}
else if(P1^6==1)
{
TH0=0xFA; // 90 degree shaft position
TL0=0x99;
}
else if(P1^5==1&&P1^6==1)
{
TH0=0xF8; //180 degree shaft position
xvi