Servomotor Control

October 3, 2017 | Author: taufikrezza85 | Category: Servomechanism, Control Engineering, Manufactured Goods, Engineering, Computer Engineering
Share Embed Donate


Short Description

Download Servomotor Control...

Description

The servo motor has been around for quite some time. It has gained a lot of popularity for it ease of use & application, especially in hobby & RC electronics. Almost every RC car, helicopter or plane will have at least 1 servo motor inside. This tutorial will cover:

1. Servo Motor Theory. 2. Single Servo Motor Control w/ PIC. 3. Multiple Servo Motor Control w/ PIC.

It is highly recommended that you understand how to program a PIC before continuing with this tutorial. I have a tutorial written that explains this process. Take a quick look through it if you're not familiar with the PIC Microprocessor. The Servo Motor

The Servo Connector

Purpose of this project The purpose of this project is to explain what a servo motor is, how it is used & how to control it using the PIC microcontroller. Basic servo theory will be explained and then we'll look at some sample programming methods to control servo motors. A great advantage of servo motors is that they are very easy to control in comparison with other types of motors (DC, Stepper) that require an H-Bridge or external circuitry. The servo motor has all this circuitry internally. Inside the Servo Motor

Like DC motors, servo motors have been around a long time and are used in a wide variety of applications. The basic design of the servo motor is the same no matter the size or manufacturer. The picture below illustrates a cut-away of a servo and shows you what it looks like on the inside.

The bottom has the servo controller board which interprets the signal input & turns on the motor inside which is geared up. You cannot see it clearly but there is also a potentiometer (aka a variable resistor) inside the servo as well. The servo uses the potential meter for finding the different angles that it will rotate to. These so called "pots" can go bad so, don't automatically throw away servos if they don't work properly, often times all that needs to be replaced is the pot inside. Servo Motor in Action To illustrate how to control a servo motor, first we'll look at the sample program in action. The video below shows a PIC controlling a servo. It tells the servo to move to three distinct locations over and over forever: 0°, 45° & 90° (Note standard servos can rotate a maximum of 90°).

Servo Motor Theory Hi-Tec Servo Motors have three wires coming out of them.

·Red - Power (4.8v-6v) ·Black (Ground) ·Yellow (Signal)

The power & ground wires are hooked directly up to whatever battery or power supply you are using to power the servos. The Signal wire will be hooked up to the microcontroller used to control the servo, in our case the PIC. A noticeable first impression, the servo only requires 1 pin from the pic. The PWM Signal The signal that we need to create inorder to control the servos is called a Pulse With Modulation signal or PWM for short. The general requirements are: Frequency: 50Hz Up-time: 0.9mS->2.1mS Down-time: 19.1mS-17.9mS At first glance these definitions & numbers might make little or no sense. So lets look at a simple PWM wave at 50Hz.

So a PWM wave is just a signal that changes between 0 volts & 5 volts (digital logic 0 and 1). We see that the wave is symmetrical; uptime is 10mS & downtime is 10mS which when added together give us the period (10mS + 10mS = 20mS).

The Single Servo Schematic Although we'll be using the Olimex P-40 development board, you can alsobreadboard out the

circuit as it is very simple. The schematic for our first pass at controlling a servo is shown below. Servos can start to sink a lot of current like any motors so it is wise to be sure that your batteries can handle high currents. Since we're only using 1 or 2 servos, current won't be an issue.

You may have noticed that the servos we're using are rated at 4.8v & 6v. We're hooking 5v to the servos in this tutorial just to make things easier. This will not harm the servos in any way. They can be safely operated between 4.8 and 6 volts. The increase in voltage gives the servos more torque.

Single Servo Motor Control Software Our first program is from the example video in part 3: 'Inside The Servo Motor'. It moves the motor from: 90° -> 45° -> 0°. First we take a look at how to get the necessary numbers for our program:

Now that we know the necessary delays to create in order to get a proper servo PWM input signal, let's look at the code. The code is fairly long so I'll go over the most important part.

for(count=0;count
View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF