EX.04 (CNC)

img_5267slack-imgs

Changed around a few wires on the lower left since the breadboard was smaller than the example.

img_5266

Final CNC model.


Audrino Code Used for Stepper Motor:

Changed “steps per revolution/ #”  from 200 to 35 to make CNC travel to the end.

/*
Created 30 Nov. 2009
Modified 28 Oct 2010
by Tom Igoe

Stepper Motor Control – hello world

Modified 2 Sep 2016
by Che-Wei Wang

*/

#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:
void setup() {
// nothing to do inside the setup
}

void loop() {

myStepper.setSpeed(motorSpeed); // set the motor speed:

if (stepCount < 800) {
// step 1/100 of a revolution
myStepper.step(stepsPerRevolution / 35);
}
else {
//step backwards
myStepper.step(-stepsPerRevolution / 35);
}

if (stepCount > 1600) stepCount = 0;
stepCount++;
//stepCount=stepCount+1;
}

Using:

http://www.creativeapplications.net/objects/make-something-that-makes-almost-anything-cardboard-cnc/

 

diagrams-04-d2048-800x500

 

1 Response

Leave a Reply