How to Control Stepper Motors with Arduino using a GRBL CNC Shield!
ฝัง
- เผยแพร่เมื่อ 21 มิ.ย. 2024
- Stepper motors are precise and powerful tools used in every type of precision cutting and manufacturing including CNC machines, mills, lathes, printers, laser cutters and more!
The Arduino microcontroller is capable of integrating with a CNC shield to control several stepper motors required for a 3-axis gantry found in CNC and 3D printing applications. We need the GRBL library installed on the Arduino and we use the Universal G-Code Sender IDE to actually control the stepper positions!
Check out my personal channel for more fun science content!
/ @peterlemaster8310
The CNC Shield Kit I purchased from amazon can be found here:
amzn.to/3WIht0b
The Arduino IDE can be downloaded here:
www.arduino.cc/en/software
The GRBL GitHub link is here:
github.com/grbl/grbl
The universal G-Code sender is here:
winder.github.io/ugs_website/...
And if you want to become a super supporter of the channel check out the link here!
/ lemastertech
There is also a good Arduino beginner projects kit I used when I first started learning Arduino with tons of great beginner projects as well as an Arduino Uno, DC Motor, Servo Motor, LCD screen and more that you can get here if you are a total beginner! amzn.to/3GMq3Gm
Thanks for watching, don't forget to leave a like, subscribe to the channel and comment what you want to see more of!
Timestamps:
00:00 Introduction and hardware required for Arduino CNC system
01:05 Assembling the Arduino CNC shield circuit components
02:56 Installing software, setting up for GRBL and universal G-code sender
06:19 Testing the stepper motors using GRBL and universal G-code
07:40 Thank you and future plans - วิทยาศาสตร์และเทคโนโลยี
Thanks a lot. I wasted a lot of time searching for appropriate grbl, but none of them worked. At last this video made it possible only in 10 min effort.
You are very welcome! Thank you for watching!! :)
For the first time; a video that explains this process perfectly! Thank you!!!
So glad you found it useful!! You’re very welcome, thanks for watching!!
Wow, absolutely the best "How to" video on TH-cam! I just ordered a 3 motor kit and got it all running while viewing your instructions, pause, do it, pause do it. IDE had a problem finding the GRBL folder under Documents/Arduino/libraries. The folder was there but it didn't show under files/examples/... Somehow it finally did, not sure why. I'm impressed with your work!!
Hey thanks so much that’s such a nice comment and great to hear! I appreciate you watching and commenting!!
You're totally right. This is bonkers good
Been trying to piece this picture together for a while. You gave the whole process in one short video. Thanks.
You’re very welcome, thank you for watching and glad you found it useful!!
I love tinkering around with Arduino but have always found working with steppers confusing, this looks like a really good system and you have explained the set up process in a very easy to understand way, can't wait to give it a try! Great video 👍👍👍
Thank you so much! I try to put these videos together in a pretty good and logical order and spend a lot of time making sure they’re high quality and easy to follow so I really appreciate the nice feedback! Cheers mate!
@@lemastertech Yes I know the hard work it takes trying to make an easy to follow video as I do the same only in a different industry, but keep up the good work as you do it well 👍
Really good video for the prototyping, I've watched just about every video relating to the CNC shield at this point. Thank you :)
You’re welcome!! Thank you for watching 😊
Clear, simple and straight to the goal
Glad you liked it, thanks for watching!!
Thank you for the detailed explanation, saved our project!!
You’re very welcome I’m super glad it was useful!!!
Exceptinally easy to follow. Absolutely brilliant. Thank you.
Hey you are super welcome thank you for the nice comment 😊
so cool!
thanks for all the great content!
I’m super glad you liked it!! Thanks for watching :)
Pretty straightforward, thank you. 🙏
😘
You’re welcome thank you for watching!
Great video man. I love this stuff. I have everything to build my DIY CNC ROUTER now. I wasn't really sure what I was missing. I have GRBL, UGS? and Arduino IDE all on my computer. now I need to lock them all in together.
This is always where I get messed up bcos I've never worked around computers until recently. LOL
U made these steps so easily understandable my friend so big thank you for that. This is actually the 1st proper video in set up I have found. Maybe I just didn't find this before but I thought I had watched this one a while back but couldn't fiund it again.
Thanks very much man.. Salute from Dublin..
Hey cheers mate!! Thanks for watching and for the super nice comment! Sounds like you’ve got an awesome project going on over there!! I was Dublin summer of 2022 and absolutely loved it!! Nearly drowned in Guinness and Jameson 😎😎 cheers!!
This was great! Thanks!
You got it thanks for watching!
Thanks mate. That was very helpful and informative.
You’re super welcome, thanks for watching glad it was helpful!!
Awesome tutorial, thank you.
You got it! Thanks for watching!!
Really helped me out thanks so much
You’re very welcome, glad you liked it!!
Amazing. I just, simply followed your vedio step by step, working fine as it is.👌👌.I am in the process of development of CNC machine. As first step to my project..it really worked on one go. Thanks a lot 🙏
Awesome!! Glad it worked well for you and thank you for watching!!
bang !!! clear crisp on point !!!kudos n thanku :)
Thanks so much for watching and the nice comment! Glad it was useful!
Well done my friend, I was honored and benefited a lot from this beautiful explanation. I am a new follower from Egypt
Thank you for watching and for the nice comment!!
Bro, you do a phenomenal job!
Thanks so much!! Appreciate that 😎
Great! keep posting
thank you so much I will!
Excellent video, thanks
You’re very welcome thank you for watching!!
i am building a CNC and was seaching for electronic assembly.
the quality of this video is so good that i subbed it halfway through.
keep up this good work! thank you.
Hey thank you so much!! I’m really glad you liked it, I put a lot of effort into these tutorials :) thanks!
Hi. Thanks god I stumbled upon your channel. Im in the process of learning how to build a cnc machine, and your channel will be very useful.
I am so glad you found the channel too! I'll do my best to be as helpful as I can! Thanks for watching :)
@@lemastertech I've been practicing on Tinkercad today. do you have any videos where you show how to hook cnc shields to stepper motors on tinkercad?
I'm sorry I have used the Universal G-code sender with GRBL candle and Carbide create but I haven't used tinker CAD before!
Thank you so much.
Very welcome!! Thank you for watching!
Great video i plan to build some smaller DIY cnc and i can't find anywere all the information i need, like what stepper motor goes with which driver board and stuff like that but your videos are very useful keep up 👍👍👍
Hey thanks for the nice comment and glad it’s useful! Sounds like you’ve got some cool projects going on!
very helpful!
Excellent! Glad it helped you and thanks for watching!
Thank you.
Thanks for watching you’re very welcome!
Thanks bro✨
You’re welcome, thanks for watching!
Openbuilds have a great... Great controller for this proces... I start with gcode sender that is also great but openbuids like me more thanks for this video
Awesome! Thanks for sharing and thanks for watching the video!
Great video mate! I have a project that required more then 3 steppers, is there a way to connect multiple boards? IE in groups of 3?
Thanks for watching! And probably the best solution there would be 3-4 steppers per arduino board, then send them all commands from a master arduino or raspberry pi to coordinate the movements for all the sub sections!
What was the component you used to bridge the connection on the step increment pins?
Hi - You need a 2 pin jumper cap (short circuit shunt) - I think I bought these last time I needed more amzn.to/3qKwYu8 - Hope that helps!
6:41 why it moves just for few sec instead of continuous while pressing these button?
I have the GRBL software set to jog mode instead of continuous so it’s intentional! You can do continuous if you’d rather
Hey, that's cool!
I'm more of a 3d printer guy but the principles are the same:)
I find it useful to have both if you’re a DIY/ maker type person but I agree 3D printer is maybe a little more fun 😎
@@lemastertech And A LOT more silent 🥸
Bro l got a really basic question, I got a NEMA17 motor 12V 1.5A, when talking about 1.5A, is that a must to provide such current to drive my motor or I can have a slightly lower current like 1A?
Hi, there are actually constant current and constant voltage stepper motors on the market, but the most common nema17 motors are constant current, so yes most likely they’ll be pulling their full rated current constantly by varying their voltage consumption!
hello dear amazing video! i cant find grbl in the exemples please can you help me
github.com/grbl/grbl
Here you go!
great video .
how can i add a library to my arduino ? I cab't find it documents>arduino>library
It’s in the top nav bar you go to sketch then include library
what feedrate you use to test the motors?in the calibration my motor rotates normaly . when i try to jog , it doesnt rotate
I just jog each motor 10 mm in each direction to make sure they’re working, feed rates shouldn’t matter too much if all your wiring is correct that would just spin it faster or slower!
Great video, but could you make one using grbl ans AZ ide for android phones specifying the libraries to load. I want to feed and control my cncs with my phone. Regards. Oh also adding a Joystick to the arduino or cnc shield to be able to set zeros and tool lenghts on the cncmachine would be hero level.😊
Hey thanks for watching and your suggestions sound super cool but honestly I do not have an android device so I don’t think I’d be a good candidate to do that tutorial! The joystick is a cool idea and I’ll probably need a few months before I can make a super deep DIY cnc tutorial but I’ll try to keep that idea in mind thank you!!
@@lemastertech could you help me with correct software uploading on the arduino. I get an error about empty library.
there are also options to progam using a .bin compiled binary file all from a browser
Interesting! Would you say you consider that easier than this method??
yes as the file can be downloaded and then programmed from a website so no software install but i cant remember what the site is called. i know arduino has a cloud tool to@@lemastertech
good luck bro
Thank you friend!!
I downloaded grbl and had to create the libraries folder for but I can't access it through the examples page. Did I miss something?
Hi, I don’t think you missed anything if it shows up in your added libraries but the example code doesn’t, but if you pause the vid on the code I pull up you’ll see it’s literally just one line! You don’t need any of the gray comment lines so you can just type it in pretty easily!
Great video, I am not using GRBL as I have to use the motors for a different purpose. I have the CNC shield plugged into the Arduino.
From the CNC shield pin out, Pins D2 and D5 of the Arduino are used for controlling the step and Dir of X axis.
D3 and D6 for Y axis/motor and so on.
But I want to micro step the motors, What pins on the Arduino should be programmed for doing this.
Code for controlling the basic step and dir of "X" is shown, but here I want to control the Microstepping of the 'X' motor. **How do I do that** ?
///////
const int stepX = 2;
const int dirX = 5;
const int enPin = 8;
void setup() {
// Sets the two pins as Outputs
pinMode(stepX,OUTPUT);
pinMode(dirX,OUTPUT);
digitalWrite(enPin,LOW);
digitalWrite(dirX,HIGH);
}
void loop () {
for(int x = 0; x < 200; x++) {
digitalWrite(stepX,HIGH);
delayMicroseconds(10000);
digitalWrite(stepX,LOW);
delayMicroseconds(10000);
}
}
Hi, I am not sure about using the arduino to micro step the motors, I believe you want to jumper the step pins on the stepper motor shield controller to determine what step size you want to use!
Can i follow the same steps if i am using a MKS GEN v1.4 ? it has a ATMEGA2560 uC, also can i control different motors with the same driver ?
Hi! Yes you should be able to but you’ll need a CNC shield designed for that sized board, and yes you can control different motors but they need to have the same power requirements and four pin hookups!
Hi, I very much followed the video and connections. Though I’m having 2 issues that I can’t understand their cause. The first one is that the stepper motor is not moving at all, it makes buzzing sound when I try to adjust the current limit on the A4988 driverI but other than that there is no action. The second problem I have is that at first I could connect to Universal GCode Sender but since then it always fails to connect. No error message either. I read in some forums that I have to change the stepper motor cable connection order, I was wondering if you have done that or the issue I’m having is completely different. Thank you for the video btw
Hi I am sorry but I have not had issues connecting to the Gcode sender and I did have buzzing once but it was because I had accidentally fried one of my stepper controllers - I’m sorry I hope you got this figured out!
Hi, thank you for the response. Yes the issue was with my A4988 driver. I burned it accidentally and haven’t realised it. It is working charm now, thank you for your amazing content🤘🏽
I would send gcode from a smartphone to an old CNC Fanuc Sigma VC1000 that has an old rs232 serial 25 pin. After that I would monitoring this machine (maybe sending it some command to the serial and the machine could answer me about start, stop, allar, type alarm, but I don't know if it possible, maybe yes).
Could you help me in this little project? Thanks.
Hi - everything is possible, but I don't have knowledge or experience with what you are specifically requesting. It sounds like you would need an intermediate software on your computer to communicate to your FANUC cnc machine, if you want to be able to use your smart phone to send commands you will likely need to build a computer application that can talk to both your smart phone and your CNC! Goodluck, this sounds very cool and challenging
when I plug in the power suply 12v and I still have the arduino pluged in it kills my laptop and I have to remove the batery and put it back to get my laptop to turn back on... am I doing somthing wrong? also the leds freek out when I turn on the power suply, I have a simple blink program on it and when I suply power it frekes out and does not blink. I just have one motor driver and one motor pluged in.
There is definitely a pin out issue between your cnc shield and arduino!! Make sure you don’t have a pin mismatch between your shield and arduino uno! You may have a bad board because nothing about powering the shield should affect your pc connection!
What power supply are you using? Where can I get one?
Hi! Sorry it took me so long to respond - I cut into a lenovo laptop cable since it actually was a 12 volt power supply I had sitting around already but I would recommend getting one that is more intended for hobby applications like this one: amzn.to/4aCtuwm but this is probably the cheapest option that would work! amzn.to/3S5GRxM
I'm all hooked up and connected. Flashed the UNO @ 115200 baud, and carefully set it all up in UGS.....BUT, When I go to move the steppers, nothing happens! I have an "alarm: XYZ Probe." Not sure if that's causing my issue or not. I'm stuck here. Any help is appreciated. Thanks!
Hi I once had this when my pins weren’t aligned between my CNC shield and the arduino, and a separate time when I had a fried stepper controller, but if UGS lit up orange like the communications were all good and your stepper motor controller isn’t overheating (that would happen due to a short) then I’m not sure what the XYZ probe error would be telling you as I haven’t seen that before! Have you tried multiple axis and none of them work??
is it possible to run tmc2208 on that cnc shield?
Hi, so I just looked it up and it looks like a similar pin out to the ones I use here, but I couldn’t say for sure yes since I have not used those before!
Im having this issue where the 5V and GND is shorted on the shield. This is causing the arduino to disconnect and the USB connector to heat up when the shield is connected.
Is there a way to pinpoint where the 5v and GND are shorting on the PCB by the use of some tool or do I need to get a new shield?
So a few ways you can check would be try plugging the board in without the stepper controllers plugged into the shield and see if it’s still getting hot. If it isn’t, that means the heat sink of the little controllers might be shorting. Then you could plug those in one at a time and see when it starts getting hot, that would tell you exactly which one is the issue. Most likely you’ll just need one new controller if it’s fried!
@@lemastertech thanks for the response but I've done the testing without any controllers connected. i also haven't connected the 12v however the 12v doesnt have any short with the 5v pin, (the ground does).
I saw in a video that they're using rubbing alcohol to find the traces that heats up. I thought of a thermal camera but I dont have one available to me
Is there a cleaner way to power it... looks like you split some wire - would rather buy something that just plugs in.... is that possible?
Oh for sure there are way cleaner ways to power it! I cut up an old laptop power supply because that’s what I had sitting around! If you grab a legit dc power supply for hobby electronics you will not have the exposed negative side like mine has!
does installing the software work the same way on a chromebook?
The majority should be the same as they’re all iOS and windows compatible but I have not personally done it on windows so I’m not 100% sure!
Hi, I am trying to connect the cnc shield setup to stepper motors. I am having an issues. I am not able to connect to the audrino unless I enable the board. I see you don't enable it in the video how does that work ?
I am having some issues with my setup. The UGCS connects only after enabling the board. Even after connecting. It freezes after a single jog.
Can you please help me with this ?
This issue is fixed! it was a bad Audrino clone that caused problems. Replacing it with a different audrino solved the issues.
Hi I am sorry I haven’t run into these specific issues myself but I might recommend closing all the different software tools at once, letting your computer restart and trying again. I know that sounds like a generic IT answer but it really resets a lot!
Hello sir
I made cnc machine (Arduino uno grbl ) z and y only one direction run pls help
Hi, if your g code sender is able to move the system in one direction, and you’re able to manually turn it in the other direction, then it sounds like you might have a pin misalignment either between your Arduino and CNC shield or between your shield and motor controllers. If mechanically you are able to twist it backwards it’s either a physical setup issue or software bug!
you have projects with arduino mega 2560?
I have done some projects but not TH-cam tutorials yet, it works basically the exact same as a uno though
when i hit connect it turns orange but at the x, and y controls it keeps on saying connecting
Hm, it is possible the baud rate could be wrong, but you might want to try closing all the software and reopening it, I know someone else in these comments had something similar and their issue was the arduino IDE was still open! Goodluck!
Can you tell me that how much ampere\volt supply is used for the motors running
Hi, that is specified by the cnc shield and stepper motors that you’re using but for mine specifically I needed between 12 and 20 VDC!
@@lemastertech I'm using 3 NEMA 17 with a4988 so tell me about the range of supply that I should use
Looks like you’ll want 20-24 VDC for nema 17!
Is it possible to remove the Stepper motor, and replace it with a linear stepper actuator?
Hi, yea it ought to be possible but using the CNC shield designed for steppers might not be the best solution because most linear actuators actually only need two wire control and you can change direction by reversing polarity, but most steppers use four wire control - if you have a four wire control linear actuator it will probably be pretty easy though! Goodluck hope this helps!
@@lemastertech thank you so much !!
Not sure but I had to stop running arduino IDE before it would connect
I’ve seen other people comment that as well! I didn’t have that problem myself but it seems like shutting the arduino ide down helps some people!
Hello sir
Can i powar 12v dc 10Amp current
Not using an arduino board - you’ll need a different DC power supply
My problem is that the current application shows "NO file loades" pls help me!!
Which application? Arduino ide or the g code sender?
Hi.i want to use limit switch but when i send $H homing command the steper motors locked . It make me confuse 2 days😅 and i test all solutions i know
Hi, so they turn normally but then if you try to home they lock up? Or they’re always locked? Could be crossed wires or an incorrectly compiled controller project!
@@lemastertech yes they turn normally but when i send $H for homing prosses they lock up
cool
Thanks!
Hi guys,
I have a bit of a problem I'm hoping someone can help me out with. I am not able to connect my UGS with the Arduino and shield.. it says connecting but doesn't get to connected. Has anyone had this issue before? .. and hopefully got it resolved?
Hi, I had this issue once when I had the baud rate incorrect, and another time when I had accidentally shorted two pins on my arduino, but if you have the right com port and baud rate and all the pins aligned I am not too sure what else could be causing it! You could try close the arduino IDE if you still have that open, sometimes the board can’t communicate with two software sessions at the same time!
thanks
You’re welcome thank you for watching!!
Please reply😢
The adaptor current rating? Basically i want to know that how much current can i use to power the cnc sheild…
Hi you need a 12 volt DC power supply. You don’t need many amps as each stepper only pulls around .4 A max so the volts is the part that matters!
@@lemastertechthanks for your response
in my case stepper rated 1.2 Amps and I use 3 stepper motors so 12v 5Amp is best or not..?
It's basically a robotic arm 😁
Hi, you just want to make sure you have a power supply that can provide more than your required max amperage! Volts is the part that really matters, and then you just double check the specs on your CNC shield to make sure its rated for that amperage, sounds like you'd be fine with 5 amps!!@@arghyadutta9251
Thanks you are quite more responsive than others ❤️
Im having issues with the universal gcode sender (UGS). Cant get it to connect.
Hi, does your arduino IDE connect to your controller okay? Does the g code sender find the arduino plugged in to a com port automatically? Were you able to install the grbl package via arduino ide?
@@lemastertech I think so. Lol, i dont know this stuff.
@@lemastertech Found the issue. I had to close down Arduino IDE before I could connect the UGS :P
@@olanordmann7836 This worked for me as well
Please do Pi Pico projects in shorts
Hi! It would be hard to do a full raspberry pi project in a short! And I have mostly arduinos and not a ton of pis but I’ll definitely consider it!
i have a problem it goes orange but i cant control anything
Well, make sure your DC power supply is on and plugged into your CNC shield, and make sure all your cnc controllers have their enable pins lined up with the shields enable pins! If it’s orange your computer to shield connection is all good, but you may have physical wiring issues still! Goodluck!
@@lemastertech It’s like the motor is just vibrating but if I give it a little push it will go in that direction
@@mrcardboards that sounds like it’s possible your controller is misaligned or the heat sink could be touching some of your pins! But also, if the motor twitches but doesn’t turn that can be a sign you aren’t providing sufficient voltage! What voltage is your DC power supply?
Thanks for the explanation very clear and easy to follow. And i want to ask how the world domination is going?
Haha you might be the first person to bring the sign up finally! Thanks for watching and I won’t like 13,000 subscribers is not quite world domination but it’s a great start 😆
Taking a little pauses would have made it more understandable instead of this mechanical robot like chatter. However the content itself is very good.
Hey Mike they recently added a function to TH-cam where you can pause it whenever you like just by hitting the pause button! There is no reason for me to make the video longer than it needs to be to share the information required my friend.
none of these videos have worked, I am going to make video showing the problem....
Okay
I am new to the board wiring. I am going to build CNC machine using UNO and CNC shield. I am using Nema 23 Stepper Motor 3Nm(425oz.in) 4.2A & Driver DM542T CNC Kit.
How much power supply is required to run UNO and shield board?
Thank you
Hi, 12v dc power is probably plenty for the shield to run nema23 motors but the uno may need a separate power supply depending on load pull!
@@lemastertech Thank you