Motion Sensing Garage Opener

by gmichael16 in Circuits > Arduino

25 Views, 0 Favorites, 0 Comments

Motion Sensing Garage Opener

0.jpg

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

0.jpg

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.

Motion Sensor

0.jpg

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

0.jpg

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.