Skip to content

9. Mechanical Design, Machine Design

Group assignment

  • Design a machine that includes mechanism+actuation+automation+application
  • Build the mechanical parts and operate it manually
  • Document the group project and your individual contribution

Automatic Yarn Winder Machine: Automated Solution for Bhutanese Weavers

Overview

Our team designed and built an automated yarn winder to address the challenges faced by Bhutanese weavers, who traditionally wind yarn by hand—a slow and painful process causing blisters. The machine automates yarn winding while maintaining quality and includes a sensor to detect yarn breaks or jams.

Team Contributions

  • Dorji Gyeltshen: Machine design, mechanical assembly.
  • Bir Maya Rai: Documentation, electronics, video.
  • Roshan Rai: Mechanical design, fabrication.
  • Tshering Dorji: Programming and electronics.

Key Features

  • Mechanism: Uses One stepper motor with two end limit switch and one DC motor which can be controlled via a potentiometer.

  • Actuation: A stepper motor controls the yarn-guide’s back-and-forth movement, while a DC motor spins the yarn.

  • Automation:

  • Limit switches ensure smooth directional changes of stepper motor.
  • Potentiometer adjusts DC motor speed.
  • Breakage detection not integrated but we initially planned to integrate this feature as well.

  • Custom Fabrication:

  • 3D-printed gears, motor stands, yarn guide.
  • Laser-cut acrylic wool frame.
  • ShopBot-cut wooden enclosure.

Challenges & Iterations

First Design: Gears rotated too fast → modified gear ratio. Our Quick return mechanism used for yarn-guide was not good as it return so fast in one direction which is not suitable for winding.

Second Design: Used stepper motor with two end limit switches for yarn-guide and also improved stability with longer guide rails (200mm) and better motor alignment.

Electronics and Programming

Stepper Motor Control: Moves yarn guide back-and-forth using limit switches.

// Pin definitions
const int dirPin = 4;      // Direction control pin
const int stepPin = 5;     // Step control pin
const int limitSw_1 = 8;   // Limit switch 1 (normally HIGH, LOW when pressed)
const int limitSw_2 = 9;   // Limit switch 2 (normally HIGH, LOW when pressed)


// Motor parameters
const int STEP_DELAY = 500; // microseconds between steps (controls speed)
const int STEPS_PER_CYCLE = 200; // Number of steps per movement cycle

void setup() {
  // Initialize pins
  pinMode(limitSw_1, INPUT); 
  pinMode(limitSw_2, INPUT);
  pinMode(stepPin, OUTPUT);
  pinMode(dirPin, OUTPUT);

  // Start with motor direction set to LOW
  digitalWrite(dirPin, LOW);
}

void loop() { 
  // Read limit switches (externally pulled up, so LOW means pressed)
  bool limit1Pressed = (digitalRead(limitSw_1) == LOW);
  bool limit2Pressed = (digitalRead(limitSw_2) == LOW);

  // Determine current direction
  bool currentDir = digitalRead(dirPin);

  // Movement state machine
  if (currentDir == LOW) {
    // Moving towards limit switch 1 (direction LOW)
    if (!limit1Pressed) {
      // Not at limit, keep moving
      motorStep(STEPS_PER_CYCLE);
    } else {
      // Hit limit, reverse direction after brief pause
      delay(100); // Small delay at limit
      digitalWrite(dirPin, HIGH);
    }
  } else {
    // Moving towards limit switch 2 (direction HIGH)
    if (!limit2Pressed) {
      // Not at limit, keep moving
      motorStep(STEPS_PER_CYCLE);
    } else {
      // Hit limit, reverse direction after brief pause
      delay(100); // Small delay at limit
      digitalWrite(dirPin, LOW);
    }
  }
}

void motorStep(int steps) {
  for (int i = 0; i < steps; i++) {
    // Check limits during movement for emergency stop
    if (digitalRead(limitSw_1) == LOW && digitalRead(dirPin) == LOW) {
      return; // Stop if hitting limit while moving toward it
    }
    if (digitalRead(limitSw_2) == LOW && digitalRead(dirPin) == HIGH) {
      return; // Stop if hitting limit while moving toward it
    }

    digitalWrite(stepPin, HIGH);
    delayMicroseconds(STEP_DELAY);
    digitalWrite(stepPin, LOW);
    delayMicroseconds(STEP_DELAY);
  }
}

DC Motor Control: Speed adjusted via potentiometer.

// Define motor control pins
const int ENA_PIN = 9;   // PWM speed control (ENA on HW-310)
const int IN1_PIN = 6;   // Direction pin 1
const int IN2_PIN = 5;   // Direction pin 2

// Define potentiometer pin
const int POT_PIN = A0;  // Potentiometer connected to A0

void setup() {
  // Set motor control pins as outputs
  pinMode(ENA_PIN, OUTPUT);
  pinMode(IN1_PIN, OUTPUT);
  pinMode(IN2_PIN, OUTPUT);

  // Set motor direction (clockwise)
  digitalWrite(IN1_PIN, HIGH);  // IN1 = HIGH → CW
  digitalWrite(IN2_PIN, LOW);   // IN2 = LOW → CW

  // Initialize Serial Monitor (for debugging)
  Serial.begin(9600);
}

void loop() {
  // Read potentiometer value (0-1023)
  int potValue = analogRead(POT_PIN);

  // Map potentiometer value to PWM range (0-255)
  int motorSpeed = map(potValue, 0, 1023, 0, 255);

  // Apply PWM to control motor speed
  analogWrite(ENA_PIN, motorSpeed);

  // Print speed to Serial Monitor (optional)
  Serial.print("Potentiometer: ");
  Serial.print(potValue);
  Serial.print(" → Motor Speed: ");
  Serial.println(motorSpeed);

  // Small delay for stability
  delay(100);
}

Result

A functional automated yarn winder that reduces manual labor while ensuring consistent yarn quality. Future enhancements include integrating a yarn breakage alarm.
This project demonstrates mechanical design, automation, and teamwork, providing a practical solution for traditional weavers. Since I am responsible for electronics and programming, I enjoyed learning about stepper motors and I also learned about the application of End limit switch in machines. I also enjoyed editing our machine building video.

For full details, visit our documentation link