photoresistor / SmartPhoneGarageDoorOpener

An Arduino Sketch for the Adafruit Feather Huzzah board that uses the Blynk Framework to open a garage door.
10 stars 4 forks source link

Two doors at once? #1

Open sam-gurdus opened 6 years ago

sam-gurdus commented 6 years ago

How would I modify this for opening and sensing two doors?

malogic commented 6 years ago

I have made some changes to make this for two doors.

i don't have it fully functional yet. i have some issues with the input pins. it could be the nodemcu that i'm using. (problem solved)

I changed the name of the doorpin to MagSensor1 and MagSensor2 and made a extra if/else part for door2. and make it write on the second row on the Ledpanel and i added a extra button in blynk.

I have also added a 270ohms resistor for each mag sensor. Not shure that its necessary..

You can try with this and if you have some feedback its most welcome.

// Select your pin with physical button const int MagSensor1 = 2; const int MagSensor2 = 4;

int warnPin; int warnThreshold = 2000; int tick = 0;

WidgetLCD lcd(V3);

BlynkTimer timer;

BLYNK_WRITE(V1) { warnPin = param.asInt(); }

//StartDoor1

// V3 LED Widget represents the physical button state boolean btnState = false; void buttonLedWidget() { // Read button

// If state has changed... if (digitalRead(MagSensor1) == LOW) { lcd.print(0,0, "Left LOW "); tick++; }

if (digitalRead(MagSensor1) == HIGH) { lcd.print(0,0, "Left HIGH"); tick = 0; Blynk.virtualWrite(warnPin, HIGH); }

if (digitalRead(MagSensor2) == HIGH) { lcd.print(0,1, "Rigth HIGH "); tick++; }

if (digitalRead(MagSensor2) == LOW) { lcd.print(0,1, "Rigth LOW"); tick = 0; Blynk.virtualWrite(warnPin, LOW); }

if (tick > warnThreshold) { if (warnPin == LOW) { Blynk.notify("Garage door is open!"); tick = (tick - 500); } }

Blynk.virtualWrite(V2, tick); } //EndDoor1

//Garage.stop

void setup() { // Debug console Serial.begin(9600);

Blynk.begin(auth, ssid, pass); // You can also specify server: //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 8442); //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8442);

// Setup physical button pin (active low) pinMode(MagSensor1, INPUT); pinMode(MagSensor2, INPUT);

timer.setInterval(10, buttonLedWidget); }

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

}

bluearcher-bc commented 6 years ago

@malogic I am not sure if @photoresistor is maintaining this anymore, but I have a fork of this project that I had been playing with locally for the last year, but I just uploaded all my changes today. With your permission I would like to try to merge this feature in and get it working. I have two doors myself, but this has just been working on one for the last year!

https://github.com/BlueArcherX/SmartPhoneGarageDoorOpener

photoresistor commented 6 years ago

I haven't maintained this because it hasn't needed much, but if it works for you, I salute this!

On Tue, Jul 3, 2018 at 7:07 PM Brad Calvert notifications@github.com wrote:

@malogic https://github.com/malogic I am not sure if @photoresistor https://github.com/photoresistor is maintaining this anymore, but I have a fork of this project that I had been playing with locally for the last year, but I just uploaded all my changes today. With your permission I would like to try to merge this feature in and get it working. I have two doors myself, but this has just been working on one for the last year!

https://github.com/BlueArcherX/SmartPhoneGarageDoorOpener

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/photoresistor/SmartPhoneGarageDoorOpener/issues/1#issuecomment-402341749, or mute the thread https://github.com/notifications/unsubscribe-auth/AcN-EmB0zT8oLzGQdlGlmTdbkRZhdCEGks5uDCNNgaJpZM4UqVeT .

malogic commented 6 years ago

Of course @BlueArcherX you have my permission, i have only edited the code from the thread creator @photoresistor.

I will check out your project as well. i wish to later on make a separate version for homeassistant with mqtt or something..

kuromifanboi commented 1 year ago

@photoresistor I made some changes to the code such as wifi error handling, power consumption and security, I wanted to merge the changes with the main code, but it's your call

@sam-gurdus it also works with 2 doors! If I make more changes, I might add some way to make a multi user control