Close

Basic Stepper Control – Arduino Workshop

mr-sarful-hassanMr. Sarful hassan wrote 06/15/2020 at 13:51 • 7 min read • Like
In this very simple project, you will connect up a stepper motor and then get the Arduino to control it in different directions and at different speeds for a set number of steps. Basic Stepper Control - Arduino Workshop simple project to show you how to control the stepper, make it move a set distance, and change its speed and direction. Stepper motors are different than standard motors in that their rotation is divided into a series of steps. By controlling the timing and number of steps issued to the motor, you can control the speed of the motor and how far it turns fairly precisely. Stepper motors come in different shapes and sizes and have four, five, six, or eight wires. Stepper motors have many uses; they are used in flatbed scanners to position the scanning head and in inkjet printers to control the location of the print head and paper

Required Component  :

1.Arduino 2. Resistors 3. Stepper Motor 4. SN754410 Motor Driver IC 5 .0.1uF capacitors 6. Connecting wire 7. Breadboard

This book will help you to gain more knowledge about Arduino

Beginning Arduino

Circuit diagram Basic Stepper Control Arduino:

Basic Stepper Control Make sure the Arduino and the L293 are connected to an external DC power supply so as not to overload the Arduino. The Arduino does not need to be connected to an external supply, the SN754410 does. It is best to run the connection to the external supply positive lead directly to the breadboard and pin 8 of the SN754410 and connected to the ground from the Arduino at the breadboard. By doing this rather than hooking pin 8 of the SN754410 to the Vin pin from the Arduino’s shield connector, high currents won’t be routed through the Arduino. The capacitors are optional and help to smooth out the current and prevent interference with the Arduino. These go between the +5v and ground and the motor power supply and ground. You can also use low-value electrolytic capacitors, but make sure you connect them correctly (+ to supply, - to the ground) as they are polarized and can be damaged or explode if hooked up backward! I found that without them the circuit did not work. You may also require a current-limiting resistor between the power supply and the power rail supplying the SN754410 chip. Use an appropriate power supply that is within the range of both voltage and current for your motor. Also, ensure that the power rating of any current-limiting resistors you use is above the current required by the motor or the resistor will heat up and burn out. Note that the motor drive voltage will also be lower than the input voltage due to the internal voltage drops in the driver. Digital pins 4, 5, 6, and 7 on the Arduino go to the input 1, 2, 3, and 4 pins on the motor driver. Output pins 1 and 2 of the motor driver go across coil 1 of the motor and output pins 3 and 4 to coil 2. You will need to check the datasheet of your specific motor to see which colored wires go to coil 1 and which go to coil 2. A unipolar motor will also have a 5th and/or a 6th wire that goes to ground The 5v pin on the Arduino goes to pin 16 (VSS) of the motor driver pin. the two chip inhibit pins (1 and 9) are also tied to the 3.3v line to make them go HIGH. making sure neither half of the driver chip is inhibited. The Vin (Voltage in) pin on the Arduino goes to pin 8 of the driver IC (VC). Pins 4, 5, 12, and 13 all go to ground. Once you are happy that everything is connected up as it should be, enter the code below

Code Basic Stepper Control Arduino :

#include <Stepper.h>
// steps value is 360 / degree angle of motor
#define STEPS 200
// create a stepper object on pins 4, 5, 6 and 7
Stepper stepper(STEPS, 4, 5, 6, 7);
void setup()
{
}
void loop()
{
stepper.setSpeed(60);
stepper.step(200);
delay(100);
stepper.setSpeed(20);
stepper.step(-50);
delay(100);
}
Make sure that your Arduino is powered by an external DC power supply before running the code. When the sketch runs, you will see the stepper motor rotate a full rotation, stop for a short time, then rotate backward for a quarter rotation, stop a short time, then repeat.

All Arduino tutorial available Click here

 ALL ARDUINO TUTORIAL 

Like

Discussions