Professional Documents
Culture Documents
cutting machine
PROJECT MEMBERS:
error ,man power, reliable work done and save the wastage
of wire.
Key Words: Microcontroller, DC motor driver, LCD display,
Keypad, Cutter.
1. INTRODUCTION
In electrical industry there is huge requirement of wires
can easy to use and fexible. The system can measure wire
#include <rgb_lcd.h>
#include <Servo.h>
rgb_lcd lcd;
#defne stepPin 7
#defne dirPin 8
Servo snippers;
#defne servo 10
#defne openAngle 90
#defne closedAngle 0
#defne leftButton 3
#defne rightButton 2
//------------------------------- user settings ----------------------------------
unsigned int wireLength = 0;
unsigned int wireQuantity = 0;
void setup() {
Serial.begin(9600);
pinMode(upButton, INPUT_PULLUP);
pinMode(downButton, INPUT_PULLUP);
pinMode(leftButton, INPUT_PULLUP);
pinMode(rightButton, INPUT_PULLUP);
pinMode(stepPin,OUTPUT);
pinMode(dirPin,OUTPUT);
snippers.attach(servo);
snippers.write(openAngle);
delay(1000);
•}
void loop() {
if (!digitalRead(rightButton)){
if(state == 5){
state = 0;
}
else{
state += 1;
}
delay(200);
lcd.clear();
}
if (!digitalRead(leftButton) && state > 0 && state < 4){
state -=1;
delay(200);
lcd.clear();
}
switch (state){
case 0:
homeScreen();
break;
case 1:
chooseWireLength();
break;
case 2:
chooseWireQuantity();
break;
case 3:
confrm();
break;
case 4:
currentlyCutting();
break;
case 5:
fnishedCutting();
break;
}
•}
void homeScreen(){
lcd.setCursor(0, 0);
lcd.print("WIRE CUTTER");
lcd.setCursor(11, 1);
lcd.print("NEXT>");
delay(100);
}
void chooseWireLength(){
wireLength = changeValue(wireLength);
void confrm(){
lcd.setCursor(0, 0);
lcd.print((String)wireLength + "mm x " + (String)wireQuantity + "pcs");
lcd.setCursor(0, 1);
lcd.print("<BACK");
lcd.setCursor(10, 1);
lcd.print("START>");
delay(100);
}
void currentlyCutting(){
lcd.setCursor(0, 0);
lcd.print((String)0 + "/" + (String)wireQuantity);
lcd.setCursor(0, 1);
lcd.print("???s");
int stepsToTake = (int)wireLength/mmPerStep;
for(int i = 0; i < wireQuantity; i++){
unsigned long timeForOneCycle = millis();
digitalWrite(dirPin,HIGH);
for(int x = 0; x < stepsToTake; x++) {
digitalWrite(stepPin,HIGH);
delayMicroseconds(500);
digitalWrite(stepPin,LOW);
delayMicroseconds(500);
• }
lcd.setCursor(0, 0);
lcd.print((String)(i+1) + "/" + (String)wireQuantity);
snippers.write(closedAngle);
delay(600);
snippers.write(openAngle);
delay(600);
lcd.setCursor(0, 1);
}
wireLength = 0;
wireQuantity = 0;
state = 5;
}
void fnishedCutting(){
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("CUTTING COMPLETE");
lcd.setCursor(11, 1);
lcd.print("NEXT>");
delay(100);
}
•
int changeValue(int currentValue){
if (!digitalRead(upButton)) {
currentValue += incrementSpeed;
incrementSpeed ++;
}
if (!digitalRead(downButton)) {
if(currentValue - incrementSpeed >= 0){
currentValue -= incrementSpeed;
incrementSpeed ++;
}
else{
currentValue = 0;
}
}
if (digitalRead(downButton) && digitalRead(upButton)){
incrementSpeed = 1;
}
return currentValue;
}
void displayNavigation(){
lcd.setCursor(0, 1);
lcd.print("<BACK");
lcd.setCursor(11, 1);
lcd.print("NEXT>");
delay(100);
•}
3. CONCLUSIONS