Introduction: 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.
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
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
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
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.