Author Topic: ENCODER pulse and DC geared motor  (Read 5250 times)

0 Members and 1 Guest are viewing this topic.

Offline bubbletea7Topic starter

  • Jr. Member
  • **
  • Posts: 12
  • Helpful? 0
ENCODER pulse and DC geared motor
« on: March 01, 2011, 10:16:03 AM »
hello there,

i am doing a project of dc motor controller for positioning..i am using dc geared motor with encoder.
my project consist of 3 speed and 2 direction forward and reverse.

friend of mine doing the programming using the micro C compiler, which is set the PWM to 180 change duty. then it count the pulse of 1 rotation (360 degree) equal to 70++pulse.. so he simply calculate when encoder read signal 00 or 11 or 01 or 10, it will count+5..

how he test the signal of the pulse from the encoder?

how does the concept of PWM relate with the DC geared motor?

i have 3 value of PWM which is 185(slow), 194(mid) and 205(fast) change of duty, but the increment of the motor angle is still same which is when the encoder signal read 00, 01,10 or 11 signal, it will increment the count by 5..
when the system is ON, and i test the accuracy, it got error so badly.. why it happen?is it because of the encoder signal?

here is the programming how the encoder check signal.

   }
   count=0;                 //count=0
   while(1)                 //check encoder signal
   {
    if(!signal_A && !signal_B)         //when signal 00
    {
     count=count+5;                    //count+5
     while(!signal_A && !signal_B);    //wait until signal changes
    }
    else if(!signal_A && signal_B)     //when 01
    {
     count=count+5;
     while(!signal_A && signal_B);
    }
    else if(signal_A && !signal_B)     //when 10
    {
     count=count+5;
     while(signal_A && !signal_B);
    }
    else if(signal_A && signal_B)     //when 11
    {
     count=count+5;
     while(signal_A && signal_B);
    }



hope u all can help me..i am so confusing!

Offline waltr

  • Supreme Robot
  • *****
  • Posts: 1,944
  • Helpful? 99
Re: ENCODER pulse and DC geared motor
« Reply #1 on: March 01, 2011, 12:41:50 PM »
Quote
how does the concept of PWM relate with the DC geared motor?

The duty cycle of the PWM can be though of as averaging the voltage applied to the motor. If the voltage to the Driver is 12V and the PWM duty cycle is 50% then the motor speed would be close to if only 6V is applied (this is simplified and does not that into account a number of other factors).

Quote
value of PWM which is 185(slow), 194(mid) and 205(fast) change of duty
Can I assume that the PWM duty cycle value is 0 to 255? If so then the duty cycle of those three values is 185/255 = 72%, 194/255 =76% & 205/255 = 80%. There is not a big difference between those values. You and your friend may need to re-evaluate the speeds required.

The encoder outputs a change in shaft angle. To obtain and speed information you need to time how long it takes for the encoder output value to change. For a positioning system one also needs to slow the motor as the desired position is approached. What you are building is known as a Servo and uses a close-loop feed-back to control the motor.

Microchip has a number of App Notes on motor and servo control here:
http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1469
Look under the "Select an Application" for DC motor, PID, position.
App Note AN532 is a good starter that covers all of your questions on encoders and PWM.

Offline bubbletea7Topic starter

  • Jr. Member
  • **
  • Posts: 12
  • Helpful? 0
Re: ENCODER pulse and DC geared motor
« Reply #2 on: March 01, 2011, 01:25:14 PM »
I am using the DC Geared motor, not a servo motor..

You are right, the PWM duty cycle value is 0 to 255..

at the shaft of my DC Geared Motor already attaching with RACK and PINION gear just to measure 1 rotation of motor is how much of distance has been move.

in term of PWM, there are not big change, but when i measure at the rack that has been move, it quite differ between the three speed. at it not constant at all..

Is it my DC Motor not suitable for the positioning application? why it is not suitable?

Offline waltr

  • Supreme Robot
  • *****
  • Posts: 1,944
  • Helpful? 99
Re: ENCODER pulse and DC geared motor
« Reply #3 on: March 01, 2011, 03:30:36 PM »
Quote
I am using the DC Geared motor, not a servo motor..

Exactly, but what you are trying to do, Control the POSITION, using a feed-back, of the output shaft is a SERVO. Which is the same as what an RC hobby Servo does.  Inside an RC hobby servo is a DC motor, gear reducer (gearmotor) a position encoder (pot) and control circuits.
Google servo or look up servo in Wiki.

Quote
measure at the rack that has been move, it quite differ between the three speed. at it not constant at all..
What are you measuring?
The rack movement in millimeters per one step of the encoder output?
The rate of movement of the rack, mm/second?


Quote
Is it my DC Motor not suitable for the positioning application? why it is not suitable?
It could be very suitable.
 The description of how you are trying to control the motor's output position does not sound suitable. That is why I suggested reading the Microchip AN532.
« Last Edit: March 01, 2011, 04:01:02 PM by waltr »

Offline bubbletea7Topic starter

  • Jr. Member
  • **
  • Posts: 12
  • Helpful? 0
Re: ENCODER pulse and DC geared motor
« Reply #4 on: March 04, 2011, 08:56:38 PM »
You said that i am doing kind of servo..
the technique for servo to drive is

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.

so, is that my dc geared motor will function like this?
or is it the principle of the dc motor is not the same as servo motor?

tq for reply..

Offline hopslink

  • Robot Overlord
  • ****
  • Posts: 202
  • Helpful? 14
Re: ENCODER pulse and DC geared motor
« Reply #5 on: March 05, 2011, 02:51:06 AM »
Quote
You said that i am doing kind of servo..
You are. As wikipedia puts it "A servomechanism, or servo, is an automatic device that uses error-sensing negative feedback to correct the performance of a mechanism." So any motor with position sensing and a closed control loop becomes a servo. If you had searched as waltr suggested you would know this.

Quote
the technique for servo to drive is ...
What you describe is the control input for a hobby servo, which has nothing to do with it's internal function. You will control your servo with PWM, just like the hobby servo you refer to does internally. If you had searched as waltr suggested you would know this too.

Quote
so, is that my dc geared motor will function like this?
No. If you had searched as... :P

Quote
or is it the principle of the dc motor is not the same as servo motor?
No, a DC motor is not the same as the servo, it can be part of a servo. Since you are using a position sensor and using the data it provides to control your motor (a closed control loop) then you have a servo - as waltr told you repeatedly. Your problem is that you are not correctly using feedback to adjust the PWM signal you feed your motor.

Your situation would be greatly helped if you took the advice you were given!  ;)

Offline waltr

  • Supreme Robot
  • *****
  • Posts: 1,944
  • Helpful? 99
Re: ENCODER pulse and DC geared motor
« Reply #6 on: March 05, 2011, 10:59:30 AM »
Thanks hopslink.

Offline bubbletea7Topic starter

  • Jr. Member
  • **
  • Posts: 12
  • Helpful? 0
Re: ENCODER pulse and DC geared motor
« Reply #7 on: March 05, 2011, 11:47:18 AM »
im just want to ask,

from the figure attach, can this motor be call servo? this motor been attaching with the encoder (hall effect sensor).

I understand that u told me, it quite similar to servo technique..

Is the PWM signal controlling my motor? if yes, how does the signal drive the motor?

note that my PWM frequency is 5kHz..

Offline waltr

  • Supreme Robot
  • *****
  • Posts: 1,944
  • Helpful? 99
Re: ENCODER pulse and DC geared motor
« Reply #8 on: March 05, 2011, 02:21:47 PM »
As I and hopslink have tried to tell you a SERVO is a system consisting of a MOTOR, a POSITION ENCODER and feed-back control ciruit (could be a processor).

Just a motor is not a servo, it is just a motor even if there is an encoder attached. It is the position feed-back that can make this into a servo.

 
Quote
Is the PWM signal controlling my motor?

A PWM signal can be used to control a motor's speed but not directly control the motor's output position.

Quote
if yes, how does the signal drive the motor?
Through a motor driver circuit which the most common is an H-bridge.

 


Get Your Ad Here