Motion Sensing Garage Opener
When I am working out, I like to have the garage opened about halfway to allow airflow, so I created a device to automatically open the garage to the preferred height when I start working out, and close automatically when I am done.
Supplies
Arduino ()
High Torque Servo 180 degrees
PIR Motion Sensor
Breadboard
12x Wires
Test Servo
Before incorporating the motion sensor, just hook up the Servo to your Arduino and test which degree values are needed. For example, I may need to set the Servo to 130 degrees to press the button, so I should keep track of that value. This also includes the delays you would like in between your button presses, based on high you want your garage to open. It is much easier to get this done in the beginning in my opinion. There is a PDF with my finished code at the end, and you can see how I separate my Servo movements and delays.
Downloads
Motion Sensor
Next you want to comment out the code that has to do with your Servo, unplug your Servo, and find a way to get data on whether or not your PIR Motion Sensor works properly. I recommend either an LED that lights up whenever motion is detected, or using serial print() to check data. Because the PIR Motion Sensor is very sensitive, you really need to fine tune the delay, the range, and the cone of detection. I used a toilet paper roll to decrease the cone of detection, but it is up to you! Once you get consistent motion detection when you want it, you are ready for the next step.
Put It Together
Finally, you put it together, adjust your code so that it runs different functions, whether or not motion is detected, or whether it should close or open, (either use booleans or numbers to differ between functions). You can also create whatever physical docking system you desire. I personally just place it on a table with the motion sensor contraption facing mats in my garage to signify the starts and ends of my workouts. Take advantage of and LED to test the logic of your code and everything else should fall into place.