0% found this document useful (0 votes)
52 views2 pages

Stepper Motor Control: Details

This document describes how to control a stepper motor using an Arduino board. It explains that a stepper motor requires a step pin and direction pin to control the motor's movement. The setup function configures these pins as outputs. The loop function is then used to actively control the motor by writing high and low signals to toggle the step pin, and changing the direction pin to adjust the rotation direction. Delays are added between steps to control the motor's speed of rotation.

Uploaded by

apieron1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views2 pages

Stepper Motor Control: Details

This document describes how to control a stepper motor using an Arduino board. It explains that a stepper motor requires a step pin and direction pin to control the motor's movement. The setup function configures these pins as outputs. The loop function is then used to actively control the motor by writing high and low signals to toggle the step pin, and changing the direction pin to adjust the rotation direction. Delays are added between steps to control the motor's speed of rotation.

Uploaded by

apieron1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Stepper motor control

Details :

int steppin

: motor control pin

int dirpin

: motor direction pin

void setup
: The void keyword is used only in function declarations. It indicates that
the function is expected to return no information to the function from which it was called.

pinMode(stepPin,OUTPUT)
pinMode(dirPin,OUTPUT)

: sets two pin as output

pinmode : Configures the specified pin to behave either as an input or an output

void loop : After creating a setup() function, which initializes and sets the initial values,
the loop() function does precisely what its name suggests, and loops consecutively,
allowing your program to change and respond. Use it to actively control the Arduino
board.

Digitalwrite : Write a HIGH or a LOW value to a digital pin.If the pin has been configured
as an OUTPUT with pinMode(), its voltage will be set to the corresponding value: 5V (or
3.3V on 3.3V boards) for HIGH, 0V (ground) for LOW.if the pin is configured as an
INPUT, digitalWrite() will enable (HIGH) or disable (LOW) the internal pullup on the input
pin. It is recommended to set the pinMode() to INPUT PULLUP to enable the internal
pull-up resistor
digitalWrite(dirPin,HIGH) : Enables the motor to move in a particular direction
for(int x = 0; x < 200; x++) : by for loop condition motor will take full cycle rotation

Stepper motor control

as the driver is set in a full step mode and stepper motor is taking 200 steps (1.8 degree
angle) so that we have to sent 200 pulses to make full cyle rotation so for loop have 200
iterations and each tiome step pin is made high (digitalWrite(stepPin,HIGH))

delay(1000) : after one full cycle 1 sec delay is made

then change the direction of rotation :

digitalWrite(dirPin,LOW);

then make 2 full cyle rotation by the loop of 400 iteration : for(int x = 0; x < 400; x++)

You might also like