yt_link
insta_link
fb_link
twitter_link

Manual CNC
page 1/1


Manual CNC control

Help me by sharing this post



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.

manual CNC


See components we need here:






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.


scheamtic Arduino manual CNC

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 CNC a4988 Arduino

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.

Download Arduino A code here:
Download Arduino B code (20x4 LCD):
Download Arduino B code (16x2 LCD):
Download i2c LCD library:


////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////EDITABLE VARIABELS//////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////
float turns_per_cm = 3.5;             //This is the amount of turns your lead screw needs for oen turn.
float steps_per_revolution = 200;   //This is the amount of steps the motor needs for one full rotation
float max_speed = 17;               //Speed in mm per second
float min_speed = 0.6;              //Speed in mm per second
////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////

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.


Download GERBERS here:


manual CNC pcb bCNC





More tutorials →

Help me by sharing this post








ADVERTISERS
PCBWAY PCB Manufacturing

PCBWAY Christas PCB Manufacturing

Advanced PCB Manufacturing
Advanced PCB Manufacturing

AFFILATE

Gearbest SG - 700 Satellite Navigation Foldable RC Drone Quadcopter - WHITE 720P WIFI FPV CAMERA
SG - 700 Satellite Navigation Foldable RC Drone Quadcopter - WHITE 720P WIFI FPV CAMERA only $46.99

Gearbest Xiaomi AMAZFIT Heart Rate Smartwatch - BLACK INTERNATIONAL VERSION
Xiaomi AMAZFIT Heart Rate Smartwatch - BLACK INTERNATIONAL VERSION only $89.99

Gearbest FeiLun FT011 2.4GHz Brushless RC Racing Boat - BLACK AND WHITE AND RED
FeiLun FT011 2.4GHz Brushless RC Racing Boat - BLACK AND WHITE AND RED only $96.99