Project showcase
Automated Knitting Machine

Automated Knitting Machine © GPL3+

We leveraged the power of Arduino and a Nema 34 motor to automate a hand knitting machine.

  • 2,990 views
  • 0 comments
  • 9 respects

Components and supplies

About this project

I've been an avid knitter since 5 years and wanted to know how the experience can be simplified. For starters, I bought a hand knitting machine last year- but I discovered that it needed me to push a carriage across from one end of the needle bed to the other. This was very painful, and it was repetitive. I went ahead and looked to know if there were people who developed a robotic arm to move the carriage. To my surprise, there were nobody!

I went ahead and created a program along with a friend to get together this contraption that would use a joystick, a Nema 34 high-torque motor, and an Arduino Uno to spin this up!

Code

Code for ArduinoArduino
int pulPin = 4;
int dirPin = 3;
int enblPin = 2;
int ledPin = 13;
int pushButton = 6;
int speed =0;
int pushButton1 = 5;
void setup() {
  // put your setup code here, to run once:
  pinMode(pulPin, OUTPUT);
  pinMode(dirPin, OUTPUT);
  pinMode(enblPin, OUTPUT);
  pinMode(ledPin, OUTPUT);

  digitalWrite(pulPin, LOW);
  digitalWrite(ledPin, LOW);
  digitalWrite(enblPin, LOW);
  digitalWrite(dirPin, LOW);


  pinMode(pushButton, INPUT);
  pinMode(pushButton1, INPUT);
  Serial.begin(9600);
  Serial.println("init");

  digitalWrite(enblPin, HIGH);
  delay(100);
  digitalWrite(enblPin, LOW);
}

void loop() {
  int buttonState = digitalRead(pushButton);
  int buttonState1 = digitalRead(pushButton1);
  Serial.print(buttonState);
  Serial.print("  ");
  Serial.println(buttonState1);
  int sensorValue = analogRead(A0);
   int sensorValue1 = analogRead(A1);

  // apply the calibration to the sensor reading
  speed = map(sensorValue1, 0, 1022, 100, 1000);
 Serial.print(speed);
  Serial.print("  ");
 
  if ((sensorValue <  900) && (sensorValue >  100))  {
    Serial.print("center");
  }
  if (sensorValue >  900) {
    Serial.print("right");
    cw();
  }
  if (sensorValue <  100) {
    Serial.print("left");
    cc();
  }


}


void cw() {
  while (1) {
    int buttonState = digitalRead(pushButton);
    int buttonState1 = digitalRead(pushButton1);
    digitalWrite(dirPin, HIGH);
    digitalWrite(pulPin, HIGH);
    digitalWrite(pulPin, LOW);
    delayMicroseconds(speed);
     int sensorValue = analogRead(A0);
    if ((sensorValue <  900) && (sensorValue >  100))  {
    Serial.print("center");
    break;
  }
    if (buttonState ==  LOW) {
      break;
    }
  }
}
void cc() {
  while (1) {
    int buttonState = digitalRead(pushButton);
    int buttonState1 = digitalRead(pushButton1);
    digitalWrite(dirPin, LOW);
    digitalWrite(pulPin, HIGH);
    digitalWrite(pulPin, LOW);
    delayMicroseconds(speed);
     int sensorValue = analogRead(A0);
     if ((sensorValue <  900) && (sensorValue >  100))  {
    Serial.print("center");
    break;
  }
    if (buttonState1 ==  LOW) {
      break;
    }
  }
}

Comments

Similar projects you might like

Automated Clothes & Shoes Donation Machine

Project tutorial by Mahmoud Ahmed

  • 3,228 views
  • 3 comments
  • 26 respects

Automated Mung Bean Sprouts Growing Machine

Project showcase by solkit

  • 2,346 views
  • 1 comment
  • 7 respects

The NASSAU Pitting Machine

by NassauLv

  • 1,130 views
  • 0 comments
  • 3 respects

The Drawing Machine

Project showcase by Kramick Saha

  • 13,156 views
  • 6 comments
  • 21 respects

Caravaggio, A Drawing Machine

Project showcase by Michele

  • 26,217 views
  • 11 comments
  • 152 respects

Automated Chess Piece Mover

Project showcase by Moustafaidris97

  • 2,879 views
  • 1 comment
  • 13 respects
Add projectSign up / Login