Simple Integration Between Stepper Motor Nema 23 and Arduino Uno

by samiobi in Circuits > Arduino

8005 Views, 17 Favorites, 0 Comments

Simple Integration Between Stepper Motor Nema 23 and Arduino Uno

IMG_7964.JPG

Big machines need high pression motors in order to preform accurate tasks such as cutting, grapping, rotation and so on. For this reasons the use of stepper motors becomes very useful when the system demands high accuracy and high torque. Stepper motor are different from DC motor in many aspects, also there are many types of stepper motors depend on the torque and load. The most common terminology used to descript a stepper motor is NEMA such as Nema 8, Nema 11 , Nema 12 and so on, the higher it goes the higher the torque and load will be generated by the stepper motor.

In this project Nema 23 is used, this stepper motor can be used is many applications, however to operate the stepper a specific driver is selected to match the type of stepper. There are some parameters to be adjusted to make the stepper operate according to the requirement. At the end the rotation is controlled by Arduino uno.

Supplies

Stepper motor Nema 23

Step motor driver DM542

Arduino UNO

Power supply

Jumper links

bread board

Two push button switches

Two 1K ohm resistors

Block Diagram

Block diagram.png

The connection diagram in the figure above shows the integration between all units, first Arduino Uno is connected to two input bush buttons for clock wise and anti clock wise turn, connected to pins 11 and pin 12. Moreover the Arduino power source is DC adapter (optional).

The outputs Arduino pins 2 is connected to (dir -) of the driver and pin 3 is connected to (pul -) of the driver. The (pul +) with ( dir +) in the driver are linked together to 5V output from the Arduino. the driver powers through the 24V DC power supply ( for this project I use power station).

Finally the stepper motor the driver are connoted together through four links, A(+/-) a should be connected to one side and B(+/-) is connected to the other side. in order to ensure winding is correctly connected used multimeter to measure the resistance if both terminals have low resistance it means that they are one side so connect both to one side. Also use the data sheet of your stepper more for more information about these connections.

Hardware Connections

IMG_7948.JPG
IMG_7949.JPG
IMG_7951.JPG
IMG_7950.JPG

First connect the positive DIR with positive PUL together as in the photo, then connect them to the 5V terminal of the Arduino as in the second photo. After that connect the stepper motor wires to the stepper driver similar to the third photo (make sure the wires are similar winding by using measuring the resistance or refer to the stepper data sheet) refer to the pervious step . The positive terminal can be connected to the Arduino 5V and ground to have common supply to the reset of the units.

Push Buttons Circuit

IMG_7962.JPG
IMG_7961.JPG

The push buttons role are to turn the stepper motor to the clockwise or anti clockwise with a common speed, place both buttons on the bread board and connect one side to a resistor then input link to the Arduino pin 11 and then to the ground, after that connect the other side of the button to the 5V positive. Next do the same to the other button but connect it to pin 12.

Coding

The code is simple copy the following to code and load it to the Arduino, the important thing to notice that the DIR will receive LOW or HIGH depends on the rotation command. Both buttons are connected to pins 11 and 12.

THE CODE

#define dirPin 2
#define stepPin 3

void setup() {

pinMode(stepPin, OUTPUT);// rotate

pinMode(dirPin, OUTPUT);// direction

pinMode(11,INPUT); // clockwise

pinMode(12,INPUT); // anti clockwise

} void loop() {

while (digitalRead(11)== HIGH)

{ digitalWrite(dirPin, HIGH);

digitalWrite(stepPin, HIGH);

delayMicroseconds(500);

digitalWrite(stepPin, LOW);

delayMicroseconds(500); }

while (digitalRead(12) == HIGH) {

digitalWrite(dirPin, LOW);

digitalWrite(stepPin, HIGH);

delayMicroseconds(500);

digitalWrite(stepPin, LOW);

delayMicroseconds(500); }

}

Final Step

IMG_7963.JPG
IMG_7964.JPG
IMG_7965.JPG

Finally after uploading the code in the Arduino, connect the 24V DC to the stepper driver, next power on all units, to start truing the stepper motor press one the push button and to revere the rotation press on the other button. This project is a simple introduction to operate and integrate high torque stepper motors, and understanding this project can lead you to more complex design.

Hope you had a great time, if you face any difficulty please do not hesitate to send, and share your experience with us.

All the best.