🇬🇧 English 🇪🇸 Español 🇩🇪 Deutsch 🇫🇷 Français 🇮🇹 Italiano 🇮🇳 हिंदी (Hindi) 🇷🇺 Русский 🇷🇴 Română 🇯🇵 日本語 🇨🇳 中文 🇵🇹 Português

@tutorial: Manual CNC control with Arduino for any lathe or CNC mill

We've been working on this setup for a while. We wnated to control two axis of a CNC machine manually. You could add this setup to any CNC machine. In my case was to a milling machine and in case of Alpha Mods was in case of a precision table for tower drill. The setup has an LCD so we could see the distance. Then we have push buttons to move the axis and also to reset the position to 0. A sliding potentiometer will set the speed in mm/s.

External Link: https://electronoobs.com/eng_arduino_tut48.php

by: ELECTRONOOBS on 2026-11-16

~Part list

2 x Arduino NANO: LINK eBay

2 x A4988: LINK eBay

2 x NEMA 17: LINK eBay

1 x lineal potentiometer: LINK eBay

1 x 20x4 LCD i2c module: LINK eBay

or 1 x 16x2 LCD i2c module: LINK eBay

6 x push buttons: LINK eBay

1 x toggle switch: LINK eBay

6 x 2k resistor: LINK eBay

1 x diode 1N4001: LINK eBay

2 x 10uF capacitor: LINK eBay


1 x extra DC plug: LINK eBay

1 x 12V DC adaptor: LINK eBay



Wire, soldering iron, solder, etc...

CNC manual controller with LCD, push?buttons for axis travel and zeroing, plus a speed?set potentiometer.
CNC manual controller with LCD, push?buttons for axis travel and zeroing, plus a speed?set potentiometer.
~PART 1 - Schematic

First of all, let's analyze the schematic. Why use 2 arduinos? Well, if I use only one, the code would be very difficult with too much interruptions. We have to create pulses for the motors and print on the LCD at the same time. I've done that and each time I was printing on the LCD, there was a small pause in the motort rotation, and if the refresh rate is fast, the motors will ahvea pause each time and we don't want that. That's why I use 2 arduinos. One will creathe the pulses for the motors and the other one will count the steps and print the distance and speed.

Manual CNC control arduino schematic
Manual CNC control arduino schematic

We have 2 step motors. I've used NEMA 17. Each with a A4988 driver. This driver needs 3 signals from the Arduino. Enable, direction and steps. The Enable pin is connected to a toggle switch so we could start ot stop the motors manually. The toggle switch is also connected to the Arduinos so we could know when the motors are enabeled or not. To control speed we use a lineal potentiometer and to move axis and reset position, some push buttons with pulldowns. To print the distance, I've used a i2c LCD screen of 20x4 but you will have the code for the 16x2 version of LCD as well.

Manual two?axis CNC controller with LCD readout, push?button moves, zero reset and speed knob.
Manual two?axis CNC controller with LCD readout, push?button moves, zero reset and speed knob.

Since there is not enough space, I had to use more than one pin for the GND rail. I've used 3 wires that I've soldered together as you can see in the picture below. So now we have 8 pins, 7 for the segments and 1 for GND. The base of out tube is ready. Test each LED connection before closing the tube. All is there to do is to place a plastic bottle over. If you ahve glass bottle even better!!!

~PART 2 - Code

Very important, there are 2 Arduinos, ArduinoA and ArduinoB. So, in the link below you will find codes for both Arduinos. Make sure you upload code B to ArduinoB and codeA to ArduinoA. In this codes, you will find a part that is called "Editable variables". Well, here you ahve to insert the values for your machine. In my case, the NEMA17 motor needs 200 steps for a full rotation (350°). Also, the lead screw that I use needs 3.5 full rotations to make one cm. The max speed in my case is 17mm/s since over that the motor will stuck. Change these variables in both codes.

Make the connections as in the Schematic above. Then uplaod code B and A to the Arduinos. Supply 12V to the main input and then press the buttons. The motors will rotate and the axis will ove at the defined speed. If you want to rotate the motors with your hand, you can't. For that, you have to disable the motor drivers. For that we use the toggle switch. If that is disabeled, we can rotate the motors without power and taht could be usefull as well.

~PART 3 - Speed control?

To control the direction, we set the "dir" pin to high or low for left or right. To make steps, we have to send a pulse signal to the "Step" pin. The frequency of this fulse signal will give the speed of rotation since each level change of the signal represents a step made by the motor. In the video below, you can see that the bigger is the width of the pulse (lower frequency), the motor will rotate slower.

~PART 4 - The PCB

Ok, as you have seen, in my case I've mounted the circuit on a breadboard. If you want a more professional look, download the board from below. Downlaod the GERBERs and send them to JLCPCB or any other PCB service. Below you will also find the easyEDA project and the schematic.

[ESPERANDO CARGA...]

[3D_READY]
Download: GERBERS (last update 07/11/2018)

Leave a comment

Please login in order to comment.

Comments