30percent
Published © GPL3+

Simple Wire Length Cutting Tool

This device runs a desired length and quantity of wires and cuts each length.

BeginnerWork in progress23,478
Simple Wire Length Cutting Tool

Things used in this project

Hardware components

Arduino UNO
×1
Big Easy Driver
SparkFun Big Easy Driver
×1
NEMA 23 Stepper Motor
OpenBuilds NEMA 23 Stepper Motor
×1
Texas Instruments 12 to 5 VDC Regulator/Drop Down
×1
General Hardware; standoffs, screws, washers, etc.
×1
HPI 1/10th Scale On-Road Touring Wheels and Tires
×1

Hand tools and fabrication machines

RotoZip
General Shop Tools, drill, bits, taps, etc.

Story

Read more

Schematics

Connection Diag

Code

Wire Cutter Code

Arduino
Load to Arduino UNO, Open a Serial Comm window, It will ask for a length in Inches, desired quantity and if you are ready. Entering Y will proceed with operation.
//Written by Lonnie Sexton 2017. Special Thanks to Julia B.
//for the help with fixing a probelm with the code. 
#include <math.h>               //#math
#include <Servo.h> //From Library
Servo servoMain; // Define Servo
#include <SoftwareSerial.h> // soft serial for LCD
#define stp 2 //define stepper
#define dir 3 //define stepper
#define MS1 4 //define stepper
#define MS2 5 //define stepper
#define MS3 6 //define stepper
#define EN  7 //define stepper

float a;              //variable assignment qty
float b;              //variable assignment inches
float c;              //variable assignment required motor steps
float W;              //removed from functions for now, might need later.
char junk = ' ';      //any random character input. 
char val;             // Data received from the serial port
char user_input;
int x;                //Probably over loaded on assignments, not sure. Remove later and test. 
int y;
int state;
SoftwareSerial mySerial(0, 11); // pin 11 = TX

void setup()          // set up
{
  pinMode(15, OUTPUT); // set the pin to input
  servoMain.attach(9); // servo on digital pin 9
  pinMode(13, OUTPUT); // led on pin 13
  pinMode(stp, OUTPUT); //B.E.D
  pinMode(dir, OUTPUT); //B.E.D
  pinMode(MS1, OUTPUT); //B.E.D
  pinMode(MS2, OUTPUT); //B.E.D
  pinMode(MS3, OUTPUT); //B.E.D
  pinMode(EN, OUTPUT); //B.E.D
  resetBEDPins(); //Set step, direction, microstep and enable pins to default states
  Serial.begin(9600);   // set up Serial library at 9600 bps
  mySerial.begin(9600); // set up serial port for 9600 baud
  Serial.println("Lets Cut Some Wires!"); //welcome message in serial window
  Serial.println("");
  Serial.flush(); //clear the input que. 
}

void loop()

{
  {
  mySerial.write("                "); // clear display
  mySerial.write("                ");

  mySerial.write(254); // move cursor to beginning of first line
  mySerial.write(128);
 
  mySerial.write("Solution Systems  Feed n Cut!");

  delay(2);
  }
  Serial.println("Enter Quantity, Press ENTER");        // user Input request qty
  while (Serial.available() == 0) ;                     // Wait here until input buffer has a character
  {
  
    a = Serial.parseFloat();                           // new command in 1.0 forward
    Serial.print("a = "); Serial.println(a, DEC);

    while (Serial.available() > 0)                      // .parseFloat() can leave non-numeric characters
    { junk = Serial.read() ; }                          // clear the keyboard buffer
  }

  Serial.println("Enter Length in Inches, Press ENTER");
  while (Serial.available() == 0) ;
  {
    
    b = Serial.parseFloat();
    Serial.print("b = "); Serial.println(b, DEC);
    while (Serial.available() > 0)
    { junk = Serial.read() ; }                          // clear the keyboard buffer

    c = (float( b*26 ));

    Serial.print("Motor Steps = ");
    Serial.println(c, DEC); Serial.println();
    }
    
  Serial.println("Ready to Begin? Press ENTER");        // user Input request Y or N?
  digitalWrite(EN, LOW);                                //Pull enable pin low to set FETs active and allow motor control
  while (Serial.available() == 0);                      // If data is available to read,
   { 
     val = Serial.read();                               // read it and store it in val
     if (val == 'y')
     { 
      Serial.println("Here We Go!");
      delay(10);
      for (a; a>0; a--){      // this step checks if the quantity entered (a) is greater than 0,...  and deducts 1 from a.
        Feedft();             // if it is it repeats the step feed and cut function again.
      }
     } 
     else {
     Serial.println("Restarting Setup...");             // otherwise restart
     }
   delay(10);                                           // Wait 10 milliseconds for next reading
  }
  { junk = Serial.read() ; }                           // clear the keyboard buffer
  
}

  
//Reset Big Easy Driver pins to default states
void resetBEDPins(){
  digitalWrite(stp, LOW);
  digitalWrite(dir, LOW);
  digitalWrite(MS1, LOW);  // leaving wired and in sketch for now, not using micro-step control at this time. 
  digitalWrite(MS2, LOW);
  digitalWrite(MS3, LOW);
  digitalWrite(EN, HIGH);
}

//Functions 
void Feedft(){
  Serial.println("Feeding Wire at default step mode.");
  digitalWrite(dir, LOW);                   //Pull direction pin low to move "forward"
  for(x= 1; x<c; x++){                      //Loop the forward stepping enough times for motion to be visible
    digitalWrite(stp,HIGH);                 //Trigger one step forward
    delay(1);
    digitalWrite(stp,LOW);                  //Pull step pin low so it can be triggered again
    delay(1);
  }                                         //Need to add a stepper done moving function here!!!!!!!!!!!!!<==================
   ServoMainCut();                          //Run the Cut Function
   delay(2000);   
   Serial.println("Cutting Wire!");         //Fair Warning.....
  // RepeatCount();                           //Run the repeat function
  { junk = Serial.read();}                  //Clear the keyboard buffer
}

//funtion Servo Cut
void ServoMainCut(){
   digitalWrite(13, HIGH);
   delay(100);
   digitalWrite(13, LOW);
   servoMain.write(177); // CUT!! Turn Servo Left to 176 degrees
   delay(750);          // Wait 1.5 second
   servoMain.write(65); // Open Cutter Turn Servo Left to 65 degrees
   digitalWrite(13, HIGH);
   delay(100);
   digitalWrite(13, LOW);
}

Credits

30percent

30percent

1 project • 16 followers

Comments