This is my first project on hackster.io, so I hope it makes sense what I am trying to convey and that it works out!
DescriptionAfter I bought my first house, I was a bit worried about whether or not I closed my garage door. So after a while I decided to make a Raspberry Pi project for fun that informed me if it was open, and if it is open, it will notify me via email every 15 minutes until it is closed.
So, basically, I get an email when it's open for 5 minutes, and then every 15 minutes thereafter until it is closed.
Please note: I did not include code as you can do what you want with this setup as described below and in my conclusion.
SuppliesTo do this, I used the following supplies:
- 2 magnetic contact sensors
- 1 Raspberry Pi (doesn't matter which version)
- 4 female/female Jumper Wires (2 per sensor)
- Electrical Tape
Simply, you measure out the telephone wire you need. I know there is a maximum distance as the Pi doesn't push out too much power. Unfortunately, I do not know the math to calculate that. Once you measure out your wire, you splice on one side (doors) 2 of the telephone wires to the first magnetic sensor.
Making sure you identify which 2 wires you used, on the other side, you splice the 2 equivalent telephone wires to 2 female/female jumper wires and attach them to your Pi. Repeat this for the next sensor you wish to use.
Once this is done, you should be able to write simple code that detects if the door is open or closed based off the sensor state. A simple if/then/else statement should work but in a loop. Once that is done, you can send the results somewhere based off what you want. For me, I used an email account and send out an email to myself telling me if it's open/closed.
Future Thoughts- Splice it in to the garage door opener to let me open/close the door remotely.
- Since it only tells me when it is opened and then closed, it can get annoying if I am working outside as it will email me everything 15 minutes. So it might be nice to have a way to tell it to sleep.
- I attached the sensors to the wood in the garage and found that, with the change of seasons, it can cause the sensors to shift a bit. This can cause false positives. So, maybe attach them to something better.
I found this project fun to do and relatively easy. I didn't post the code because you can do whatever you want with the results of an open or closed circuit. You can perhaps update a central webpage or display panel, or make an app that displays it, or even send you text messages, etc. For me an email was good enough, but I might add the results to a internal website in the future.
Additional Pictures
Comments