How to drive a stepper motor easily using A4988 and Arduino

Поделиться
HTML-код
  • Опубликовано: 14 сен 2020
  • Driving a stepper motor used to be complicated enough when we have to build a driver by ourselves. But since there are many kinds of driver modules out there, driving a stepper motor is not that hard anymore.
    In this video, we will learn how to use the A4988 stepper driver.
    You can support us and unlock premium projects code by joining our membership by clicking the link below:
    / @miliohm
    You can find the full code and tutorial here:
    miliohm.com/how-to-drive-a-st...
    Music :
    "LAKEY INSPIRED - Chill Day" is licensed under a Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
    Music provided by BreakingCopyright: • [Non Copyrighted Music...
  • НаукаНаука

Комментарии • 69

  • @techdonk9797
    @techdonk9797 3 года назад +2

    how is the code if we using switch sensor as a output of step = high (500 rotation) and dir =high
    and then button switch to delay then change the dir=low step=high (500 rotation)

  • @bo7047
    @bo7047 3 года назад

    I would like to adjust the engine revs using various buttons, does anyone know if this is feasible?

  • @bonfaceosuka
    @bonfaceosuka 2 года назад +3

    Hello , Iam really so gratful for this project because its worked well for my prototype. May God bless you abundantly

  • @user-rg2sw7th8w
    @user-rg2sw7th8w 5 месяцев назад

    Hi, how do you configure the pins of the motor means which pin of motor is pin no.1(connected to 2B). I am not able to do as I am using BJ42D22- 23V01 NEMA17 motor.
    For me it is not working properly.

  • @napkin62
    @napkin62 2 года назад +4

    nice buddy..but show us to use multimeter to measure the required current how slowly..

  • @franciscabesas7215
    @franciscabesas7215 2 года назад

    does this work also in cnc shield?

  • @INICIANTESDAARTE
    @INICIANTESDAARTE Год назад

    Eu estou com um projeto para uma maquina na area da serigrafia . Com motor nema 17 e um eixo T8 na vertical e uma chave fim de curso em cima e outra em baixo . E dois botoes um para ativa o moto para decer e para quando ativa a chave fim de curso e outro botao para subeir o motor e para quando ativa a chave fim de curso . Mais nao sei como vou fazer isso nao sei mexe com arduino e nem programa .esse meu projeto e bem simples espero um dia consegui .

  • @ritesha8050
    @ritesha8050 Месяц назад

    hello, please help, my motor is just vibrating. Also im usin 24v, is that the issue?

  • @ZafodB3
    @ZafodB3 2 года назад +2

    In your calculation the "2.5" value is a bit of a mystery. I assume it represents the "sense Resistor" value times the motors stepper setup percentage use (in my case this should be i00%). In another video the formula was "Imot x 8 x Sense Resistance (according to this guy the value "for most A4988"(?) for this resistance is 0.068 Ohms). With his calculation I get a VRef = 0.816 Volts and with your calculation I get a VRef = 0.600 Volts. Which is correct? How do I know (without burning up my stepper or driver)? The only Spec Sheet I found doesn't list a "Sense Resistor Resistance", where can I find this value reliably?

    • @NedSar85
      @NedSar85 9 месяцев назад +1

      Hi! where you able to find the solution? I have the same issue

    • @ZafodB3
      @ZafodB3 9 месяцев назад

      The truth is “not with any confidence” but it worked anyway. The two surface mount resistors next to pins 18 and 24 (on my board) when magnified have 100 imprinted on them. From there I did some research to determine what the value of the SMD’s were (it’s been a while and I’d have to rediscover my notes and research), however these appeared to be, also based on blogs and conversations like this, to be the correct resistors who’s value(s?) were used to calculate, hopefully correctly. The result in the end was that my NEMA 17 driven star tracker worked. However mechanical issues related to the PLA 3D printed frame and gears driven by a curved threaded rod produced other issues. If I do this again I will pivot a straight rod and make the frame from 3/8” plywood in order to safely support my heavy camera rig. A lot of frustrations in this project that ultimately left me with more problems than time to solve them. The A4988 was the least of my concerns!

    • @ZafodB3
      @ZafodB3 9 месяцев назад

      @@NedSar85 Note! That there is a reply to your question but you have to open the discussion to see it. I replied the wrong way, sorry!

  • @ericksaucedo5450
    @ericksaucedo5450 3 года назад

    Hi my friend, I have a question, and maybe you can help me, so, how can I control 2 motor to move at same time, can I take same signal for to drivers? Tks

    • @miliohm
      @miliohm  3 года назад +1

      Yes you can, but you should know that the amperage maybe become a problem. The driver will get hot easily.

  • @ramirezkine5704
    @ramirezkine5704 2 года назад

    How much amps and do you need for moving the motor? Does it get a good torque? Thanks!

    • @qnaman
      @qnaman Месяц назад

      Not so much seeeing power cable is 20-18awg. My bet it's less than 2 amps.

  • @STEVANUSGameDev
    @STEVANUSGameDev 2 года назад +1

    why my stepper cant move ?

  • @matteo507
    @matteo507 3 года назад

    Thanks

  • @isaacelbaz8963
    @isaacelbaz8963 3 года назад

    u change my life thx

    • @miliohm
      @miliohm  3 года назад

      Thank you bro!

  • @hppavilion6484
    @hppavilion6484 2 года назад

    i am facing the same problem had tried all the solutions changing wire combination, code, pins drivers but the motor is still sometime gives a beep only or rattles with beep and the strange thing is that motor is showing continuity in all four pairs, led blew up no matter what the wire combination is it show continuity on pairing 1,2 -1,3 -1,4 and so on for all. I had tried running motor directly with arduino without motor driver and it is running, but facing issue while it is connected to CNC shield with A4988 driver.
    I am using Arduino uno and motors are 4 pinned. Could you please tell me what I am doing wrong?

    • @miliohm
      @miliohm  2 года назад

      are you already set the max current using the potentiometer?

    • @hppavilion6484
      @hppavilion6484 2 года назад

      @@miliohm yup current is up to the mark

    • @hppavilion6484
      @hppavilion6484 2 года назад

      @@miliohm can you please tell me the reason that why motor is coils is showing continuity in all pairs ? wont it just show in any 2? but its showing continuity with every coil, like I Checked continuity on pin 1 and 2 Ammeter beeps and then I connected pin 1 and 3 it again shows continuity and same goes with pin 2 and 4. it's Nema 17 stepper motor with 4 pins. Can you tell me the reason behind this? AFAIK It should show continuity on any 2 and not on all. Correct me if I am wrong
      Thanks.

  • @harshadgunjikar1595
    @harshadgunjikar1595 3 года назад

    How to drive two stepper motor using two drivers????? Is it possible?????

  • @KACZMARCZYK4369
    @KACZMARCZYK4369 Год назад

    What’s the name of the part that you screw with the screwdriver?

    • @miliohm
      @miliohm  Год назад +2

      It's called trimpot or potentiometer

  • @pradanaputrak
    @pradanaputrak 3 года назад

    Untuk barang2 nya apakah bisa di beli di online market place indonesia? Boleh tau untuk nama/jenis motor stepper nya?

    • @miliohm
      @miliohm  3 года назад

      Banyak mas, bisa cari dengan kata kunci stepper nema 17

    • @pradanaputrak
      @pradanaputrak 3 года назад

      Makasih mas, sangat membantu

    • @miliohm
      @miliohm  2 года назад

      @Istiqlal Silaban namanya breadboard broo

  • @zvonimirculjak4825
    @zvonimirculjak4825 Год назад

    6:13 I can't get this voltage on my driver with little potentiometer. I get maximum 0,03V. Where is the problem?

    • @miliohm
      @miliohm  Год назад

      Did you use the conductive screwdriver?

    • @zvonimirculjak4825
      @zvonimirculjak4825 Год назад

      ​@@miliohm Hi, I solve this problem, I am using driver L298N. It works perfect, but the motor is overheating after 10min of work. Do you know what is best option for solve this problem?

  • @pradanaputrak
    @pradanaputrak 3 года назад

    Untuk power supplynya 12v dc 5A apakah bisa?

    • @miliohm
      @miliohm  3 года назад

      Bisa

    • @pradanaputrak
      @pradanaputrak 3 года назад

      Berarti gambar rangkaian yang di web itu kapasitor 47uF cukup menggantinya menggunakan power supply seperti di video ya?

  • @sampuraktalukdar1374
    @sampuraktalukdar1374 Год назад

    What is the silver thing you stick on the top of the chip?

    • @miliohm
      @miliohm  Год назад

      that's called a heatsink, a metal to increase the heat of the IC.

    • @sampuraktalukdar1374
      @sampuraktalukdar1374 Год назад

      @@miliohm Thanks for replying so fast.....I just googled it and found out from there also.

    • @robertbrodersen4438
      @robertbrodersen4438 Год назад

      @@sampuraktalukdar1374 It's Aluminum, to decrease heat of the IC. It's very important for the driver and motor to be able to use the rated current (around 2.5A for my Nema 17). Without the heatsink, it's only rated for half the current! Get some.

    • @MikeJohnMentzer
      @MikeJohnMentzer Год назад

      @@robertbrodersen4438 Oh thanks for the info?
      So the motor not running in my case may probably be due to the lack of heat sink?....
      Also I kept an led at the 4 outputs of the driver and it didn't blink neither damage (due to excessive volts) , so does that mean the driver ain't giving no output?

  • @vincentiusdhimasr.p.2695
    @vincentiusdhimasr.p.2695 3 года назад

    Mau tanya bang, kalau motor nya tidak bisa berputar ccw itu kenapa ya? Padahal sudah sama seperti di video juga

    • @miliohm
      @miliohm  3 года назад

      Apakah sudah diatur arus maksimalnya?

    • @vincentiusdhimasr.p.2695
      @vincentiusdhimasr.p.2695 3 года назад

      @@miliohm Vref nya saya atur 0,5 V. Apakah kurang kalo utk motor nema 17?

    • @miliohm
      @miliohm  3 года назад

      @@vincentiusdhimasr.p.2695 Coba-coba aja diputar naik turun, kalau tetep ga jalan cek apa wiringnya sudah benar. Dan kalau tetep tidak jalan coba pake ganti drivernya. kadang kalau yang bajakan suka ada yang rusak

    • @vincentiusdhimasr.p.2695
      @vincentiusdhimasr.p.2695 3 года назад

      @@miliohm siap, terimakasih infonya 🙏

  • @joelgoberdhan5977
    @joelgoberdhan5977 2 года назад

    thank you for this you are very good in teaching

  • @fashion7009
    @fashion7009 3 года назад

    maximal voltage a4988 ??

    • @miliohm
      @miliohm  3 года назад

      Motor max voltage is 35V

  • @ildomarcalcado7418
    @ildomarcalcado7418 Год назад

    In my case. It does not work. I tried different arduino boards (uno, mega), different steppers (nema 17) and a4988

    • @miliohm
      @miliohm  Год назад

      Sometimes there is fake A4988 in the market. It really easy to get hot, and doesn't work. Check the temperature of your A4988

    • @MikeJohnMentzer
      @MikeJohnMentzer Год назад

      @@miliohm Hey do you know how to check if A4988 is working or not?...

  • @pradanaputrak
    @pradanaputrak 3 года назад

    Min ini punya saya awalnya bisa normal terus skrg muternya ga jelas cuma geter2 aja gitu knp ya? Saya sudah cek wiring tidak ada yg salah

    • @miliohm
      @miliohm  3 года назад

      Coba putar potensio yang buat arus mas

    • @pradanaputrak
      @pradanaputrak 3 года назад

      Di perbesar apa diperkecil ya min?

    • @miliohm
      @miliohm  3 года назад

      Dicoba adjust aja, naik turun biasanya gerak

  • @salsabilatg
    @salsabilatg 3 года назад

    Mas ada schematic wiring nya ga ya

    • @miliohm
      @miliohm  3 года назад

      Coba dibaca deskripsinya mba

  • @chanoq7081
    @chanoq7081 3 года назад

    Boleh minta codingnya paman

    • @miliohm
      @miliohm  3 года назад

      baca deskripsinya bro

    • @chanoq7081
      @chanoq7081 3 года назад

      @@miliohm ok siap trimakasih

  • @pengenjadiilmuan9631
    @pengenjadiilmuan9631 3 года назад

    Mosok didin iki?
    Wkwkwk

    • @miliohm
      @miliohm  3 года назад

      iyo mas, rak percoyo ik. wkwk

  • @BaronVonBiffo
    @BaronVonBiffo 3 года назад +4

    Because you have a strong accent it's a little difficult to understand you. The completely unnecessary background "music" makes it all but impossible.

    • @miliohm
      @miliohm  3 года назад +1

      Thanks for the suggestion, will do better next time. And please turn on the subtitle to understand more

  • @pattisimus5944
    @pattisimus5944 Год назад +1

    // A4988 Stepper Motor Driver Pins
    const int dirPin = 7;
    const int stepPin = 6;
    const int enablePin = 5;
    // Stepper motor steps per revolution
    const int stepsPerRevolution = 200;
    void setup() {
    // Set the enablePin, dirPin, and stepPin as OUTPUT
    pinMode(enablePin, OUTPUT);
    pinMode(dirPin, OUTPUT);
    pinMode(stepPin, OUTPUT);

    // Enable the motor by setting enablePin LOW
    digitalWrite(enablePin, LOW);
    }
    void loop() {
    // Set the motor direction to clockwise
    digitalWrite(dirPin, HIGH);

    // Step the motor for one revolution
    for (int i = 0; i < stepsPerRevolution; i++) {
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(500); // Adjust this delay to control motor speed
    digitalWrite(stepPin, LOW);
    delayMicroseconds(500); // Adjust this delay to control motor speed
    }

    delay(1000); // Delay between rotations

    // Set the motor direction to counterclockwise
    digitalWrite(dirPin, LOW);

    // Step the motor for one revolution
    for (int i = 0; i < stepsPerRevolution; i++) {
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(500); // Adjust this delay to control motor speed
    digitalWrite(stepPin, LOW);
    delayMicroseconds(500); // Adjust this delay to control motor speed
    }

    delay(1000); // Delay between rotations
    }