Rotery Enoder and Stepper Motor Problem

Status
Not open for further replies.

nick703

Advanced Member level 1
Joined
Oct 17, 2011
Messages
422
Helped
21
Reputation
44
Reaction score
22
Trophy points
1,298
Location
surat
Visit site
Activity points
3,987
hello friends i have completed the stepper motor rotate using rotary encoder .

but my problem is step angle of stepper motor. i have completed this task using half step of stepper motor . means when my rotary encoder rotate 1 round at that time my stepper motor also rotate 1 round. but when i changed the 1/4 step or 1/8 step then my stepper motor obviously rotate but half and quarter half round right.

so my question is i have to implement 1 round of stepper motor using 1 round of encoder in 1/8 step of stepper motor at SAME TIME.

my aim is reduce the noise or vibration of stepper motor when rotate using rotary encoder. because in half step motor is running 1.8 degree . when a single pulse of rotary encoder gives then stepper motor rotate single pulse also but motor is vibrate. please help me.
 

Re: Rotery Enoder and Stepper motor Problem

How many pulses per rotation do you get from the rotary encoder?

Using a motor step resolution higher than the rotary encoder doesn't make sense, if for every pulse of the encoder you do four 1/4 steps or two 1/2 steps then you may as well do one full step.

Or to put it differently if you already have a 1/1 step relation between the encoder and stepper motor (like one encoder pulse/ one 1/4 step) what is the point of having one pulse / two 1/8 steps, you don't gain any resolution.

- - - Updated - - -

I just realized that you already mention that you want to use micro stepping to reduce vibration so what is the problem of doing multiple steps of the motor each time you get a pulse of the encoder?

Can you provide the code that needs modification?Do you have a code that works
 

Re: Rotery Enoder and Stepper motor Problem

ok alexan_e i saw my code.
Code:
void Encoder (void) 
 { 
   int new = 0 ; 
   int value = 0 ; 
   new = PORTE ; 
   value = new ^ old ; 
  if(value & 0x08) 
  { 
      if (new & 0x08) 
      { 
       mstepperAena() ;           //stepper enable
       if (new & 0x04) 
       { 
           mstepperAfor() ;          //stepper forward
        } 
       else 
       { 
          mstepperArev() ;              //stepper reverse
       } 
       mstepperAhalf();                    //  stepper half step means 1 step is 0.9 degree of stepper motor
       mstepperAoff();                    // stepper off
       Delay(20); 
      mstepperAon();                     //stepper on
     } 
 }

ok this is exact 1 step of encoder = 1 step of stepper motor . but in this method stepper motor vibrate and another condition 1 step of encoder = 1/2 step of stepper motor (in code replace mstepperAhalf(); to stepperAquater(); )
and motor is less vibrate.
 

Re: Rotery Enoder and Stepper motor Problem

yes i have a 1 , 1/2 , 1/4 , and 1/8 step available.
 

Re: Rotery Enoder and Stepper motor Problem

Ok, so can you replace mstepperAhalf();

with
Code:
stepperAquater();
stepperAquater();

or
Code:
stepperAeighth();
stepperAeighth();
stepperAeighth();
stepperAeighth();

or that doesn't work?

How did you implement the change for stepperAquater(); version compared to the mstepperAhalf(); version you have provide
 

Re: Rotery Enoder and Stepper motor Problem

ohhh.. sorry alexan_e

Code:
#define          MS_1                 BIT_1
#define          MS_2                 BIT_2

#define          stepperAquater()           (LATBSET = MS_1 , LATBCLR = MS_2 )  
#define          stepperAeighth()           (LATBSET = MS_1 , LATBSET = MS_2 )  
#define          stepperAhalf()              (LATBCLR = MS_1 , LATBSET = MS_2 )

this is my stepping change bit .
this is my declaration ok. and i am using PIC32 device.
 

Re: Rotery Enoder and Stepper motor Problem

Ok so

Code:
 mstepperAhalf();                    //  stepper half step means 1 step is 0.9 degree of stepper motor
       mstepperAoff();                    // stepper off
       Delay(20); 
      mstepperAon();                     //stepper on

is a single 1/2 step ?

and

Code:
 mstepperAhalf();                    //  stepper half step means 1 step is 0.9 degree of stepper motor
       mstepperAoff();                    // stepper off
       Delay(20); 
      mstepperAon();                     //stepper on

 mstepperAoff();                    // stepper off
       Delay(20); 
      mstepperAon();                     //stepper on

is two 1/2 steps ?
 

Re: Rotery Enoder and Stepper motor Problem


sorry i didn't try this i will try and replay is it possible to write repeat pulse stream ?

- - - Updated - - -

now i am testing and it's work but same as a half step and i get noise (vibration) . i didn't understand how to resolve it and another thing when i rotate rotary encoder fast i get result smoothly rotate stepper motor but when i rotate slow encoder then my whole stepper motor vibrate and in my application rotary encoder must rotate slow so if any other solution then please tell me .
 

Re: Rotery Enoder and Stepper motor Problem

I'm not sure what the function actually does but you can try added delay

Code:
mstepperAhalf();                    //  stepper half step means 1 step is 0.9 degree of stepper motor
mstepperAoff();                    // stepper off
Delay(20);
mstepperAon();                     //stepper on
[B]Delay(20);[/B]
mstepperAoff();                    // stepper off
Delay(20);
mstepperAon();                     //stepper on
 

Re: Rotery Enoder and Stepper motor Problem

yes u r right all matter in delay function . i try all type of delay and also when i did this type thing i have miss some pulse of stepper motor . so problem is continue .

and timing is very important because in my application when encoder rotate stop that time stepper motor rotate stop. otherwise after some type stepper motor stop i can work perfectly no one pulse missing and rotate stepper motor smoothly.

but in real time rotate and stop encoder as well as stepper motor .
 

Re: Rotery Enoder and Stepper motor Problem

Obviously rotating using micro-steps is going to be slower than full steps, so if your motor can't keep up with the encoder step speed then you should add a fifio buffer where the encoder steps are "recorder" and applied
 
Re: Rotery Enoder and Stepper motor Problem

thanks for your reply ,


but is not a real time process means some delay is must taken when encoder signal is recorded and then apply.m i right ya wrong sir.

but above code is working issue is noise. and yes another question is what should be minimum delay to state of on and off.
 

Re: Rotery Enoder and Stepper motor Problem

If your motor can't keep up with the encoder position then the next alternative closer to real time is for the motor to follow the encoder position as fast as it can and that is by following the buffer steps I mentioned.
If that is a problem then you have to implement 1/1 steps with the increased noise you mention.

About the delay, it depends on the driver you are using
 

Re: Rotery Enoder and Stepper motor Problem

ok i understand exactly . but suppose i give 1 pulse of encoder and i rotate stepper motor as a full step mode then rotate stepper motor degree is 1.8 right. and half , quarter and eighth mode stepper motor degree is 0.9 ,0.45 , 0.225 right .

so suppose when i give 1 signal of encoder and rotate stepper motor in eight step mode i receive 4 signal by doing coding that time direct rotate stepper motor shaft in 1.8 degree instead of 0.225 of 4 step .
 

Re: Rotery Enoder and Stepper motor Problem

But you say that doing four or eight micro-steps instead of a full step takes too long and the motor can't keep up with the encoder in real time, I'm not sure how you can overcome the speed issue.
 

Re: Rotery Enoder and Stepper motor Problem

ok is that possible PWM mode implement to rotate stepper motor ?
 

Re: Rotery Enoder and Stepper motor Problem

I don't see how PWM can speed up things and your driver is probably already using PWM, which one is it?
 

Re: Rotery Enoder and Stepper motor Problem

my PWM is based on DELAY table every time timer is reload it 's fixed value when i put on DELAY table . so it just code thing. but can i used pic32 OC1 , OC2 TO OC5 pin as a set pwm exact value as i think . and suppose delay table has a some wrong condition or some wrong code i putted and give me a some time timer error so i want to use this pin of pic32 device or not ?
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…