Arnov Sharma
Published © GPL3+

Linear Rail for CNC

A customizable Linear rail for CNC Z-Axis.

BeginnerProtip18 minutes3,414
Linear Rail for CNC

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
Stepper motor driver board A4988
SparkFun Stepper motor driver board A4988
×1
Stepper Motor
Digilent Stepper Motor
×1
UTSOURCE Electronic Parts
UTSOURCE Electronic Parts
everything above can be found here for a low price
×1

Software apps and online services

Fusion 360
Autodesk Fusion 360
Arduino IDE
Arduino IDE

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)

Story

Read more

Custom parts and enclosures

stepper mount

z axis carriage

z axis carriage 2

body

Schematics

scheme

Code

code

C/C++
const int stepPin = 3; 
const int dirPin = 4; 
 
void setup() {
  // Sets the two pins as Outputs
  pinMode(stepPin,OUTPUT); 
  pinMode(dirPin,OUTPUT);
}
void loop() {
  digitalWrite(dirPin,HIGH); // Enables the motor to move in a particular direction
  // Makes 200 pulses for making one full cycle rotation
  for(int x = 0; x < 300; x++) {
    digitalWrite(stepPin,HIGH); 
    delayMicroseconds(500); 
    digitalWrite(stepPin,LOW); 
    delayMicroseconds(500); 
  }
  delay(1000); // One second delay
  
  digitalWrite(dirPin,LOW); //Changes the rotations direction
  // Makes 400 pulses for making two full cycle rotation
  for(int x = 0; x < 300; x++) {
    digitalWrite(stepPin,HIGH);
    delayMicroseconds(500);
    digitalWrite(stepPin,LOW);
    delayMicroseconds(500);
  }
  delay(1000);
}

Credits

Arnov Sharma

Arnov Sharma

268 projects • 273 followers
Just your average MAKER

Comments