Uživatel:Agallraj

Z MAM wiki

Přejít na: navigace, hledání

Obsah

[editovat] Stepper motor (Bipolar motor with half stepping)

[editovat] Introduction

Bipolar motor has simpler construction. It has two windings with no center taps and a permanent magnet at the center just like unipolar stepper motors. Being simpler in construction, the stepping sequence is a little complex, as the power for both the coils has to be controlled in such a way that the polarity of the poles get reversed.

In the full step sequence, two coils are energized at the same time and motor shaft rotates. In Half mode step sequence, motor step angle reduces to half the angle in full mode. So the angular resolution is also increased i.e. it becomes double the angular resolution in full mode. Also in half mode sequence the number of steps gets doubled as that of full mode.

[editovat] Connection scheme

Used equipments: stepper motor, ATmega168, 2x invertor TC4424, 8x diodes.


     1     2     3     4     5     6     7     8            <- Pointer of the state of the rotor
     N     N     X     S     S     S     X     N            <- L1
     S     S     X     N     N     N     X     S
     X     N     N     N     X     S     S     S            <- L2 
     X     S     S     S     X     N     N     N
     8     10    2     6     4     5     1     9            <- State of the rotor (N = log.1, S = log.0)


[editovat] ATmega168


[editovat] Code in C

/* main.c */
#include <avr/io.h>                     // here is defined ex. PORTB
#include <avr/iom168.h>                 // constants for the concrete type of microprocessor
#define F_CPU 1000000UL
#include <util/delay.h>                 // function _delay_ms()
int index = 7;                          // pointer of the state of rotor
const int array[] = {8,10,2,6,4,5,1,9}; // states of the rotor

int main (void){                        // main program
 
   DDRB=0xFF;                           // define PORTB as output

   steps(2,0,100);                      // initialization

   while(1){                            // periodic movements of the motor
      steps(100,0,2);                   // left-side direction
   // steps(100,1,2);                   // right-side direction
                                        //
                                        // steps(number of steps, direction, time)
                                        // direction: leftside=0 rightside=1 
                                        // time = time of one step in ms;
   }
}                                       // end of main
int steps(int numberofsteps,int direction, int time){ 
      while(numberofsteps > 0){
          if(direction==1) rightside();
          else             leftside();           
          while(time>0){                // delay 'time' ms
              _delay_ms(1);    
              time--; 
          }
          numberofsteps--;
      }
}
int rightside(void){                    // right-side movement of the rotor by one step
      if(index==7) index = 0;
      else         index++;
      PORTB = array[index];
      return 0;
}
int leftside(void){                     // left-side movement of the rotor by one step
      if(index==0) index = 7;
      else  	    index--;
      PORTB = array[index];
      return 0;
}

[editovat] References

1. noel.feld.cvut.cz - previous semester projects

2. AE2M99MAM's lectures

3. 8051projects.net

4. wikipedia.org

5. robotika.cz

Osobní nástroje