Breadboard
Blue LED (or any color)
White LED (or any color)
1 - 330 ohm resistor
1 - 1k resistor
The Code, wiring diagrams (fritzing.com) can be found here:
Node Schematic:
Magnetic Switch hooked up:
the magnetic switch has a continuous 5 volts running through so that when the door is open, it cuts off the voltage. Then, gpio10 ( sdd3) on the board reads the low voltage and knows that the garage is open. This was a little tricky because even when the circuit was open, the board would read static voltage and would often not be able to tell the circuit was open. I solved this by adding a resistor, which says 1k but 330 ohms was fine, that would pull the static voltage to the ground when the circuit was open.
Relay switch to my garage door button:
The original garage button runs a continuous voltage of 17volts, so I hooked up the 5v relay so that when the relay received a 5v high signal from the microcontroller, it closes off the voltage for 1 sec which triggers the garage to close or open just like it would do if you were to hit the button with your hand.
Here is a picture of the circuit:
Here is a picture of the server output html page I designed:
(I know I need to close some windows...)
I would love to post the code on here for the micro controller along with the fritzing files but it is just to much. It is much better to visit my GitHub repository IoTGarage. I must insist that I wrote all of this code, wired the circuit, and fitted plastic storage over the course of about 10 hours so it may be messy and non efficient. Over this project, I learned to use platformIO with atom.io, to program the esp8266 wifi server library, to fit Arduino code onto an orgianl lua board, HTML and CSS from scratch, IFTTT.com, webhooks, dynu static ip setup, and much more. So there is alot to be learned from building this wifi garage server. The code has more explanation of how everything works, but feel free to ask questions.
A few notes:
If you would like to access your garage server from outside your house or with google assistant. You should go this route. Set up a free static IP through a service of your choice. I chose https://www.dynu.com/. Then route that traffic through your home router and onto your wifi garage server via port forwarding using a port of your choice. I followed directions HERE which worked out great. It was a little tedious but presents more opportunity to learn.
Once you have this static outside ip set up, you can then set up a free https://ifttt.com/ account, (if this then that) which is an amazing thing in and of itself. On IFTTT you can set up a web applet that you can connect your google home assistant to your home wifi garage server via webhooks and your all set to go!
When your all finished, you will have a project like this or better:
Please feel free to leave me some comments or ask and I will answer any questions!
#SudoAptGetUpdateYourBrain!
I have been looking for this exact setup. I have purchased everything required. I am a complete noob to Linux and arduino but I look forward to the learning experience! Thanks for the great write up.
ReplyDeleteAbsolutely! I hope it all worked out for you. Mine is still up and running!
Delete
ReplyDeleteGreat Article
Internet of Things Final Year Project
Final Year Project Centers in Chennai
Thanks alot!!
Delete