Introduction: Raspberry PI Zero Garage Door Opener Using Blynk

Picture of Raspberry PI Zero Garage Door Opener Using Blynk

Ever lose a garage door opener and looked for a replacement on Amazon? The replacements for my garage door were $20-$30. I figured I'd make one using a $10 pi zero (Ok for like $30 after all accessories) but at least I can use it to control my garage from anywhere I am connected to the internet.

Materials:

PI Zero Wireless and all accessories (power supply, gpio header, case, etc)

4 channel Relay (you can use a 1 ch or 2 ch, but the price difference for 4 ch was very little so I bought the 4 ch)

Blynk app (App store and http://www.blynk.cc/ )

If you can follow instructions and have some linux/unix experience, you should be able to do this pretty easily.

Step 1: Setting Up Software Raspberry Pi

Software on Raspberry Pi:

There are many different combinations that will work, I tried to be clear but also not too specific as there are many variables, if you have questions just ask. Also, if be sure to check out my video for additional help.

1. Install latest Raspian OS from here (or any other Linux OS)

2. Double check to make sure WiringPi is installed. Instructions here: http://wiringpi.com/download-and-install/

3.Follow Instructions for Manual Node.js installation; Check your Node.js and npm installation; and then Install Blynk globally found here http://help.blynk.cc/hardware-and-libraries/node-...

**Note: When you get to the "Run default Blynk client", there is a reference to authentication token. This will be emailed to you when you setup a project on the blynk app on your mobile device in a later step.

4. In order for blynk to start automatically after reboot, I edited the /etc/rc.local file as such:

- in terminal type this: sudo nano /etc/rc.local
- add: "sudo blynk-client &" after: fi

- then Control+X to exit, confirm save.

- test it with sudo /etc/rc.local start

Step 2: Wiring 4 Ch Relay to Raspberry PI

Picture of Wiring 4 Ch Relay to Raspberry PI

First step is to solder a GPIO header to your Pi zero (assuming it doesn't have one, mine didn't). I have a video of this here or you can find other videos on how to do this. https://www.youtube.com/watch?v=gtCwC4VAQZo&t=4s

Next, reference the pin diagram to find the pins you need for the project. For this project, we need 1 5v (pin 4) 1 ground (pin 6) and 2 gpio pins which will control 1 garage door switch each (pin 3 and pin 5).

Then connect each pin to respective pin on the 4 ch relay. They are clearly labeled on the relay.

GND = ground (pin 6)

VCC = 5V power (pin 4)

IND1 = garage door 1 (pin 3)

IND2 = garage door 2 (pin 5)

Now that is done, lets move on to the blynk app.

Step 3: Configure Blynk App

Picture of Configure Blynk App

First you need to download the blynk app in the app store. You will be asked to create a profile after install.

Next, create a new project (very intuitive in the app). When you do this, blynk will email you an access code. Don't share this as this is how you will sync your phone to your raspberry pi. If you recall, back in step 1 you needed an access code to start the blynk client. This is that access code. Copy it from email and log in to your raspberry pi and paste it.

Now to configure your project:

-This blynk project will need 2 buttons, 1 to control each garage door as mentioned before. To add a button, click the + button on top right of the project. you will see option for button. Get 2 of these.

-Each button will need to be configured separately.

There are 3 things to configure:

Output - which is choosing the pin that the button will control

Mode - Push vs Switch, Push is a momentary switch which triggers the output while only as the button is pressed, when released, it will go back to the pre-pressed value. Switch is different, when pressed, switch will trigger the output and when release will stay on the triggered value and would need to be pressed again to switch back to pre-pressed value.

Labels - basically naming the button and the values.

Button 1 - output should be gpio 2 (pin 3) and set to push, I labelled mine Main Garage

Button 2 - output should be gpio 3 (pin 5) and set to push, I labelled mine Shop Garage

Step 4: Put It All Together

Picture of Put It All Together

Before finishing the install, I suggest testing everything before spending the time putting all the final touches on the wiring to prevent from having to do it again.

So I wanted my garage door to function both with the physical switch and also the blynk app. My garage door open and close mechanism is triggered by shorting 2 terminals. Basically, the physical button does this when pressed and same with the relay when the virtual button is triggered on the app. The wiring is very simple and is better explained with pictures than with words. So please reference the pictures.

After you wire it up, install it,add power to the raspberry pi and you are all set. Enjoy!

Here is the video of the project also, between the instructable and the video I hope this helps you with your project. https://www.youtube.com/watch?v=gYN38XgH2fM If you have questions, please feel free to ask a question in the comment section.

Comments

LeonardoB102 (author)2017-08-04

I had trouble with the start after reboot. Instead of your line on the /etc/rc.local

I used:

/home/pi/blynk-library/linux/blynk --token=<your token> &

HenryD72 (author)LeonardoB1022017-08-21

This edit worked for me as well. Thanks to you both for the information you both provided. However, there is a problem. When I simulate a power loss by disconnecting and then reconnecting the Pi's power plug, once the Pi boots, the relay light comes on automatically which suggests that a reboot will cause my garage door to open as a result of the reboot (I don't have anything connected to my garage opener yet). I have to press the button in the Blynk app to turn the relay off. Any suggestions on how to resolve this issue? Thanks!

LeonardoB102 (author)HenryD722017-09-03

I had the same problem, so I put the project aside for a while. When I was attempting to solve it, I read several forums with no luck. I am still on the search for the answer, but, I wanted to try another relay for an LED.

The second relay won't turn on on startup, so I tried changing the pin for my garage door (or future garage door). Blink will always keep the first pin live on startup.

So you may try adding two pins on blink, and add the door opener to the second one. Let me know if you find a solution for this.

next_project (author)HenryD722017-08-22

do you have a close up of your wiring for your relay on the relay side? Make sure you don't have it wired for normally closed, which probably means you have the blynk app setup for normally open configuration, which gets triggered when you use the app causing the "normal" operation mode. Let's start there.

Tinker-Bel (author)2017-08-07

Cool!

Do you have link to your 4 ch relay product page?

next_project (author)Tinker-Bel2017-08-10

http://amzn.to/2tGwZRM

Tinker-Bel (author)next_project2017-08-11

thanks!

LeonardoB102 (author)2017-08-04

I also had trouble with setting up blynk, instead I followed instructions here

https://github.com/blynkkk/blynk-library/blob/master/linux/README.md

Im glad you were able to get your set up working! Can you help me understand where you were having trouble so i can clarify my instructable?

About This Instructable

2,607views

49favorites

License:

Bio: Techie by trade, but hobbyist woodworker and metal fabricator to the core. I document my projects on my youtube channel.
More by next_project:Using Epoxy and Dye to fill knots and cracks in woodRaspberry PI Zero Garage Door Opener Using BlynkMy First Knife Made Out of a Saw Blade With a Fancy Leopard Wood Handle
Add instructable to: