Ezra Redeatu
Published

Lane Tech HS - PCL - Automated Box Open and Closer

A device that allows me to open and close a box with my phone.

BeginnerFull instructions provided1.5 hours17
Lane Tech HS - PCL - Automated Box Open and Closer

Things used in this project

Hardware components

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

Software apps and online services

Particle Build Web IDE
Particle Build Web IDE

Hand tools and fabrication machines

Tape, Duct
Tape, Duct
String

Story

Read more

Code

HomeAutomationBox

C/C++
#include <Stepper.h>


//1 revelution is 2048
const int stepsPerRevolution = 2048;

#define IN1 4
#define IN2 3
#define IN3 2
#define IN4 1

int button = 5;

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

#define BLYNK_TEMPLATE_ID "TMPL5dTQvrhj"
#define BLYNK_DEVICE_NAME "ForBox"
#define BLYNK_AUTH_TOKEN "-Uck8UVsqMWHGZ3HzTA77HnsqXnS28W5"

#include <blynk.h>

// Comment this out to disable prints and save space
//#define BLYNK_PRINT Serial




char auth[] = ****************;
char ssid[] = "******";
char pass[] = "**********";





// This function is called every time the device is connected to the Blynk.Cloud
BLYNK_CONNECTED()
{
  // Change Web Link Button message to "Congratulations!"
  Blynk.setProperty(V3, "offImageUrl", "https://static-image.nyc3.cdn.digitaloceanspaces.com/general/fte/congratulations.png");
  Blynk.setProperty(V3, "onImageUrl",  "https://static-image.nyc3.cdn.digitaloceanspaces.com/general/fte/congratulations_pressed.png");
  Blynk.setProperty(V3, "url", "https://docs.blynk.io/en/getting-started/what-do-i-need-to-blynk/how-quickstart-device-was-made");
}
void setup() 
{
  
  pinMode(button, INPUT_PULLUP);
  pinMode(7, OUTPUT);
  myStepper.setSpeed(17);
  // Debug console
  Serial.begin(115200);
  delay(5000); // Allow board to settle
  Blynk.begin(auth);
}

BLYNK_WRITE(V0)
{
  // Set incoming value from pin V0 to a variable
  int value = param.asInt();
   if ( value == 1 )
	{
        digitalWrite(7, HIGH);
        myStepper.step(stepsPerRevolution*7);
    }
}
BLYNK_WRITE(V4)
{
  // Set incoming value from pin V0 to a variable
  int value = param.asInt();
   if ( value == 1 )
	{
        digitalWrite(7, LOW);
        myStepper.step(-stepsPerRevolution*7);
    }

}

void loop() 
{
  Blynk.run();
}

Credits

Ezra Redeatu

Ezra Redeatu

0 projects • 0 followers

Comments

Add projectSign up / Login