2 Video Views·Apr 21, 2025
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!
https://www.youtube.com/@peterlemaster8310
The CNC Shield Kit I purchased from amazon can be found here:
https://amzn.to/3WIht0b
The Arduino IDE can be downloaded here:
https://www.arduino.cc/en/software
The GRBL GitHub link is here:
https://github.com/grbl/grbl
The universal G-Code sender is here:
https://winder.github.io/ugs_website/download/
And if you want to become a super supporter of the channel check out the link here!
https://www.patreon.com/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! https://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
welcome back to the Master Tech and in
today's video I'm going to show you how
to use a CNC shield with an Arduino Uno
to control stepper Motors
[Music]
for this project in total you'll need an
Arduino Uno a CNC Shield compatible with
an Arduino Uno a Serial cable for
connection between the computer and the
Arduino a DC power supply between 12 and
24 volts some stepper motor controllers
and of course your actual stepper Motors
now they are great CNC Shield kits
available so that you don't have to know
what Shield to get what controllers are
compatible with those what motors to get
on top of that so I will leave a link to
the kit that I'll be using in this video
in the description of this video below
if you want to get the exact same stuff
that I'm using in this video the one
thing the kit that I'm using didn't come
with was a DC power supply and it also
only included one stepper motor so you
will have to order some extra stepper
Motors and you'll have to make sure you
have a DC power supply now let's get
into the setup these physical components
go together really easily but you need
to be careful on a few items the entire
CNC Shield should plug into the top of
your Arduino Uno but you need to make
sure you get the port alignment correct
the CNC Shield isn't going to use every
single pin so make sure you start at the
side away from the USB controller by
analog pin A5 and the TX RX pins now
most of the stepper motor controllers
that you'll buy will come with a
heatsink for their main circuit chip and
when you put this heatsink on you need
to be very careful it doesn't touch the
side pins because you can cause a short
and permanently damage it the six pins
right below each capacitor on the CNC
Shield are for selecting what step
increment you want them to work in and
every CNC Shield manufacturer can
provide exactly what the pin outs do but
I'm just going to use the middle pins on
mine because that means one quarter step
increments the most important thing to
keep in mind when putting these stepper
controllers into your CNC Shield is that
there's an enable pin on the underside
that you can see on your controller and
it needs to line up with the enable pin
on your CNC Shield if you put it in
backwards you can fry one of these
stepper motor controllers and
permanently damage the electrical
components don't ask me how I know just
take my word for it you'll also need to
hook up your DC power supply to the
positive and negative leads on this
board but you can wait to do that or at
least wait to plug it into the wall
outlet until everything else is ready to
go so you're not dealing with live
voltage and most stepper Motors are
going to be coming with this four wire
cable to connect the motor to the
controllers and don't actually worry too
much about orientation on here because
even if it seems like it's working
backwards from how you want it to like
it rotates clockwise when you would hope
it would be counterclockwise that's
configurable from the software and it's
really easy to just physically flip
these pins later and that's going to be
it for the physical setup now we just
have to do a few quick items on our
computer first you need to have the
Arduino IDE download and installed it's
completely free it's open source and
I'll leave a link to it in the
description of the video below as well
and then you're also going to have to
download the gerbil which is spelled
grbl all caps but I believe it's
typically pronounced gerbil you'll need
that library for the Arduino as well and
you guessed it there will be a link to
it in the description of the video as
well so I'm gonna try to leave links to
everything you'd need that I reference
in this video so you can just get
everything from this video now when you
download the gerbil zip file uh you need
to extract it go into it and then copy
the entire folder labeled grbl and copy
it into your Arduino libraries folder
this is typically found inside documents
Arduino libraries and then that's where
you want to paste the gerbil folder now
open your Arduino IDE go to file
examples and then all the way down at
the bottom where it says custom
libraries examples and you should see
your gerbil folder go into there and
there's probably only going to be one
and it should be upload open that up and
this code is so basic you're probably
going to think this isn't the whole
thing but there's literally only one
operational line of code in here and
it's telling your Arduino to include the
gerbil live library and that really is
all we're gonna do because we're
actually going to be controlling the
Arduino from a G-Code processing
software which we're going to talk about
more in just a second so now plug your
Arduino board in using the serial cable
but I would still recommend not plugging
in the power supply yet and you should
be able to select your board from the
drop down menu once you have it plugged
in just hit the upload button in the
Arduino IDE to send this upload program
that we have open to your Arduino and
basically put the gerbil package on your
Arduino and now we're done with the
Arduino IDE everything else is going to
be handled by the next tool we're going
to talk about which is the universal
G-Code sender G-Code is the most common
CNC programming language and the
universal G-Code sender is going to
allow us to convert G-Code projects into
something that the gerbil language can
understand of course the link to
download the universal G-Code sender
will be right below the other links in
the description of the video so go ahead
and grab that there once you download
and extract everything from that zip
file just open it up and go to the bin
folder and inside there you'll see the
executables to actually open the
software open it up and you'll see
options at the top for firmware and you
want to make sure grbl gerbil is
selected and for Port you should be able
to hit that refresh button until your
Port automatically populates it's trying
to detect any compatible board so just
hitting those refresh arrows should work
but you are able to manually point it at
a board as well and then make sure your
Bot is set to 115 200 it just needs to
be that once those settings are good go
ahead and hit the button next to
Firmware that looks like a plug going
into an extension cord this is the
connect button hopefully it goes orange
for you right away that means it's
successfully connected and online if
it's not orange check your port check
your baud rate check that you have it
set up for gerbil make sure that the
board is plugged in but you still don't
need the DC power supply plugged in just
yet now if it is orange for you now is
the time where I would plug that
additional DC power supply in I I would
plug it into the wall outlet or
extension cord whatever you're using and
power the CNC Shield up now with that 12
to 24 volts DC now it's time to make
these stepper Motors move if you only
have one motor plugged in initially like
me just figure out what x y z or a it's
plugged into on your board and hit those
jog buttons in the jog menu of the
universal G-Code sender to get it to
turn one way or another you can play
with the settings to make it turn
further or less far and it's a lot
easier to tell exactly what the motor is
doing if you put a piece of tape on the
end of the motor shaft like this to test
all three of your stepper controllers
with just one motor you can just take
turns plugging it into one different
axis motor controller at a time but make
sure you unplug the DC power supply
between moving the motor around so
you're not doing that with live voltage
on the board and just test all three
ports of course ideally if you have
three stepper Motors plug all three of
them in and test bump them all and you
can even find some sample g code from a
free Project online and load it into
this and see your different stepper
Motors working at the same time
obviously they're not hooked up to a
Gantry system or anything yet so you're
not going to be cutting and welding and
drilling right away but this is really
all it takes to get these tested and
once all three of these stepper motors
have been tested you have successfully
fully set up the environment you need
for a DIY open source CNC machine and so
that brings me to the end of this
tutorial and I want to take a quick
moment to thank the sponsor of this
video it's you guys it's my viewers and
subscribers on my YouTube everyone who
leaves comments and helpful feedback and
has helped me grow the channel in the
last year you guys are the reason I'm
able to make content like this and that
I've been able to consistently grow the
channel I'd like to do a full tutorial
on how to create your own CNC machine
from scratch with these sorts of Open
Source electronic components but I
definitely need your guys support my
first patreon supporter Dale T has been
been heavily involved in the growth of
this Channel and I would not be able to
have a Master Tech where it is right now
without him he's helped me brainstorming
some of our biggest projects he's
contributed artwork to the full
platformer game we built in Python and
patreon gives you my direct messaging
link as well as access to exclusive
Lemaster type merchandise so if you guys
want to help me continue the growth of
the channel then consider becoming a
patreon Super supporter in the link
below all the other links in the
description of this video and every
single like every comment on a video
every subscriber is hugely encouraging
to me and helps me grow the channel more
as always thanks for watching good luck
with your projects until next time bye