How to connect a stepper motor to Arduino? - sample diagram
How to connect a stepper motor to Arduino? - sample diagram

Arduino - connection of a stepper motor according to the diagram

Connecting stepper motors is a real challenge for many people.
The easiest way to connect the motors is to use ready-made, proven solutions such as the CNC BlackBox OpenBuilds controller, which will allow us to start the stepper motors in a few minutes.

Dedicated drivers are a very good solution when we plan to build a device, a CNC milling machine, a plotter with a laser and other similar devices.

It happens, however, that the purchase of a driver for a given project may turn out to be too expensive or we are simply looking for another solution

 

Arduino and stepper motor

Many hobby and semi-professional projects can be created using, for example, Arduino. These “microcomputers” allow us to create many unique solutions and they are widely used in many industries.

Many people ask us the question - "How to connect a stepper motor to Arduino?", So we have prepared a short guide for you in which we will show you in a few steps how to use Arduino to control a NEMA stepper motor.


So let's get down to business!

What will we need to run a stepper motor with Arduino?

  1. Arduino UNO copy or original

    1. KOPIA: https://www.v-slot.pl/arduino-uno-r3-compatible

    2. ORYGINAŁ: https://www.v-slot.pl/arduino-uno-rev-3-oryginal

  2. Power Supply 5V

  3. Power Supply 24V
    https://www.v-slot.pl/pl/p/Zasilacz-MEAN-WELL-LRS-100-24-24V4.5A/1107

  4. Stepper motor NEMA 23
    https://www.v-slot.pl/pl/p/Silnik-krokowy-NEMA-23-HTS-OpenBuilds/1827

  5. Driver  DM542T https://www.v-slot.pl/pl/p/Cyfrowy-sterownik-krokowy-1.0-4.2A-20-50VDC-dla-silnika-krokowego-Nema-17%2C-23%2C-24/2645

  6. A computer with Arduino IDE installed
    Downloa here 

  7. Cables (here you have to choose cables of appropriate length and cross-section, below the cable for example cables)

    1. https://www.v-slot.pl/pl/p/Przewod-polaczeniowy-meski-na-zenski-wielokolorowy%2C-dlugosc-50-cm-40-szt.-/2683

    2. https://www.v-slot.pl/pl/p/Kabel-zasilajacy-2000mm-2-zylowy-1mm/3294

    3. https://www.v-slot.pl/pl/p/Gotowe-przewody-elektryczne/921

 

It is worth noting here that this is an example of the elements needed to start the engine. It should be remembered that the listed items 3-5 may be completely different. Depending on what stepper motor you choose, you should select the appropriate driver and the power supply for it.

 

How to connect an arduino with a stepper motor? - diagram

So let's assume that you have selected all the necessary elements and we can proceed to the connection.

Below you will find a diagram where it is shown exactly how to connect the wires from the stepper motor to the driver, how to power the driver and which pins should be used to connect the wires between the driver and the Arduino.

 

  1. Connect the DIR + and PUL + connectors from the DM542T driver to the pins on the Arduino using wires. For example :

    1. DIR+ to PIN8

    2. PUL+ to PIN9

  2. Connect the DIR-, PUL- and GND connectors to the GND connector on the Arduino

  3. Connect the power cord to the 24V power supply

  4. Connect V + from the power supply to the V + connector on the DM542T driver

  5. Connect V- from the power supply to the GND connector on the driver

  6. Connect a pair of wires from the motor to the A + and A- connectors (remember to check which wires of the stepper motor form a party.How to find pairs of wires in the stepper motor - see the video below)

  7. similarly to step 6, connect another pair of wires from the stepper motor to the B + and B- connectors

  8. Write a control program on your computer and upload using the Arduino environment (an example of the code can be found below)

  9. Upload the program to Arduino and power the arduino using the 5V power supply

  10. Connect the power (230V) to the 24V power supply

 




THE MOVIE “CHOOSING PAIRS OF CABLES FOR STEPPING MOTORS

https://youtu.be/0woxrCEWYNI

 

EXAMPLE CODE :


int x;

void setup() {

pinMode(9,OUTPUT); // ustaw Pin9 jako PUL

pinMode(8,OUTPUT); // ustaw Pin8 jako DIR

}

void loop() {

digitalWrite(8,HIGH); // ustaw stan wysoki dla określenia kierunku

for(x = 0; x < 400; x++) //

{

digitalWrite(9,HIGH);

delayMicroseconds(500);

digitalWrite(9,LOW);

delayMicroseconds(500);

}

delay(1000);

digitalWrite(8,LOW);

for(x = 0; x < 400; x++)

{

digitalWrite(9,HIGH);

delayMicroseconds(500);

digitalWrite(9,LOW);

delayMicroseconds(500);

}

delay(1000);

}

 

READY!
If you connected everything correctly, your engine should be running. If the engine did not work, check the correct connection of the wires. If you have any questions, you can contact us by e-mail or by commenting on the video, where we show you the entire process described above step by step.


VIDEO: HOW TO CONNECT A STEP MOTOR TO ARDUINO?

 

Formy płatności

up
Shop is in view mode
View full version of the site
Sklep internetowy Shoper.pl