Login

how to interface stepper motor with arduino

stepper motor or step motor or stepping motor is a brushless DC electric motor that divides a full rotation into a number of equal steps. The motor’s position can then be commanded to move and hold at one of these steps without any position sensor for feedback (an open-loop controller), as long as the motor is carefully sized to the application in respect to torque and speed

HOW TO INTERFACE A UNI_POLAR STEPPER MOTOR WITH ARDUINO

hardware connections

* The in_1,2,3,4 pins of the motor driver port is connected to the digital 2,3,4,5 pins of the arduino respectively .

*connect the ground pin to the ground of the motor driver port to the ground of the arduino, and the negative terminal of the 5v  power supply to the other ground of the arduino (ensure that there is a  common ground between the arduino,motor driver port and the 5v power supply)

connect the 5v power to the vcc of the motor driver

*connect the 5 wires of the stepper motor to the motor driver port

make sure that the red wire is connected to pin no 5 , yellow wire to pin no 4 , pink to 3 and blue to 2 of the arduino .

programming the arduino

There are 4 steps , in each step only one pin is high , first the blue pin is high , then pink is high and so on .when pin 1 is high it gets energized and it drives the motor then the next pin is high it is energized and it drives the motor and so on . after pin 4 it automatically  make pin 1 high and it continues the sequence till infinity.

The code is as follows

int bluePin = 2; //IN1 on the ULN2003 Board, BLUE end of the Blue/Yellow motor coil
int pinkPin = 3; //IN2 on the ULN2003 Board, PINK end of the Pink/Orange motor coil
int yellowPin = 4; //IN3 on the ULN2003 Board, YELLOW end of the Blue/Yellow motor coil
int orangePin = 5; //IN4 on the ULN2003 Board, ORANGE end of the Pink/Orange motor coil

//Keeps track of the current step.
//We’ll use a zero based index.
int currentStep = 0;

void setup() {
// put your setup code here, to run once:
Serial.begin(9600);

pinMode(bluePin, OUTPUT);
pinMode(pinkPin, OUTPUT);
pinMode(yellowPin, OUTPUT);
pinMode(orangePin,OUTPUT);

digitalWrite(bluePin, LOW);
digitalWrite(pinkPin, LOW);
digitalWrite(yellowPin, LOW);
digitalWrite(orangePin, LOW);
}

void loop() {

//Comment out the Serial prints to speed things up
//Serial.print(“Step: “);
//Serial.println(currentStep);

switch(currentStep){
case 0:
digitalWrite(bluePin, HIGH);
digitalWrite(pinkPin, LOW);
digitalWrite(yellowPin, LOW);
digitalWrite(orangePin, LOW);
break;
case 1:
digitalWrite(bluePin, LOW);
digitalWrite(pinkPin, HIGH);
digitalWrite(yellowPin, LOW);
digitalWrite(orangePin, LOW);
break;
case 2:
digitalWrite(bluePin, LOW);
digitalWrite(pinkPin, LOW);
digitalWrite(yellowPin, HIGH);
digitalWrite(orangePin, LOW);
break;
case 3:
digitalWrite(bluePin, LOW);
digitalWrite(pinkPin, LOW);
digitalWrite(yellowPin, LOW);
digitalWrite(orangePin, HIGH);
break;
}

currentStep = (++currentStep < 4) ? currentStep : 0;

//2000 microseconds, or 2 milliseconds seems to be
//about the shortest delay that is usable. Anything
//lower and the motor starts to freeze.
//delayMicroseconds(2250);
delay(2);
}

 

 

 

 

 

 

 

 

July 23, 2018

45 responses on "how to interface stepper motor with arduino"

  1. where to buy otc ed pills – walgreens ed pills what causes erecti

  2. modafinil reddit – vigilpr provigil schedule

  3. where to buy vardenafil in singapore – online apotheke vardenafil

  4. buy ivermectin for humans – stromectol price buy ivermectin 1

  5. med pharmacy – cialis 2019 cialis coupon 5mg

  6. generic name for ivermectin – ivermectin 80 mg buy stromectol

  7. order accutane online canada – buy accutane online nz where

  8. best price for lyrica – lyrica 750 mg viagra canadian pharmacy

  9. amoxicillin usa – cvs amoxicillin price rx amoxicillin 500mg

  10. online us pharmacy viagra – generic viagra singapore canadian

  11. cost for cialis 20mg – cialis generic online buy cialis from

  12. cost of prednisone tablets – order prednisone 200 mg predni

  13. order provigil online – modapls provigil for adhd

Leave a Message

Your email address will not be published.

top

Knowledge and Content by Li2 Technologies | © 2021 NASSCOM Foundation | All rights reserved

X