28BYJ-48 STEPPER MOTOR WITH ULN2003 DRIVER - Arduino tutorial #14

แชร์
ฝัง
  • เผยแพร่เมื่อ 14 พ.ค. 2024
  • This Arduino tutorial teaches you to control the 28BYJ-48 stepper motor with a ULN2003 driver.
    A stepper motor is a very versatile motor. The nice thing is that you can control exactly the amount of rotation. These are for example used in printers for feeding the paper into the printer. The 28BYJ-48 is easy to control from an Arduino when using the ULN2003 driver board.
    In this tutorial I show you how to use an external power supply for your stepper motor. This is better than drawing current from the Arduino board. In this video I explain why as well as the circuit schematics.
    The Arduino for beginners tutorials series guides you through the world of Arduino. A video is around 10 minutes and shows you step-by-step how to build the circuit and write the code. The website contains the course material, circuit diagram, Arduino code and shopping list of all the components used in the tutorial.
    ⬇️ Arduino code, circuit diagram and part list arduino-tutorials.net/tutoria...
    👉 More tutorials and projects on arduino-tutorials.net
    🇳🇱 Deze tutorial is ook in het Nederlands beschikbaar • 🇳🇱 28BYJ-48 STAPPENMOT...
    CHAPTERS:
    00:00 Components needed
    00:38 The stepper motor
    01:40 The motor driver
    02:32 Building the circuit
    04:09 Arduino code - stepper motor
    09:04 The working project
    COMPONENTS
    🇨🇳 Arduino Uno (clone) with cable - AliExpress
    arduino-tutorials.net/r/Jd28hF
    🇳🇱 Arduino Uno (clone) - Opencircuit
    arduino-tutorials.net/r/8237Hd
    🇳🇱 Arduino Uno SMD (original) - Opencircuit
    arduino-tutorials.net/r/Ud29dh
    🇳🇱 Arduino Uno Chip (original) - Opencircuit
    arduino-tutorials.net/r/Jd82ha
    🇨🇳 1x breadboard small - AliExpress
    arduino-tutorials.net/r/7364GD
    🇳🇱 1x breadboard small - Opencircuit
    arduino-tutorials.net/r/238Jds
    🇨🇳 1x breadboard large - AliExpress
    arduino-tutorials.net/r/FDH28dh
    🇳🇱 1x breadboard large - Opencircuit
    arduino-tutorials.net/r/8237Dh
    🇨🇳 Jumper wire assortment (MM/MF/FF) - AliExpress
    arduino-tutorials.net/r/Fh378fg
    🇨🇳 Jumper wire male-male - AliExpress
    arduino-tutorials.net/r/7346GD
    🇳🇱 Jumper wire male-male - Opencircuit
    arduino-tutorials.net/r/8237Jd
    🇨🇳 Jumper wire male-female - AliExpress
    arduino-tutorials.net/r/sjf83h
    🇳🇱 Jumper wire male-female - Opencircuit
    arduino-tutorials.net/r/a7DH2g
    🇨🇳 Stepper motor with ULN2003 driver - AliExpress
    arduino-tutorials.net/r/F83hgd
    🇳🇱 28YBJ-48 stepper motor - Opencircuit
    arduino-tutorials.net/r/7236Gd
    🇳🇱 28YBJ-48 driver - Opencircuit
    arduino-tutorials.net/r/347DHg
    🇨🇳 5V power adapter - AliExpress
    arduino-tutorials.net/r/hG83hd
    🇳🇱 5V power adapter - Opencircuit
    arduino-tutorials.net/r/7236Hd
    🇨🇳 5x Adapter screw plug (male/female) - AliExpress
    arduino-tutorials.net/r/Fh83hg
    🇨🇳 2x Adapter screw plug (male/female) - Opencircuit
    arduino-tutorials.net/r/3482hD
    🇳🇱 5x Adapter screw plug (male) - Opencircuit
    arduino-tutorials.net/r/83u4jH
    #arduino #BasOnTech

ความคิดเห็น • 68

  • @jennifercraig3820
    @jennifercraig3820 3 ปีที่แล้ว

    Hi there, would it be possible to connect a battery pack of 6V as the power supply rather than an adapter? (sorry if this is a silly question, I'm new to electronics and don't want to end up frying my arduino or blowing something up!)

    • @BasonTech
      @BasonTech  3 ปีที่แล้ว +1

      6V is too much, the motor is rated 5V max. Also make sure your battery pack can provide enough amps.

  • @dogme666
    @dogme666 2 ปีที่แล้ว

    hi, thanks for the video! it got me severall steps forward, i have a question though, im using a computer power suply , when i conect it like this to the 12v power rail of the psu it works for about half a minute and stops, the chip gets really hot and if i disconect and wait a bit it works again, do you have any suggestion to what i might have done wrong? my ground rail comes from the power suply as well. any insight on this will be extremely helpfull.
    edit: there is a problem with my uln2003 board, a diferent board works perfectly, gonna trtoubleshoot the traces now, thank you for the video!!!

    • @BasonTech
      @BasonTech  2 ปีที่แล้ว +1

      Thanks for the update! Maybe you've damaged the ULN2003 chip with a faulty connection and that makes it hot?

    • @dogme666
      @dogme666 2 ปีที่แล้ว

      @@BasonTech the ic works on a different board, so I suspect there is a short on the little circuit board.

    • @BasonTech
      @BasonTech  2 ปีที่แล้ว

      Great you got it working, well done! 😃

  • @juliusaitken
    @juliusaitken 2 ปีที่แล้ว

    Hi Baz! How would i amend the code to control TWO stepper motors so they behave completely independently?

    • @BasonTech
      @BasonTech  2 ปีที่แล้ว

      What part did you get stuck and did not work?

  • @heathcarter4654
    @heathcarter4654 3 ปีที่แล้ว

    Cheers really usefull

    • @BasonTech
      @BasonTech  3 ปีที่แล้ว

      Great to hear, thanks! 😃

  • @v.ssarath911
    @v.ssarath911 2 ปีที่แล้ว

    THANKS a lottttttttt. THANK YOU SOO MUCH

    • @BasonTech
      @BasonTech  2 ปีที่แล้ว

      Glad I can help 😃

  • @ersatz7107
    @ersatz7107 4 ปีที่แล้ว

    is there a code for controlling the motor with a potentiometer like how you would control a servo motor with a potentiometer?

    • @BasonTech
      @BasonTech  4 ปีที่แล้ว

      You can combine the code of the potentiometer tutorial with this one. Convert the range of the potentiometer to the amount of degrees you want the motor to rotate.

  • @last1b4free
    @last1b4free 3 ปีที่แล้ว

    new subscriber !

    • @BasonTech
      @BasonTech  3 ปีที่แล้ว +1

      Welcome! 😃

  • @Marco.Malatesta
    @Marco.Malatesta 4 ปีที่แล้ว

    hello and congratulations for the video, I need the same code but for 2 motor steppers, do you know what I should modify? thanks and good day.

    • @BasonTech
      @BasonTech  4 ปีที่แล้ว +1

      It is basically the same code. You define another 4 pin variables e.g. motor2Pin1, motor2Pin2 etc. And create a second instance of the stepper like:
      AccelStepper stepper2(AccelStepper::HALF4WIRE, motor2Pin1, motor2Pin3, motor2Pin2, motor2Pin4);
      Instead of stepper.setMaxSpeed(1000.0); your now use stepper2.setMaxSpeed(1000.0);
      So everything works the same but now you have two instances: stepper and stepper2. Hope this helps :)

    • @BasonTech
      @BasonTech  4 ปีที่แล้ว

      @@Marco.Malatesta On arduino-tutorials.net there is a contact button which you can use :)

    • @Marco.Malatesta
      @Marco.Malatesta 4 ปีที่แล้ว

      @@BasonTech Hi, after many tests I managed to modify the code, now it works well, thank you for the help you have given me, bye.

    • @BasonTech
      @BasonTech  4 ปีที่แล้ว

      Great! Unfortunately this is the best way to learn stuff ;)

  • @rekhasaini672
    @rekhasaini672 2 ปีที่แล้ว

    Can I use a 5v breadboard supply module for instead of the adapter

    • @BasonTech
      @BasonTech  2 ปีที่แล้ว

      You can, but you shouldn't. The motor can draw peak powers which could damage your Arduino.

    • @rekhasaini672
      @rekhasaini672 2 ปีที่แล้ว

      Thank you

  • @Brandon-qp7gq
    @Brandon-qp7gq 2 ปีที่แล้ว

    how is it safe to connect the ground of the power supply to the arduino while the positive voltage comes from elsewhere? what if the power supply is a battery?

    • @BasonTech
      @BasonTech  2 ปีที่แล้ว

      I don't understand your question. They share a common ground but the circuits are individual for powering the motor and for the driver.

  • @dinzzz0000
    @dinzzz0000 2 ปีที่แล้ว

    Hi, my stepper is vibrating nut it is not actually rotating :( do you know what the problem might be ?

    • @BasonTech
      @BasonTech  2 ปีที่แล้ว +1

      Hi, make sure the wires are connected correctly. Other thing could be the power supply not being connected correctly

  • @iszjhxsbxb
    @iszjhxsbxb 4 ปีที่แล้ว +1

    how many stepper motors can i control with ardino uno

    • @BasonTech
      @BasonTech  4 ปีที่แล้ว

      Theoretically as much as you want. Practically there are some limitations: speed of controlling all motors, current drawn by the motors, the number of pins available. This topic quite covers your question forum.arduino.cc/index.php?topic=241152.0

  • @biswa145
    @biswa145 4 ปีที่แล้ว

    What is the steps per revolution of the stepper motor you used?

    • @BasonTech
      @BasonTech  4 ปีที่แล้ว

      Hi Mishra, Officially it is 64, some people at forum.arduino.cc/index.php?topic=71964.15 calculated it is actually 63.68395 😃

    • @biswa145
      @biswa145 4 ปีที่แล้ว

      @@BasonTech There's no single answer. Some are saying it's 64, some saying it's 4096?!

  • @fadygharbi7479
    @fadygharbi7479 2 ปีที่แล้ว

    Hi there I did the same code
    The motor is just vibrating not turning any solution ?

    • @BasonTech
      @BasonTech  2 ปีที่แล้ว

      If the code is exactly the same, please check your wiring. Maybe there is a loose connector or the wrong power supply.

  • @carlosvargas1443
    @carlosvargas1443 2 ปีที่แล้ว

    where is the course description so I look at the code

    • @BasonTech
      @BasonTech  2 ปีที่แล้ว

      It depends how you watch this video. You'll find all the links in the video description. For this tutorial it is arduino-tutorials.net/tutorial/control-28byj-48-stepper-with-uln2003-driver-with-arduino 😃

  • @ValerianKapeller
    @ValerianKapeller 2 ปีที่แล้ว

    Why always 8,9,10,11 pins on the arduino? Can i go for 2,3,4,5 as well?
    Thank you :)

    • @ahmadaidit6175
      @ahmadaidit6175 2 ปีที่แล้ว

      i think you can, just change the pin at 4:45

    • @BasonTech
      @BasonTech  2 ปีที่แล้ว +1

      Hi, that depends on the requirement of the pins. Pin 2, 3, 4 and 5 could work but you have to keep in mind if your application needs for example PWM pins. It then is important to select the correct ones.

    • @ValerianKapeller
      @ValerianKapeller 2 ปีที่แล้ว

      @@BasonTech thank you very much for your answer! :) Got it!

  • @alanpereira6824
    @alanpereira6824 3 ปีที่แล้ว

    I want to turn off the stepper motor once it rotates half way. I do not want it to loop. Can the driver do that?

    • @BasonTech
      @BasonTech  3 ปีที่แล้ว

      Sure, that should not be a problem

  • @expires_today
    @expires_today ปีที่แล้ว

    I have a problem, I connected everything correctly, but the motor only makes sounds and does not spin, it also vibrates, I have already tried to increase the voltage, but it still does not work

    • @BasonTech
      @BasonTech  ปีที่แล้ว +1

      It could be that the pin layout is different on you PCB board. Then the steps will not work.

  • @OregonDARRYL
    @OregonDARRYL 3 ปีที่แล้ว

    Line 29 reads "degrees per revolution"... when I think you meant "degrees per one full step".

    • @BasonTech
      @BasonTech  3 ปีที่แล้ว

      Hi Darryl, 1 revolution is 360 degrees. It has 64 steps per revolution. 360 / 64 = 5.625 degrees per revolution. This is the same as degrees per one step.

    • @OregonDARRYL
      @OregonDARRYL 3 ปีที่แล้ว +1

      @@BasonTech 360 degrees per one revolution. 5.625 degrees per step. Line 27 in your code says "5.625 degrees per revolution". That is incorrect. Good video though. Thanks.

  • @azozalshateri5029
    @azozalshateri5029 3 ปีที่แล้ว

    The ULN2003 driver dose not show lights, I do not know why?

    • @BasonTech
      @BasonTech  3 ปีที่แล้ว +1

      Are you sure you've powered the motor and board correctly?

    • @azozalshateri5029
      @azozalshateri5029 3 ปีที่แล้ว

      @@BasonTech yes, I am so sure that I do the same what you did in the video.
      May there a problem in Uln2003 itself or the type of Arduino because when you run the code it appears green light in your Arduino but my Arduino red light apears.

    • @azozalshateri5029
      @azozalshateri5029 3 ปีที่แล้ว

      @@BasonTech many thanks, I solved the problem. The problem was the jumper was not connected to the Uln driver.

    • @BasonTech
      @BasonTech  3 ปีที่แล้ว +1

      Great to hear you've solved it, thanks for sharing! 😃

  • @speedstacker593
    @speedstacker593 ปีที่แล้ว

    When I connect my external power supply, same as yours, my arduino does not light up and turn green and orange. Any idea why? Wiring is identical as in the video

    • @speedstacker593
      @speedstacker593 ปีที่แล้ว

      I believe it is the power adapter. When I plug the external source directly into the arduino, it works fine but when I use the adapter and wire like you it doesn’t not work

    • @BasonTech
      @BasonTech  ปีที่แล้ว

      Maybe the voltage is too low?

    • @speedstacker593
      @speedstacker593 ปีที่แล้ว

      @@BasonTech it works when it is just the power supply plugged into the arduino. When I use the adapter and breadboard it does not work

    • @BasonTech
      @BasonTech  ปีที่แล้ว

      Sound like an incorrect wiring or a faulty breadboard

    • @speedstacker593
      @speedstacker593 ปีที่แล้ว

      @@BasonTech The breadboard is working properly and the wiring is identical to the video. I will keep playing around with it and see what I can get. Thank you for the help!

  • @santhosheaswaramoorthy8685
    @santhosheaswaramoorthy8685 3 ปีที่แล้ว

    Why are you using power plug?

    • @BasonTech
      @BasonTech  3 ปีที่แล้ว

      You want to separate the motor current form the Arduino current. The high peaks might damage your Arduino. Therefore I make the motor power go completely separated from the Arduino one.

  • @nadavdanieli
    @nadavdanieli 2 ปีที่แล้ว

    It moves 90 degrees, (as defined in the code) :)😝

  • @Koto-Sama
    @Koto-Sama 4 ปีที่แล้ว

    2:44 this is incorrect for this type of motor

    • @BasonTech
      @BasonTech  4 ปีที่แล้ว

      Thanks for your remark, I've removed the scene from the video

    • @Koto-Sama
      @Koto-Sama 4 ปีที่แล้ว

      @@BasonTech thx