Ex 04 | 1d CNC


1/8″ Card Board , Aluminum rod *2

Arduino board (includes USB cable)

Stepper motor with integrated lead screw

H-Bridge SN754100



Wiring Diagram:







We used the supplied files to construct our gantry, and re-wrote the example code to take an input for total MM per travel. See below. The wiring coming out of the supplied stepper motor was kind of wonky. If you look up close at the wiring harness at the point of the stepper you’ll notice 3 wires are flipped from their Ribbon cable locations. We got it to work by just referencing the wire order at the point of the female connector at the end of the ribbon cable.


Arduino Script:

#include <Stepper.h>

const int stepsPerRevolution = 200; // change this to fit the number of steps per revolution for your motor

// initialize the stepper library on pins 8 through 11:
 Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);

int stepCount = 0; // number of steps the motor has taken
 int motorSpeed = 100; //range from 0 to 100:
 const int moveDim = 20; //Millimeters range of motion
 const int stepsPerMM = (stepsPerRevolution/8); //calculate number of steps per MM
 const int endPoint = (moveDim*stepsPerMM); //calculate steps in range

void setup() {
 // nothing to do inside the setup

void loop() {


myStepper.setSpeed(motorSpeed); // set the motor speed:
 if (stepCount < endPoint) {
 // step 1/100 of a revolution
 myStepper.step(stepsPerRevolution / 200);
 else {
 //step backwards
 myStepper.step(-stepsPerRevolution / 200);


if (stepCount > (endPoint*2)){

else {
 stepCount = stepCount+1;

// stepCount=stepCount+1;
 // delay(1000);