Arduino Playground is read-only starting December 31st, 2018. For more info please look at this Forum Post

:: Stepper motor (5-phase) Library ::

Library is being tested right now. Will make proper wiki here.

Update: I have to fix heating problem, before i publish this library. Please be patient.

This library allows you to control 5-phase stepper motor using Arduino.

Table of content

  • Circuit
  • Theory
  • Functions
  • Example
  • Notes

Circuit

The circuit is designs as simple keys by Ravith Botejue. http://ravith.files.wordpress.com/2008/02/driver1.png

Theory

Functions

  • Stepper5phase(int pin1, pin2, pin3, pin4, pin5, delay);
  • rotate(int steps);
  • release();
  • fix();
  • getState();
  • setState(int stateS);

Stepper5phase(int pin1, pin2, pin3, pin4, pin5, delay)

Constructor: initiates the controlling package. Parameter description: (int) pin1, pin2, pin3, pin4, pin5 - controlling digital outputs, specify legs that are connected in circuit. (int) delay - time to what between each step in mili seconds (suggested value 1). Note that it is inversely proportional to speed.

rotate(int steps)

Rotates the stepper number of steps. Parameters: (int) steps - numbers of steps to do. If negative will rotate to different direction.

release()

Will release the stepper motor - stops the float of current and allows it to be rotated by external forces. Useful to release stepper if your not working with lifting applications because stepper motors may consume lots of energy and heat your system.

fix()

Will fix the position of stepper - can be used after function release().

getState()

Returns the state of the stepper motor (int). It is used with setState(int stateS). It can be usefull to save state when you end your program and want to save the state of all the program. State varies from 0 to 9.

setState(int stateS)

Sets state of the rotation. Used with getState().

Example

Simple program to rotate motor forth and back.


  1. #include <Stepper5phase.h> // Include the 5-phase stepper library
  2.  
  3. // Parameters of legs: BLUE, RED, ORANGE, GREEN, BLACK, delay time
  4. Stepper5phase motor(1, 2, 3, 4, 5, 5);
  5.  
  6. void setup(){}
  7.  
  8. void loop(){
  9.   motor.rotate(100);
  10.   motor.release();
  11.   delay(1000);
  12.   motor.rotate(-100);
  13.   motor.release();
  14.   delay(5000);
  15. }


Notes