Christine Jacinto
Published

Lane Tech HS - Stepper Motor Spinning Spool Project

I wanted to create a device that could spin spools of thread when I pressed a button so I could just cut the thread and continue sewing.

IntermediateFull instructions provided68
Lane Tech HS - Stepper Motor Spinning Spool Project

Things used in this project

Hardware components

Argon
Particle Argon
×1
Elegoo ULN2003 stepper motor driver module
×1
Stepper Motor
Digilent Stepper Motor
×1

Software apps and online services

Particle Build Web IDE
Particle Build Web IDE
Blynk
Blynk

Hand tools and fabrication machines

wooden cylindrical sticks
wooden popsicle sticks
air dry clay
optional: paint; decorative additions

Story

Read more

Schematics

schematic

Code

Spinning Spool Code

C/C++
// This #include statement was automatically added by the Particle IDE.
#include <Stepper.h>

// This #include statement was automatically added by the Particle IDE.
#include <blynk.h>  //includes blynk library

#define BLYNK_PRINT Serial

const int stepsPerRevolution = 2048;    //steps for one revolution

//define pins
#define IN1 5
#define IN2 6
#define IN3 7
#define IN4 8

Stepper myStepper(stepsPerRevolution, IN1, IN3, IN2, IN4);

bool turnRight = LOW;
bool turnLeft = LOW;

char auth[] = "place-authentication-code-here"; //blink auth code

void setup() {
    Serial.begin(9600);   // serial bd-rate
    Blynk.begin(auth);    // blynk
    myStepper.setSpeed(17);   // Speed for stepper motor
}
//set up virtual pins
BLYNK_WRITE(V0){         // read input from virtual pin V0
    turnLeft = param.asInt();  // assigning incoming value from pin V0 to a variable
    }
BLYNK_WRITE(V1){                  // read input from virtual pin V1
    turnRight = param.asInt();    // assigning incoming value from pin V1 to a variable
    }
  
void Stepper1(int Direction, int Rotation){     // stepper motor control
    for (int i = 0; i < Rotation; i++){         // for loop 
    myStepper.step(Direction * 2);      
    Blynk.run();
  }
}

void loop() {   
    Blynk.run();
    
    if (turnRight == HIGH){ //if turnRight high, turn clockwise
        Serial.println("Right turn");
        myStepper.step(stepsPerRevolution / 4);
    }
    delay(10); 
    
    if (turnLeft == HIGH){  //if turnLeft high, turn counter-clockwise
        Serial.println("Left turn");
        myStepper.step(-stepsPerRevolution / 4);
    delay(10); 
}

Credits

Christine Jacinto

Christine Jacinto

2 projects • 3 followers

Comments

Add projectSign up / Login