Author Topic: Oak interaction via web - Garage door opener  (Read 21670 times)

exeng

  • Sr. Member
  • ****
  • Posts: 454
Re: Oak interaction via web - Garage door opener
« Reply #15 on: March 11, 2016, 05:35:20 pm »
If you want to have Blynk toggle a real pin, I think the dead simple example I posted earlier would work. http://digistump.com/board/index.php/topic,2073.msg9464.html#msg9464

Basically when you add the button widget just spec which digital pin you want to connect it to. With the above code the pin should go high when you press the button. I'm not at my system so I can't test it. Alternatively, you could strip the current example down to one button (using the virtual pin V1) and read whether you are getting a 1 or 0 (you'll get 1 when button the is pressed) and pulse stretch a digitalWrite(pin,HIGH) for the relay control pin. You could do a simple test using the onboard LED pin 1.

If you poke around on the internet for Blynk examples you may find an example or tutorial for controlling a real pin.

Yes I saw the characters on the LCD. Can't read it, so I don't know what's there. Perhaps the name of the widget creator or the LCD brand???

exeng

  • Sr. Member
  • ****
  • Posts: 454
Re: Oak interaction via web - Garage door opener
« Reply #16 on: March 22, 2016, 09:49:44 pm »
@tycen, You inspired me to pursue this with your initial post re: wanting to use that Oak as a remote garage opener. You have created a monster...

Decided to put my example Blynk access code example and 1 Oak to good use and have been putting together a home grown shield to open the garage remotely, sense light, and sense open or closed states. Much to the bane of my lovely wife, I've been building a prototype that can now be tested. And yes, it does open and close the garage door. Need to add the sensors (reed switches) and figure out how I can utilize the light sensing. So here is the tease... A photo of the prototype shield. Perhaps someday I will share, once tested and complete.

For now, enjoy my "Blynk"ing garage door opener.
« Last Edit: March 22, 2016, 11:54:22 pm by exeng »

tycen

  • Newbie
  • *
  • Posts: 18
Re: Oak interaction via web - Garage door opener
« Reply #17 on: March 22, 2016, 10:56:41 pm »
That looks great!  I had to set the project aside for a few weeks, but just yesterday and today have been thinking about it more.  I actually have a relay shield for the Digispark Pro that I am going to use - I just need to solder the three pin header on my Oak but haven't had a chance to do that yet.  I also just sent off some PCB's to OSH Park for a temp monitor I want to do for my freezer and extra fridge in the garage.

I'm hoping to get the garage door opener project kicked back into gear here in the next few days.  I like your idea of sensing the state of the door with reed switches - I'll need to plan for something like that, too - I also have inadvertently left the garage door open all night.

Thanks for the update - I'll share mine when I have it - hopefully soon.

exeng

  • Sr. Member
  • ****
  • Posts: 454
Re: Oak interaction via web - Garage door opener
« Reply #18 on: March 22, 2016, 11:52:12 pm »
UPDATE: Well I got bit by pins 0 and 2 again. Was going to use these for reed switch inputs but it looks like I will need to have a pull-down resistor on the sensor inputs for the door open and closed switches to ensure they return to ground when they are open. Since pull downs are a no no on these pins, I get to rework the board at least one more time. Light sensing is working. Just need to translate it into something meaningful like day/night or lights on/off. For example, it's dark and your door is open. Well I'll just close it then.

tycen

  • Newbie
  • *
  • Posts: 18
Re: Oak interaction via web - Garage door opener
« Reply #19 on: March 23, 2016, 12:02:06 am »
I like the light sensing idea.  How are you going to account for the light from the garage light? 

A future project I have on my list is an auto door open/close for my chicken coop (based on light from sunrise/sunset).  The Oak/Arduino part of that is easy enough - the hard part is getting the motor setup and power to the coop. 

So many projects...so few power outlets where you need them...

exeng

  • Sr. Member
  • ****
  • Posts: 454
Re: Oak interaction via web - Garage door opener
« Reply #20 on: March 24, 2016, 08:47:19 am »
The light sensor logic does not distinguish between lights on and daylight. I have 2 auto close timeouts. Dark timeout is the short one. Quite often I forget that I left the door open at night. Daylight timeout is the long one (can be fooled by lights on).  I guess could add an RTC for time of day input.

BTW, move the door sensing inputs to pins 9, 10 so that I can use a pull-down to ground. Only using the closed sensor right now.

Code is evolving as testing continues.

smaw51

  • Newbie
  • *
  • Posts: 4
Re: Oak interaction via web - Garage door opener
« Reply #21 on: March 24, 2016, 08:47:36 pm »
Just wanted to say thanks for the info in this thread! I've been able to use blynk now to read a temp sensor and toggle a pin on the oak. Thanks!

exeng

  • Sr. Member
  • ****
  • Posts: 454
Re: Oak interaction via web - Garage door opener
« Reply #22 on: March 26, 2016, 02:29:08 pm »
Just a heads up on Blynk... Looks like they are finally starting to charge for Widgets. There is a Blynk thread here http://digistump.com/board/index.php/topic,2069.msg9887.html#msg9887 that has started to talk about this. Don't know how this will effect users with the app already installed. My Widget Box seems to have a variety of widgets available to use at no cost. Don't know if this will change for those that already have the app installed.

defragster

  • Sr. Member
  • ****
  • Posts: 467
Re: Oak interaction via web - Garage door opener
« Reply #23 on: March 26, 2016, 05:36:33 pm »
Indeed Blynk turned on in App purchases and is giving free accounts only 2000 Energy units, enough to start at least one project.

If you bought the OAK BLYNK on Kickstarter you should have email to get your reward and that credits you 100,000 Energy units.

more notes here: http://digistump.com/board/index.php/topic,2069.msg9894.html#msg9894

tycen

  • Newbie
  • *
  • Posts: 18
Re: Oak interaction via web - Garage door opener
« Reply #24 on: March 27, 2016, 11:04:28 pm »
@exeng - I finally got mine installed.  I forgot that I had ordered the Oak Relay Shield - so I soldered that up and worked out the final bit of code - now I have a simple remote garage door opener.  I hope to add some sensors to it later, but for now at least it's opening/closing.

Sidenote: I haven't updated my Blynk app yet, but since I was a Kickstarter backer of their original project I already got my email telling me I'll never run out of energy.  I'm interested to see how that will work.  I don't blame them - they gotta make money to keep the lights on.  I think I'd be happy to pay if I had to (within reason) - such an incredibly useful app already - and I haven't even done any projects yet beyond this door opener.

Sidenote 2: the Oak Relay shield is poorly designed (and I say that as someone who really likes Erik and his projects - I was a backer for Digispark and Digispark Pro).  The shield only has one side of the Oak pins - but is just big enough to effectively block the other side of the board from even using jumper wires.  I guess I'm glad he focused more on getting the project out the door - but I just wanted to mention it for others.  I'm going to see if he's posted the Eagle files for the shield so I can see if I can make it smaller to open up the blocked pins for jumper wires or just widen it a bit and bring the second row of pins up to the shield.

Here's the code I ended up with:
Code: [Select]
/*                               http://twitter.com/blynk_app
 *
 * Blynk library is licensed under MIT license
 * This example code is in public domain.
 *
 **************************************************************
 * This example runs directly on Oaks.
 *
 * Please be sure to select Oak
 * in the Tools -> Board menu!
 *
 * Change Blynk auth token to run :)
 *
 **************************************************************/

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <BlynkSimpleOak.h>
//#include <SimpleTimer.h>

WidgetLCD lcd(V5); // Blynk LCD widget

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "AUTHTOKENHERE";

int OakLEDpin = 1;   // Oak onboard LED pin 1
int Relaypin = 5; // relay on pin 5

BLYNK_WRITE(V1) //Button Widget is writing to pin V1
{
  if (param.asInt()==1)
  {
  lcd.print(0,0, "You Shall Pass!  ");
  lcd.print(0,1, "        ");
  digitalWrite(OakLEDpin, HIGH);
  digitalWrite(Relaypin, HIGH);
  delay(500);
  digitalWrite(OakLEDpin, LOW);
  digitalWrite(Relaypin, LOW);
  lcd.print(0,0, "You Shall Pass!  ");
  lcd.print(0,1, "  DONE!  ");
  }
  else
  {
    lcd.print(0,0, "  Waiting...   ");
    lcd.print(0,1, "        ");

  }
}
void setup()
{
  Serial.begin(9600);
  Blynk.begin(auth);
  pinMode(OakLEDpin, OUTPUT);
  digitalWrite(OakLEDpin, LOW);
  pinMode(Relaypin, OUTPUT);
  digitalWrite(Relaypin, LOW);

}

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

And attached are some pictures (of really nothing more than an Oak and an Oak relay shield).

Thanks again for the help on getting started with Blynk/Oak!

exeng

  • Sr. Member
  • ****
  • Posts: 454
Re: Oak interaction via web - Garage door opener
« Reply #25 on: March 28, 2016, 09:56:24 am »
@tycen, Away today but when I return I will share my schematic and code. It's a work in progress.

Ncbob

  • Newbie
  • *
  • Posts: 10
Re: Oak interaction via web - Garage door opener
« Reply #26 on: June 01, 2016, 07:21:00 am »
I just finished testing my version that uses IFTTT.

It uses an Oak, a Relay module, and two window/door sensors to give feedback on if the garage door is open or closed.

I have set up a DO button that lets me toggle the garage door open or closed, and I set up a recipe that works off my iPhone so that when I drive up to my house the door automatically opens.

I have set up three variables, one to tell me how many times the door has been opened or closed, and a variable to let me see if the garage door is open or closed that's connected to the two door sensors.

I put it up last night and got it working, still have to install the door sensors tonight.

I'll post the schematics, and links to the recipes I use (with the tokens removed :) ) and the url's I use to read the door status and how many times it's been opened.