Controlling stepper motors with an Arduino board promise to be an easier task, and in the following, you can find a series of tutorials aiming to introduce you into the area of controlling any stepper motor with or without shields.
Designed for the DIY culture, the Arduino microcontroller is a pretty awesome open-source embedded system used in a wide range of robotics applications.
An electric motor can be powered and controlled directly from the Arduino board, or using the same Arduino board but with an additional shield. The first option is not always the right method and has its limits. For example, you can connect directly to the Arduino board only small stepper motors that require a small amount of current in spinning. This power limitation comes from the power source of the board, which can be a USB port or the DC jack on the board connected to a 5V power adapter.
Using an Arduino motor shield designed to control stepper motors is the right way to build a breathtaking DIY robot that can turn in place, climb stairs, or a robotic arm able to grasp objects from the ground. These motor shields are engineered to control motor direction and the speed using simple commands and the Arduino board. Additionally, using an external power supply of up to 12 V, you’re able to power and control several motors in the same time.
The stepper motors can be splitted into two types: unipolars and bipolars. The type of the motor is important to determine the compatible electronic device. In general, a stepper motor is controlled by a series of electromagnetic coils surrounding the shaft and designed to convert the electrical pulse in mechanical movements.
Small stepper motors fall in the voltages starting with 5V, 9V, 12V and finishing with 24V. The stepper motors with a higher voltage than 24V are hard to find in robotics, and perhaps these are not too popular in the DIY area of building robots.
A stepper motor has a series of advantages including:
- accurate positioning;
- move forward or backward step by step;
- high torque at low speed;
- rotate angle is proportional with the input pulse;
- full torque at standstill;
- quickly response at start, stop or reversing the sense of rotation;
In the following, I explore tutorials and resources to control stepper motors using the Arduino board and several other electronic components.
Tutorials to Control Stepper Motors Using Shields
An Ardino motor shield has the role to control motor direction and speed, which is a good and simple solution to the challenges of our time in robotics. As you can see in the following tutorials, all of these shields can be easily plugged on top of the Arduino PCB to extend its capabilities.
- Arduino Motor Shield Tutorial – this is a tutorial from where you can learn about how to interface one or two DC motors with an Arduino board using the Arduino motor shield. In the tutorial you can find also the programming code to control the stepper motors;
- Arduino and the official motor shield R3 – a good example how to write a program to control a stepper motor with an Arduino board and Arduino compatible motor shield;
- Motor Shield Tutorial – this is a complete tutorial with operational steps and programming code to control the DC motor using Arduino Duemilanove or Arduino Mega 1280 board;
- Motor Shield with the Freescale Freedom Board – step by step guide to control stepper motors using an Arduino shield, CodeWarrior for MCU10.3 and Processor Expert;
- Motor Shield – comprehensive tutorial to learn how to control the speed or the direction of a stepper motor using AF_Motor Arduino library;
- Arduino Due + Motor Shield: DC motor – comprehensive documentation to drive a DC motor in both directions – forward and backward – using an Arduino Due board and an Arduino Motor Shield;
Below is a list with Arduino motor shields designed to be used in a wide range of robotic applications.
- Arduino Motor Shield – motor shield Arduino compatible and designed for robotic applications that requires to drive DC and stepping motors. The board is used to control at the same time the speed and direction for two DC motors. The same motor shield is able to provide you information about the current absorption for each motor separately;
- 2A Motor Shield For Arduino – this is an Arduino motor shield engineered to drive up to two DC motors with 2A current and control voltage between 7 to 12V. The shield is compatible with Arduino Mega and can be directly plugged into the Arduino board;
- Ardumoto – Motor Driver Shield – the Ardumoto comes in a new version and with new features including a voltage control for 3.3 or 5v logic, separate VIN connection, and 3 pins available for PWM input. The shield is based on L298 H-bridge and can control up to two DC motors;
- Pololu Dual VNH5019 Motor Driver Shield for Arduino – compatible with Arduino or Arduino clone boards, this shield was designed in order to control two DC motors with control voltage between 5.5 to 24 V and a continue 12A current for every channel;
- Motor Shield V1.0 – compatible with the Arduino embedded system, the Motor Shield V1.0 is a powerful electronic component designed to drive two DC motors or only one 4-wire two-phase stepper motor. Used in robotics or mechanical applications, the shield includes an on-board 5V voltage regulator for Arduino board power;
- Stepper Motor Shield For Arduino – this is a shield designed to drive up to two stepper motors and is full compatible with Arduino UNO R3. Also, the shield offer support for Wi-Fi, Bluetooth and RF modules;
- Arduino Stepper Motor Shield – based on L6470 dSpin Motion Controller, the motor shield can be used in robotic applications with two 1.5A stepper motors that can be derived independently. Depending on motor voltage, the shield can be used for power supply with values between 12V DC or 24V DC;
Tutorials to Control Stepper Motors Without Shields
A stepper motor can be controlled using only the Arduino board without custom electronic circuit for control or feedback. In the following, I made a selection of tutorials from where you can learn how a stepper motor can be controlled and powered using an Arduino board and sensors such as a potentiometer.
- Stepper Motor Knob – this is a complete tutorial with schematic circuits to control unipolar and bipolar stepper motors interfaced with an Arduino board and a potentiometer;
- Arduino Stepper Motor Control – reading this tutorial you can learn how to write a program to control a stepper motor;
- Arduino Lesson – Stepper Motors – in this tutorial are available all the steps to learn how a DC motor can be controlled using an Arduino board and an L293D motor controller chip;
- Stepper Motors – with a good explanation for differences between bipolar and unipolar stepper motors, from this tutorial you can learn step by step how to control a stepper motor using Arduino embedded system;
- Controlling a Stepper Motor with an Arduino – this is a short demonstration how to use a set of 3904 transistors to power and control stepper motors using the Arduino single board computer;
- Sample code and projects to get your stepper running – examples how can be used the EasyDrivers or BigEasyDrivers stepper motor driving boards to control stepper motors. The programming code is available in the tutorial for all examples;
- Driving a Bipolar Stepper Motor with Arduino and ULN2803AG – this is a tutorial where is explained how a bipolar stepper motor can be controlled using eight identical Darlington inverting amplifier circuits and an Arduino board;
- Stepper motor controller circuit and code – tutorial to control a stepper motor based on schema available on the Arduino website;
- Stepper Motor 5V 4-Phase 5-Wire & ULN2003 Driver Board for Arduino – tutorial with the circuit diagram and programming code to control a stepper motor using the Arduino board;
- Arduino/Motor Control/steppermotors – comprehensive documentation to control a stepper motor and understand how to program their operation into Arduino;
- Stepper Motor drive from Arduino – simple circuit and programming code to control a stepper motor using the Arduino board. The stepper motor is a 4-wire bipolar Sparkfun type with a step angle of 1.8 degrees;
- Small Stepper Motor and Driver Board – tutorial with the wired diagram and schema to control a stepper motor with gear reduction;
- Use The EasyDriver Stepper Motor Driver + Arduino – in this tutorial you can find a program to control a stepper motor using an EasyDrive driver. The programming code allows you to control the rotations and the speed of a stepper motor;
- Unipolar Stepper Motor – simple and complex programming code to control a unipolar stepper motor using an Arduino board, a potentiometer, and the ULN2003A Darlington Array with 7 drivers;
From libraries to electronic parts and kits, in this section of the article you find software and hardware resources designed to be used in controlling stepper motors with Arduino boards.
- Stepper Library;
- CustomStepper library;
- AccelStepper library for Arduino;
- Arduino Code for Controlling a Stepper Motor;
- EasyDriver Stepper Motor Driver;
- MAKE MotorShield Kit designed by Adafruit Industries in partnership with MAKE;
This article was last modified on 26 February 2014.