Gavin TrotterDaniel Law
Published

Lane Tech HS - PCL - Automatic door closer (Prototype)

A system that closes my closet door using a servo motor and an Particle Argon

IntermediateFull instructions provided6 hours255
Lane Tech HS - PCL - Automatic door closer (Prototype)

Things used in this project

Hardware components

Stepper Motor
Digilent Stepper Motor
×1
Argon
Particle Argon
×1
Male/Female Jumper Wires
Male/Female Jumper Wires
×1
Breadboard (generic)
Breadboard (generic)
×1

Software apps and online services

Particle Build Web IDE
Particle Build Web IDE
Blynk
Blynk

Hand tools and fabrication machines

Tape, Duct
Tape, Duct
Rope/twine
Scissors, Free Fall
Scissors, Free Fall
Hot glue gun (generic)
Hot glue gun (generic)

Story

Read more

Schematics

Schematic

Code

Stepper Motor/Main doc Code

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

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

// Authorization code is sent from Blynk to your email
// after creating a new project in the app.
char auth[] = "ML_qTyRNk27CvytotIx7yhoBosMY2yJA";

int mottor1 = D4;

// There seems to be variations in proper value on the Interwebs.
// With some testing 2048 seems to be the right answer
const int stepsPerRevolution = 2048;
int rotate = 0; 
// Change the pins below to match your Argon set up
#define IN1 4
#define IN2 5
#define IN3 6
#define IN4 7

// Pins entered in sequence IN1-IN3-IN2-IN4 for proper step sequence
Stepper myStepper(stepsPerRevolution, IN1, IN3 , IN2, IN4);


void setup() {
  // Adjustable range of 28BYJ-48 stepper is 0~17 rpm
  // Putting anything above this seems to make the motor not spin at all.
  // There are some examples out there that use a value of 100+.
  // I couldn't get those to work.
  myStepper.setSpeed(17);
 
  Serial.begin(9600);

   Blynk.begin(auth);  // Connects Particle device to Blynk Cloud

    pinMode(mottor1, OUTPUT);

}
BLYNK_WRITE(V0)
{
    if(param.asInt() == 1)
    {
        Serial.println("Button: True");
    for(int rotate = 0; rotate < 5; rotate++)
    {
        Serial.println("Rotating: Countclockwise");
            myStepper.step(stepsPerRevolution);
        }
    }
}

void loop()
{
    Blynk.run();    // Pings the Blynk project
}
  

Credits

Gavin Trotter

Gavin Trotter

3 projects • 2 followers
Daniel Law

Daniel Law

16 projects • 8 followers
Teacher. Maker. Citizen of the planet.

Comments

Add projectSign up / Login