GreatLight CNC Machining Factory logo
CNC Machining
Rapid Prototyping
Materials
Industries
News
About GL

Get Instant Quote

Arduino CNC control

How to Control a CNC Machine Using an Arduino Uno

An Uno can run a small 3-axis router, engraver, or PCB mill as a G-code interpreter — nothing more. This guide covers the wiring, the GRBL settings that matter, and the point where you should stop and buy a real controller.

3-axis onlyGRBL firmwareStep/direction signalsNot for steel
how to control a cnc machine using arduino on an uno board
Quick answer

Key takeaways

The Uno is the interpreter, not the driveIt turns G-code into step and direction pulses. Stepper drivers and the power supply still move the motors.
GRBL is the only sane firmware choiceWritten in optimized C for the ATmega328P. Three axes, 30 kHz step rate ceiling.
Budget for 3 axes at 1/8 microsteppingThat is roughly 15,000 steps per second of pulse traffic. Add a 4th axis and it drops.
Aluminum is possible, steel is notWood, acrylic, FR-4, wax, and light aluminum passes. Industrial rigidity never arrives.
Set max rate and acceleration before your first cutLost steps from aggressive ramp settings ruin more parts than any wiring error.
Scope

What an Arduino Uno Can and Cannot Do

The Uno runs at 16 MHz with 32 KB of flash and 2 KB of RAM. GRBL fits in that space with room for a small planner buffer, which is why it became the default firmware for hobby CNC. The chip outputs step and direction pulses on three axes. It does not push current through a motor.

That split matters when you plan a build. The Uno decides where the tool goes; a stepper driver such as a DRV8825 or TB6600 decides how the coil gets energized. The power supply feeds the driver, not the Uno. Mix those two roles up and you burn a board.

An Uno setup fits a desktop router for wood and acrylic, a laser engraver frame, a PCB mill, or a small 3-axis test rig. These machines cut at low depth per pass and low cutting force. The frame is usually the weak link, not the controller.

It does not fit a machine that has to hold ±0.005 mm on steel or aluminum at production rates. That work needs closed-loop servo control, thermal compensation, and a rigid casting. You will not get there by adding a better stepper driver to an Uno.

  • 1
    Good fitDesktop router, engraver, PCB mill, teaching rig
  • 2
    Bad fitSteel, tight-tolerance aluminum, 4th/5th axis, production runs
Hardware

Wiring the Uno to Stepper Drivers

Each axis needs two signals from the Uno: a step pulse and a direction level. GRBL maps these to fixed pins on the ATmega328P. X uses D2 for step and D5 for direction, Y uses D3 and D6, Z uses D4 and D7. Enable is shared on D8.

Run those signal wires as short as you can. A step pulse at 30 kHz has a period near 33 µs, and long unshielded runs pick up noise from the spindle or the stepper cables. Keep signal wires away from motor wires, and never bundle them together.

Set the driver current before you connect the motors. A NEMA 17 rated at 1.5 A per phase should be set to about 1.2 A on the driver, which is roughly 80% of the rating. Too high and the motor cooks; too low and it stalls mid-cut.

Power the logic side from the Uno's USB or a separate 5 V supply. Power the drivers from the main supply, 24 V or 36 V for most desktop builds. Share only ground between the two sides.

  • 1
    Step/direction pinsX: D2/D5, Y: D3/D6, Z: D4/D7, enable D8
  • 2
    Current setting80% of rated phase current, measured with a multimeter
  • 3
    Wire routingSignal wires short and separated from motor cables
  • 4
    GroundingCommon ground only; do not tie driver V+ to the 5 V rail
Firmware

Flashing GRBL and Setting the Motion Parameters

GRBL is uploaded through the Arduino IDE as a sketch. After the flash, the Uno no longer runs your code; it runs G-code. Open a serial terminal at 115200 baud and send $$ to read the settings list. Every value you change goes back with a dollar sign command.

The two settings that decide whether the machine cuts cleanly are max rate ($110–$112) and acceleration ($120–$122). Start conservative. For a belt-driven desktop router, 800 mm/min on X and Y and 300 mm/min on Z is a safe first guess. Acceleration around 50 mm/s² avoids most lost steps.

Steps per millimeter ($100–$102) must match your mechanics. For a 20-tooth GT2 pulley, one revolution moves 40 mm. A 200-step motor at 1/8 microstepping gives 1,600 steps per revolution, so 40 steps per mm. Get this wrong and every dimension on the part is wrong by the same ratio.

Set the step pulse time ($0) to 10 µs for most modern drivers. Older drivers may need 5 µs or more. If the motor buzzes and does not move, this value is the first thing to raise.

  • 1
    $100–$102Steps per mm; verify against pulley pitch and microstep setting
  • 2
    $110–$112Max rate per axis; start low, raise in 10% steps
  • 3
    $120–$122Acceleration; 50 mm/s² is a reasonable desktop starting point
  • 4
    $0Step pulse time; 10 µs works for most modern drivers
Motion

Jogging, Homing, and the First Air Cut

Before any tool touches material, jog each axis by hand through the serial console. Send G91 for relative mode, then G0 X10 F500. The axis should move 10 mm and stop. Measure it with calipers. If it moved 12 mm, your steps per mm is off by 20%.

Homing comes next. Switches on each axis let GRBL find machine zero. Wire them normally closed to the limit pins on D9, D10, and D11. Send $H and watch the pull-off distance ($27). A homing cycle that slams into the switch and skips means the pull-off is too short or the switch is bouncing.

Run the first cut in air. Load your G-code, zero the work offset, and raise Z by 20 mm. Watch the motion. Jerky acceleration, missing steps at direction changes, and audible stalls all show up here before they cost you a part.

Only after the air cut looks smooth do you touch material. Start with a shallow pass, 0.3 mm depth in wood or 0.1 mm in aluminum, and increase from there. If the machine loses position, drop the acceleration before you drop the feed.

  • 1
    Verify travelJog 10 mm and measure with calipers before trusting the setup
  • 2
    HomingNormally closed switches on D9–D11; check pull-off distance
  • 3
    Air cutRaise Z 20 mm, confirm smooth motion, then cut
Build order

Step by Step: From Bare Uno to First Part

  • 1
    Mount the Uno and drivers on a boardKeep the Uno away from the drivers so heat does not reach the regulator. Use a perfboard or a shield rather than loose jumper wires; a loose step wire mid-cut ruins the part.
  • 2
    Wire step, direction, and enableX: D2/D5, Y: D3/D6, Z: D4/D7, enable D8. Keep signal wires under 300 mm and route them away from motor cables.
  • 3
    Set driver current and microsteppingSet current to 80% of the motor's rated phase current. Choose 1/8 microstepping as a default; it balances smoothness against the 30 kHz pulse ceiling.
  • 4
    Flash GRBL and connect at 115200 baudUpload the sketch, open the serial monitor, and send $$ to confirm the board responds. If you get no reply, check the baud rate and the COM port.
  • 5
    Enter steps per mm and limitsCompute steps per mm from pulley pitch and microstep. Set $100–$102, then set $130–$132 to the real travel of each axis so the machine cannot crash into its own frame.
  • 6
    Tune max rate and accelerationStart at 800 mm/min and 50 mm/s². Jog each axis at full speed. Raise the rate in 10% steps until steps are lost, then back off 20%.
  • 7
    Home the machine and set work zeroSend $H, confirm all three axes pull off their switches, then set your work offset with G10 or the sender's zero button.
  • 8
    Run an air cut, then cut materialRaise Z 20 mm and run the full program. When the motion is smooth, cut at 0.3 mm depth in wood or 0.1 mm in aluminum and adjust from there.
Decision table

Arduino Uno vs Dedicated CNC Controller

Use this to decide which path fits the part you need to make.

FactorArduino Uno + GRBLDedicated CNC controller
Axes3 axes, no simultaneous 4th3 to 5 axes, simultaneous
Step rateAbout 30 kHz ceiling100 kHz and higher
FeedbackOpen loop, no position checkClosed loop with encoder feedback
Typical materialWood, acrylic, FR-4, light aluminumSteel, titanium, tight-tolerance aluminum
ToleranceFrame-limited, often ±0.1 mm±0.005 mm on a rigid machine
Best usePrototype, teaching, hobby buildProduction parts and repeat orders
Cost of entryLow, parts are off the shelfHigher, but predictable output
When it failsLost steps show up as scrapFaults stop the cycle before scrap

Know Where the Uno Stops

An Arduino Uno is a fine way to learn motion control and a poor way to hold a tolerance. When the part has to fit, machine it.

FAQs

Frequently Asked Questions

Can an Arduino Uno run a 4-axis CNC?

Not with standard GRBL. The ATmega328P does not have the pin budget or the processing headroom for a reliable 4th axis alongside three moving axes.

If you need rotary work, move to a 32-bit board running a Grbl-based fork, or use a dedicated controller. Trying to squeeze a 4th axis onto an Uno usually shows up as random lost steps on the other three.

Why does my stepper hum but not turn?

The most common cause is a step pulse that is too short for the driver, or a direction pin that is floating. Raise $0 to 10 µs and check that the direction wire is seated.

Second cause: driver current set too low. Measure the reference voltage on the driver and set it to 80% of the motor's rated phase current. A motor that holds position but will not rotate is usually undercurrent, not a firmware problem.

How fast can an Uno-based router cut aluminum?

Slowly, and only in light passes. Expect 0.1–0.3 mm depth per pass with a 3 mm single-flute end mill at 8,000–12,000 rpm, and a feed around 300–500 mm/min.

The limit is the frame and the spindle, not the Uno. A machine that flexes under cutting load will chatter no matter how good the controller is. If the part has a tolerance tighter than ±0.1 mm, this is not the right process.

Do I need limit switches?

They are not strictly required to make the machine move, but you should fit them. Without homing, the machine has no repeatable zero, so every setup starts from wherever the axes happened to be.

Wire them normally closed so a broken wire reads as a triggered switch rather than a silent failure. That single choice prevents most crash damage on a hobby build.

What power supply should I use?

24 V is the safe default for NEMA 17 motors on a desktop router. A 36 V supply gives more torque at speed if the drivers are rated for it.

Size the current at roughly 70% of the total motor current, not the full sum. Motors rarely draw rated current on all axes at once, and an oversized supply just adds heat and cost.

When should I stop building and order machined parts?

When the part has to hold a tolerance, fit an existing assembly, or repeat across more than a handful of units. An Uno router is a good way to learn motion control and a poor way to make a delivery deadline.

For functional prototypes and low-volume runs, machining from billet gives you the tolerance and the material properties in one step. Send the CAD file and we will review it for manufacturability before quoting.

Send Your CAD File and Get a Quote in 12 Hours

Upload a STEP or STL file and we will return a quotation plus a free DFM analysis within 12 hours. No minimum order quantity, from one prototype to 10,000+ parts.

12-hour quote100% inspection±0.005 mmNo MOQ

Follow

More from GreatLight

We publish setup notes, tooling trials and inspection data from the factory floor.

FacebookTikTokYouTubeLinkedInInstagramThreadsPinterest

Trusted by engineers and manufacturers worldwide

Tesla Ford Motor Company BYD Auto Denso Magna International Boeing Airbus Medtronic KUKA FANUC