Servo motor control using matlab(through parallel port))

Thread Starter

assuc

Joined Mar 23, 2012
77
ASSALAM O ALAIKUM,
I am working on my university project that is to control the direction of servo motor using Matlab though parallel port.
Now i am confused, for a couple of days i am searching over the web to directly control the servo by parallel port and failed to found one, all most probably use sort of controller or pic to control the servo.
so is their any probability to control the servo directly by parallel port generating 1ms, 1.5ms and 2ms pulses to control servo's direction?
Along with it i will be using uln 2003 buffer ic to gain good output and then connected it to servo's signal.
IF their is a possibility i would like to know that how should i do it, means i know that servo motor receives a signal over a 20ms pulse and then decodes it to follow the direction, so the basic idea behind that is when a user press R from the keyboard the servo moves right and vice-versa , so in order to do that i would only have to generate the required pulse in the if condition or something else?
 

Attachments

djsfantasi

Joined Apr 11, 2010
9,156
Let's assume you want the servo centered, so you need a pulse width of 1.5 ms on the control line. You also mention that you understand the servo receives the pulse over 20ms; but do you also understand that most servos require that that 1.5 ms pulse width needs to be repeated every 20ms? (This is a 50Hz signal.) This may be difficult to control with your PC over a parallel port, depending on the operating system you are using.

That is why some sort of controller is used. The controller (or PIC) handles the repetitive nature of the control signal, so that the signal is not interrupted by the multitasking of the PCs native OS. Also, if you are controlling more than one servo, the 50Hz control signal must be maintained for each servo. I use a Lynxmotion SSC-32

Hope this helps.
 

Thread Starter

assuc

Joined Mar 23, 2012
77
but do you also understand that most servos require that that 1.5 ms pulse width needs to be repeated every 20ms? (This is a 50Hz signal.) This may be difficult to control with your PC over a parallel port, depending on the operating system you are using.

That is why some sort of controller is used. The controller (or PIC) handles the repetitive nature of the control signal, so that the signal is not interrupted by the multitasking of the PCs native OS.

Hope this helps.
Now this i don't know... and why the 1.5ms pulse should be repeated so in order to get the servo centered? lets assume if the user wants to maintain the position to right so what's the purpose of getting it centered.
and I am using only one servo at a time, i understand the fact that signal will get confused if more servo are used directly without any controller, but i believe there should be a possibility that 1 servo can be controlled via parallel port, rest i m a noob so don't know much !
 

djsfantasi

Joined Apr 11, 2010
9,156
Now this i don't know... and why the 1.5ms pulse should be repeated so in order to get the servo centered? lets assume if the user wants to maintain the position to right so what's the purpose of getting it centered.
and I am using only one servo at a time, i understand the fact that signal will get confused if more servo are used directly without any controller, but i believe there should be a possibility that 1 servo can be controlled via parallel port, rest i m a noob so don't know much !
I only used the centered position as an example. If you want to maintain the position to the right, the same example applies, but the pulse width is either 1.0 or 2.0ms... (I can't remember which is to the right). My point was that the signal to control the servo is not just a one-time signal, but rather that the pulse width for the desired position, over a 20ms period, must be repeated continuously to hold the position; then to change position, the pulse width would change, but the signal would still have to be repeated every 20ms. From the Lynxmotion site (link is to full description of servo operation):
Controlling a Servo
Servos are controlled with a 5vdc positive-going variable pulse width that repeats every 20mS. The pulse length determines the servo output shaft position but the 20mS frame rate is not position critical. The frame rate does need to repeat at least every 20mS or it will lose power or even stutter. The servo was designed for pulse widths that vary from 1.0mS to 2.0mS, where 1.5mS is centered. In the normal range the servo will move +/- 45 degrees from the centered (neutral) position.
Note that there are some servos - called digital servos - that may hold their position without a continuous signal. Hobbyist servos typically act the way I have described however. Which type are you using?
 

Thread Starter

assuc

Joined Mar 23, 2012
77
@djsfantasi: I will be using futaba fps-148 but if i get hands on turnigy i will use that also.
According to the explanation you provided pwm should be created in order for servo to move and it can't be created directly with parallel port output,or it can be?
 

djsfantasi

Joined Apr 11, 2010
9,156
With the proper program on your PC and the proper hardware design, you might be able to make it work with your parallel port - but I don't feel confident that it will. The timing of the control signal is critical for the pulse width and the same with the frequency (but less so). In a multitasking system such as Windows, you may not have sufficient control of the program in order to generate the necessary timing.

With a serial controller, such as the one I posted or similar controller, Matlab can send commands to the controller via a serial connection and the controller/PIC will offload the duty of maintaining the timing of the signal(s).
Read this manual if it helps...
 
Top