Arduino Beginners Getting Started With NEMA 17 Stepper Motor and The L298N Motor Driver Module
HTML-код
- Опубликовано: 14 июл 2024
- This video is for Arduino beginners who are getting started with the a basic bipolar stepper motor. We will be using the popular NEMA 17 stepper motor and the L298N motor driver module to run this motor. Over view of stepper specs and how to connect a stepper to a driver board. Thanks for checking it out. Join the conversation below!
🔔🔔 SUBSCRIBE 🔔🔔 don't forget to subscribe and click the bell!
/ @bmonsterlaboratory
Facebook: / bmonster-laboratory-10...
++get the code from the STEPPER library in Arduino IDE
Twitter: / b_monsterlab
check out our Arduino play list!
• Easy Arduino projects ...
see how to set up Arduino IDE and download libraries - • The Most Complete Star...
see our previous stepper motor video - • How To Connect A Stepp...
create pin connectors for your Arduino jumper wires - • How To Crimp and Use P...
chapters:
0:00 intro
0:23 components for this video
1:37 introduction to the NEMA 17 stepper motor
2:15 bipolar vs unipolar stepper motors
3:24 what is step angle of a stepper motor
3:45 what is a 2 phase stepper motor
7:31 intro to the L298N driver motor driver module
10:19 stepper motor connection diagram
11:16 run example code from Arduino IDE STEPPER library
15:57 run example #2 code from Arduino IDE STEPPER library
Here is the Amazon info for some items I used in the video. Just go to Amazon and type in the ASIN.
Of course, if you can find them cheaper on Ebay or your local electronics shop, buy them there.
NEMA 17 2-pack stepper motors - ASIN: B09STZTR5H
L298N motor driver - ASIN: B07BK1QL5T
Love it great
Thank you, Racquel. Very kind!
Awesome video. I bought my own controller/driver to use in conjunction with my captive actuator. You helped me overcome some conceptual mountains!
Great to hear! Stick with it and you'll learn something new every day. Good luck with your future projects and thank you for this comment 👍 👍
Great video, exactly what I was looking for. Thank You!
hey there! Thanks for the compliment, I appreciate it. I'm glad you found the video useful 👍
It’s very simple… but I truly appreciate seeing everyone’s instructions on how to use these.
I need to see how the pins on other motor drivers actually impact speed etc….
Thanks! I agree, it is simple once you connect a stepper or use it in a project or 2. Which motor drivers are you referring to? I have a couple of others.
Really great tutorial! Thanks for the thorough explanations.
I appreciate your comment, thanks! I'm glad it was helpful 👍
Thanks for this!!
My pleasure! Thanks for leaving this message 👍
I am your subscriber good explaining
Thanks! I appreciate you watching and seeing this comment 👍
Nice job
Thank you! I appreciate the comment 👍
Really instructional, I am about to automate a little Christmas scene using a stepper motor with a NEMA 17 10.4 V 0.33 A . I am just trying to figure out why you need two power sources? The 9V and the computer powering the Arduino? I didnt know why you cant run the entire thing off of the power jack? Im pretty illiterate with electricity honestly though. Thank You!
Hi Chris! thanks for the comment. Sounds like a fun project you're about to dive into. I don't power motors from the Arduino and in this video you can see I just chose to leave the USB plugged in for a power source. If you run a motor off the power pin of your Arduino it could potentially kill your board. Some small motors may be ok to run off the Arduino, but I just make it a habit to use external power when I run motors and other devices with similar power requirements. I could have unplugged the USB and connected the 9v power rail of the bread board to the VIN pin on the Arduino and to the motor driver. 9v is ok to use on both (Arduino & motor driver) because they both have a 5v regulator. I hope that helps. If you have any questions throughout your project, just shoot me a question on here, Facebook, or email. Good luck and Merry Christmas!
Hey, be carefull when copying the schematic from the video. I tried to copy what was done in the video, but the motor kept spinning in random directions. I followed the instructions as closely as possible, but it still didn't work for me. I even used the same model of motor and driver. As a last ditch effort i swapped a couple of the wires going from the driver to the stepper motor in an act of desperation, and after dozens of hours of brain-rott it magically worked. Not sure if the diagram is wrong or i had a faulty product but it finally worked. Im not mad at the creator, i just want share my experience, so that it may help at least someone out there.
Kind regards Hen ry
hi, thanks for the heads up. Sorry to have delayed your project. do you know which wires you switched? I was sure I had this diagram nailed down correctly. I'll go back and try it out again. Thanks again for the info
Thanks for the tutorial! Quick question: Do the 4 pins on the Arduino connected to the L298N motor drive module have to be PWM pins, or can they be regular digital pins? Also, would analog pings A0 - A5 work as well?
Hi there! The 4 pins don't have to be pwm, they can be digital or Analog. The Arduino has an analog-to-digital converter (ADC) that measures the value of analog signals. The ADC converts the analog voltage into a digital value. Use analogWrite(pin, value) to get the value. We can also use a potentiometer at A0 to control the stepper speed, but that's perhaps a video for another day.
In the code we used here, just replace line 24 with this:
Stepper myStepper(stepsPerRevolution, A0, A1, A2, A3);
The code in the video is the stepper_oneRevolution.ino example in the Stepper.h library. Hope that helps!
Second 😉
Couple questions:
1. Is the power 1-2 amps at 12 volts safe for humans? Do you need to take precautions?
2. How do you know it's safe to power the arduino via the computer? Eg that electricity isn't feeding back through the signal wires from the driver board? Also the driver is powered from the house circuit, but what if the laptop is on battery power? What does it mean to connect the ground of the battery to the ground of the DC power supply from the wall?
Also, thank you for this great tutorial!
Hi there!
1. 12v is considered low voltage and 1-2amp is considered relatively low as well. You should always take precautions regardless of the amount of voltage and current you are using. Low current, as low as 10-20ma, could cause heart arrythmias. There are many factors in determining what is safe and what is not. Check out this website www.hsa.ie/eng/topics/electricity/dangers_of_electricity/
If you're not comfortable with electric circuits, get help from someone who is experienced. Practice connecting low power circuits until you're confident. As always, be careful with electric connections and avoid getting shocked 💪
2. Standard USB from a computer is 5v. It may fluctuate from 4.75 to 5.25 but I have never had a problem with powering small peripherals like leds or motion sensors this way. I have connected Arduino to my laptop and it has worked fine. If I ever use more than a couple leds or more than 20ma on one arduino pin, I will always use external power and I never power motors of any sort directly from my board.
Current does not go through Arduino signal wires. Arduino signal wires carry digital signals, which are represented by voltage levels. When a signal wire is high, it is at 5V. When a signal wire is low, it is at 0V. The current that flows through Arduino signal wires is very small, typically less than 1 mA. This is because Arduino signal pins are not designed to carry high currents. If you need to power a device from an Arduino signal pin, you will need to use a transistor or other circuit to amplify the signal current.
Did I say connnect the ground of the battery to the ground of the dc power supply from the wall? I was searching the caption and couldn't find it so i'm not sure what I was referring to.
If you look at 10:20 I have 9v 1amp coming from a regulated power supply plugged into the wall. The positive wire is connected to the driver pin that powers the IC’s internal H-Bridge, which drives the motors. You can use 5-12v here. The neg wire is connected to the ground rail - you want your circuit grounded. If you want to unplug the USB power and connected Arduino VIN pin to the 9v rail, you could power the board that way.
Thanks for the great questions. I hope I answered them without too much rambling. This is a hobby I enjoy and if you have anymore questions, please feel free to ask! Good luck!
Thanks, Brandon!
@@BMonsterLaboratory wow, thank you for such a thoughtful response! This helps!
you're welcome! enjoy your Arduino projects ~
How much torque does it produce with the 9 volt input pls ?
Hi there! This 4.1v stepper at 9v will probably produce torque below the rated number on the Amazon post. 9v works for me but a nema 17 @ 4.1v has a recommended operation voltage of 10-12v. A nema 17 with a voltage rating of 4.1 operating at 9v 0.5A may produce a holding torque around .2Nm and operating at 1A could produce .4Nm (57oz-in). It's just an estimate and could change under different conditions.
5:00 Sadly you are not explaining how to calculate your values.
the NEMA17 stepper has 200 steps per revolution with a step angle of 1.8 degrees. With 360 deg in a full circle, 360 / 1.8 = 200 steps for one complete revolution.
If you want to adjust the timing of your rotation check out my previous video - ruclips.net/video/I9GUL64_3Xw/видео.html - at 5:41 Thank you for pointing that out. If you have any questions I'm happy to do my best answering. good luck to you! 👍
wheres the code and diagram ?
Hi! Code is straight from the stepper.h library. I show you how to load it to your board in the video. There is also a diagram in the video. 👍
【p】【r】【o】【m】【o】【s】【m】 👏
Hi Francisco! Good to hear from you. What does promosm mean? Just curious