Hi Everyone!
I am currently working on a project where i'm attempting to make motorized roller blinds.
I,ve gotten the code to work and set everything up but now i have a issue with how i will power it.
I would like to power it through some sort of battery and i would want it to last for atleast 2-3 months.
I am using a wemos D1 mini as my ESP and 28byj-48 stepper motor with ULN2003 driver.
Ive read about the ESP's Deepsleep mode but it seems as you have to either set a sertain time or reset it for it to wake up.
I've would like to have it in some sort of power saving mode while it doesn not get any input from the app (btw im using blynk as my way of controlling it) and whenever a button is pressed it does the action and then go back to power saving mode.
How would this be accomplished or is there any other way i can get decent battery life with this?
Thanks ahead
Heres the code i use:
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <Stepper.h>
const int stepsPerRevolution = 512; // change this to fit the number of steps per revolution
// for your motor
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "********************************";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "*********";
char pass[] = "********";
// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, D1, D3, D2, D4);
void setup()
{
// set the speed at 60 rpm:
myStepper.setSpeed(60);
Serial.begin(9600);
Blynk.begin(auth, ssid, pass); {
// Wait until connected
}
}
void clockwisefull()
{
// step one revolution in one direction:
Serial.println("clockwise");
myStepper.step(512);
delay(30);
}
void counterclockwisefull()
{
// step one revolution in one direction:
Serial.println("counterclockwise");
myStepper.step(-512);
delay(30);
}
BLYNK_WRITE(V1)
{
int b1 = param.asInt();
// Execute clockwise routine if V1 is pressed in dashboard
if (b1 == 0)
{
clockwisefull();
}
else if (b1 == 1)
{
counterclockwisefull();
}
}