制作出來的剪線機實物圖如下:
01.jpg (56.89 KB, 下載次數(shù): 105)
下載附件
2019-3-26 00:47 上傳
設(shè)置好所需長度和數(shù)量的線材后,自動完成切割。 硬件材料 1*Arduino UNO 1*電機驅(qū)動器 1*23步進電機 1*12v轉(zhuǎn)5v穩(wěn)壓模塊 1*支架、螺釘、墊片等 2*輪胎 靈感來源 人工線軸上拉出幾千根長20cm的22awg電線并不是一件有趣的事。它很無聊,而且很容易出現(xiàn)不準(zhǔn)確。需要2個人花上2天才能手動拉完706個22awg電線。如果你只有一個線軸(一次拉1個線),則需要更長的時間。使用Arduino切線機,你需輸入所需的長度和數(shù)量,即可預(yù)先輸入所需的長度和數(shù)量,就可以自動完成。
切線機_01.png (800.14 KB, 下載次數(shù): 104)
下載附件
2019-3-26 00:47 上傳
切線機_02.png (833.08 KB, 下載次數(shù): 102)
下載附件
2019-3-26 00:48 上傳
切線機_03.png (825.83 KB, 下載次數(shù): 107)
下載附件
2019-3-26 00:48 上傳
切線機_04.png (893.97 KB, 下載次數(shù): 108)
下載附件
2019-3-26 00:49 上傳
切線機_05.png (585.23 KB, 下載次數(shù): 89)
下載附件
2019-3-26 00:50 上傳
切線機_06.png (757.11 KB, 下載次數(shù): 90)
下載附件
2019-3-26 00:50 上傳
切線機_07.png (450.39 KB, 下載次數(shù): 102)
下載附件
2019-3-26 00:50 上傳
切線機_08.png (679.28 KB, 下載次數(shù): 105)
下載附件
2019-3-26 00:51 上傳
09.jpg (152.02 KB, 下載次數(shù): 107)
下載附件
2019-3-26 00:47 上傳
剪線機的Arduino源程序:
- #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);
- }
復(fù)制代碼
|