How I Fixed My Parents Forgetfulness

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
yeah I've got a [Music] solution all right so this is an issue that's been bugging me for quite a long time now and I finally thought of a good excuse to fix it you see my parents own a remote garage door controller something like this that they keep in their car every time we leave the house my mom instinctively clicks the button and closes the door but then seemingly forgets all about it just seconds later and often drives all the way back to check and that forgetfulness will probably only increase with age so I thought it would be a good idea to just fix this issue once and for all my idea is to create a raspber High controlled garage door sensor one that would be able to detect and relay the information about the door and then send it back to my phone you could probably buy a smart garage door opener on Amazon for relatively cheap but the whole point for me was to get an excuse to learn how the Raspberry Pi works and also to practice some programming skills to connect the thing all together but keeping that in mind I would take the steps in this video with a grain of salt as I'm quite new to this stuff as well and with all that said let's dive into the actual [Music] project so to start everything off I originally thought that I would be able to use a Raspberry Pi Pico that I previously bought before but I soon realized that the lack of Wireless connectivity quickly ruled it out as an option instead I opted to buy myself a Pico W which is the variant of the pi that actually supports Wi-Fi and in the end I decided to go for this product that had pre-ordered headers as for the actual detection of the garage door I needed some type of mechanism that provided a reliable way to create an open close connection whenever the state of the garage door actually changed and for this I decided to buy a simple magnet contact switch which gave a closed circuit when the two were in proximity of each other and an open circuit when they were not this would mean that when the garage door lifted up the magnets would lose contact and the PW could detect this change and relay the information back to me now to hook these two up reliably I bought a cheap breakout board to mount the Pyon and connect the two wires from the magnet to the board and those are the three simple things I needed to hopefully build the project So I placed the order and waited it for it to arrive okay so everything came I have the three items here um this is just a diagram for the pins that's pretty cool and here's the actual breakout board it's wrapped in kind of anti-static stuff uh so we'll play with that later let's put that back for now here's the actual PW and we can see the headers are pre-attached so that's great for what we need it also comes with a USBC cable or actually I think it's micro USB um and here's the magnets that's pretty much it and so with that I got Right to Work completing the obligatory LED blink code which is basically the equivalent of a Hello World when it comes to these microcontrollers the code is just a loop that turns the LED on and off every half second indefinitely it's all pretty simple and micropython basically takes care of all the hard work for us and that gives us this result which is exactly what it should be doing this means everything is set up and ready so without further Ado let's move on to the actual project code [Music] [Music] itself okay so the the main selling point of the picw is that it has Wireless connectivity so the first thing I'm going to do is make sure that the Wi-Fi actually works and I can connect to the network so I just took some basic boiler play code right here and I'm going to flash it to the PW and see if it works as intended okay so everything is flashed to the pi so I'm going to unplug it and re-plug it in and hopefully it should work without the code editor there it is and we're just going to wait a few seconds for it to connect hopefully the address stays the same and you can see the light is off right now and there we go and the light turns on and if we go to off should turn off there we go so that's all working well Wi-Fi is working so let's move on next I wanted to try testing if the contact search was working and to do that I connected the two wires in the switch to ground and GPI Z on the pi now inside micro python I basically wrote a simple script to emulate the garage door function by checking every half second or so if the gpio pin was on if it was on then that would simulate that the door was open and if it was off then it would simulate that the door was closed and that gives us this result so if I pull the magnet close it should detect oh yep there there we go so um if we bring it close from all sides yep that also works so let's check if the LED works and it should turn off yep there we go so yeah that's all perfect now with all the basic tests out of the way we can start working on the actual software for this project my initial idea was to only have the pie notify you if the garage door changed from open to close but after discussing it more with my mom we decided it would be better to have it send a notification every time this state changed essentially this meant keeping the boiler plate code for the magnet switch but adding an additional function after the LED change to send a notification now the actual notification side of the code was a bit more complicated before starting this project I had thought of potentially using a Discord bot since all my family members use Discord but I decided against this because of the potential security implications after that my mom suggested using SMS to notify but after doing more research and hitting different roadblocks with this method I decided it would just be better to use an inexpensive service called pushover instead this part is not sponsored but pushover essentially allows you to send push notifications on any phones or computers that have the app installed through various different methods and it generally works great this includes using a rest API which works perfectly in the p and allows me to get it set up without having to install any third party packages that micropython wouldn't have after researching a bit more about micropython packages that provide web request functionality I finally settled on Ure requests which is a lightweight package that supports post requests with Json data following the pushover API I was able to get this implemented and successfully send a notification to my phone with that done there really wasn't much left to do besides fixing some small changes and the coating side of the project was basically complete all that was left to do now was to wire it together in my garage but little did I know this part would be much more interesting than I thought to say the least and with that said let's move on [Music] so right off the bat one of the most immediate issues was the lack of outlets in my garage especially near the door itself lots of the wires ran directly into the wall but thankfully I realized that the garage door opener itself was connected using an outlet mounted to the roof however this meant that I needed an extension cable to run run it across the roof and my plan was to mount the Raspberry Pi along the magnets in the small area between the two doors which would act as a sort of Hub that way I could always add a sensor on the other side if I wanted to for the other door with the positioning issues out of the way I also realized that the mounting of the actual magnets would be quite difficult since the movable magnet had two main mounting screws I would need to find a position on the door that came in close enough proximity of the other magnet when closed but also wouldn't obstruct the path of the garage door when opening so I ended up choosing the tiny space in between the railing and the door which would perfectly align in distance to the magnet and clearance of the door and so just after installing the magnet we closed the garage door and the spring snapped pretty unfortunate but given that the spring was probably decades old it was about time that we replaced it anyways and one spring replacement later we were back on track All Things Considered I think we were quite lucky in the fact that it didn't cause anything too catastrophic so after the garage door was fixed I mounted the extension cord along the ceiling and ran it over to where the Raspberry Pi would be seated and then mounted the P against the wall using the holes in the breakout board after connecting the magnet we had something like this and so all that was left was to test it out and sure enough it worked perfectly [Music] so yeah overall a pretty simple project but I was glad to finally get it working editing this a few months later there really hasn't been any issues besides one small oversight there have been a few power outages in the a few months that it's been running and I've noticed that every time it happens the pi stops sending notifications even though it remains powered on I realized that when the power outage occurs the internet goes down for a few minutes and while the router reboots the pi immediately tries to connect to Wi-Fi because I didn't make the Wi-Fi initialization constantly Loop the pi times out and then enters a state of idol so to fix this I simply made it so that the P retries indefinitely until it connects to Wi-Fi and with that the project is complete so in the future I might consider potentially replicating this setup on the other garage store and maybe adding a system to remotely close and open the garage doors but for now thanks for watching and I'll see you guys in the next one
Info
Channel: Ryclic
Views: 3,838
Rating: undefined out of 5
Keywords:
Id: 6vkCiPvwY5k
Channel Id: undefined
Length: 12min 47sec (767 seconds)
Published: Thu Jun 20 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.