12. Mechanical Design, Machine Design
Yarn Spinner
Group Assignment:
- Design a machine that includes mechanism + actuation + automation + application.
- Build the mechanical parts and operate it manually.
- Actuate and automate your machine.
- Document the group project.
Inspiration
After going to lot of discussion,We chose to build an automatic yarn winder to address the challenges faced by Bhutanese weavers. Currently, they make yarn balls entirely by hand—a slow, painful process that often causes blisters. The traditional method involves manually rolling raw, dyed yarn into balls, then twisting multiple balls together to create thicker yarn.
Our automated yarn winder will significantly reduce manual labor while maintaining the quality of the yarn. Additionally, we want to integrated a sensor that triggers an alarm (beep sound) if the yarn gets stuck or breaks during winding.
The image below shows the traditional manual process, highlighting the need for our automated solution
Image source
BOM
Here is our BOM
Sl.No | Materials | Quantity | Specifications |
---|---|---|---|
1 | Spurs gears | 4 | RPM reduced from 120 to 80 for yarn stability |
2 | Yarn Guide Rails | 2 | Adjusted length: 150mm → 200mm |
3 | Microcontroller | 1 | Arduino UNO |
4 | stepper motors | 1 | 42-32 stepper motor |
5 | motor drivers | 1 | High-temperature resistant (Silicon-based) |
6 | lead screws rod | 1 | M8X x 2 X 365mm |
7 | Screws | 25mm | |
8 | Nut and Bolt | 1 | |
9 | yarn | 1 | |
10 | Jumpers wires | 1 | |
11 | Aluminium rigi coupling | 1 | Provides torque and alignment |
12 | Tnut Pitch | 1 | M8 X 2mm |
13 | Limit switch | M8 X 2mm |
Team Distrubution and Team Work
Our team of four members has divided the responsibilities based on each person's strengths and expertise
- Team Lead
- Machine Design
- Mechanical Movement
- Fabrication and Assembling
- Poster
- Documentation
- Electronics
- Video
- Fabrication and Assembling
- Machine Design
- Mechanical Movement
- Fabrication and Assembling
- Programming
- Research
- Electronics
- Fabrication and Assembling
Mechine Design
We took the inspiration design from this youtube tutorial and made the sketch on how we are going to do the desigining.
Also based on the bhutanese weaver that required the yarn not in ball but in yarn that goes front and back. We design the all the required components like gears, Yarn holder, Nut and bolt from the scratch.
Fabrication and Assembly
Initial Design Fabrication
After designing our machine, we went on by converting all the design files in STL and used the Prusa and The Bambu A1 for the prinitng the the components for our machine also we gather all necessary components like bearing, rod,mason thread and screws.
After attending the Asia review, we received feedback and decided to modify our design. In our initial design, we noticed that the gears in the second row were rotating too quickly, which affected the yarn's movement forward and backward. Considering these factors, we proceeded with the second round of design modifications.
Second
This is our second modifications of our design
We 3D printed all our necessary parts
Used shopbot to cut our casing
!
Mechanical Movement
We ran the short test to see how our machine is going to work, We gave the power supply of 9VDC and connec the yarn and test.
Our first working video
Here ran the test on our second design
Electronics and Programming
We decided to use two Arduino Board for simplicity. One board to control stepper Motor which is responsible to guide the thread by moving to and fro and another to control the speed of DC motor responsible to roll the thread.
Here is the program to drive the stepper motor:
// 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);
}
}
This program controls a stepper motor that moves back and forth between two limit switches.
i. Initialization: - Sets up pins for the stepper motor (direction and step control) and two limit switches. - The limit switches are normally HIGH (using external pull-up resistors) and go LOW when pressed.
ii. Main Loop Logic: - The motor continuously moves in one direction (LOW) until limit switch 1 is pressed. - When limit switch 1 is hit, it pauses briefly (100ms), then reverses direction (HIGH). - The motor then moves in the opposite direction until limit switch 2 is pressed, then reverses again.
iii. Stepping Function:
- The motorStep()
function sends pulses to move the motor a specified number of steps.
- It constantly checks the limit switches during movement for emergency stopping.
- Each step consists of a HIGH/LOW pulse with a delay (STEP_DELAY) controlling the speed.
iv. Behavior: - The motor will continuously oscillate between the two limit switches. - The movement speed is determined by STEP_DELAY (smaller = faster). - STEPS_PER_CYCLE determines how many steps are taken between limit checks.
This creates an automatic back-and-forth motion that reverses whenever either limit is reached.
Here is the program to drive the DC motor:
// 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);
}
This program controls a DC motor's speed and direction using a potentiometer.
i. Pins Setup:
- ENA_PIN
(PWM) controls motor speed (0-255)
- IN1_PIN
and IN2_PIN
control direction (HIGH/LOW combinations)
- POT_PIN
(A0) reads the potentiometer value (0-1023)
ii. Initialization:
- Sets motor direction to clockwise (CW) by default (IN1=HIGH
, IN2=LOW
)
- Starts serial communication for debugging (optional)
iii. Main Loop:
- Reads the potentiometer value (0-1023
)
- Maps it to a PWM speed (0-255
) for motor control
- Adjusts motor speed via analogWrite(ENA_PIN, motorSpeed)
- Prints readings to the Serial Monitor (optional)
- Small delay (100ms
) for stability
- Turning the potentiometer increases/decreases motor speed smoothly. The motor always spins in the same direction (clockwise) unless
IN1/IN2
are changed. Speed ranges from 0 (stopped) to 255 (max speed) based on the potentiometer position. This is a basic speed control program for a DC motor using PWM and a potentiometer.