Arduino Powered Dog Stairs

Yes, you read that right! I’ve talked briefly about my dog stairs project in my first post and finally got around to taking lots of high resolution pictures and thought I’d share the project with everyone. You can find all the pictures and code in the attached ZIP file. Here’s basically what I did:

1. I purchased a Parallax PIR motion detector from Radio Shack.

2. A photo cell I had lying around, it doesn’t matter what resistance, just modify the value in the code to reflect your photocell’s darkness value.

3. Project box (enclosure) from Radio Shack.

4. Two white 20ma LEDs.

5. Wire, plenty of wire (you’ll see in the pictures, I used a bit much)!

I’ve hooked up the photocell to the analog pin 0 of the Arduino. The code loops checking for the pre-configured value for darkness, when the value is read from the photocell and it’s at or below that value we increment a counter and delay 1 second. We repeat this process until the counter equals the number of seconds of darkness required to activate the PIR. We do this to prevent momentary darkness/lightness from switching the state of the PIR. We of course perform the exact opposite logic for light (this helps if for example you flip on the light and then flip it back off).

Once the state has changed and the PIR is activated we enable power on Arduino pin 7 and give the PIR a pre-configured 30 seconds to calibrate. This is per the datasheet. Once calibration is over we monitor pin 3 on the Arduino for motion (which is triggered by a logical HIGH on pin 3). When motion is detected we turn on the LEDs by setting pin 13 to logical HIGH for the pre-configured 15 seconds. This motion detection sequence repeats until it’s light outside and we shut down the PIR. I power the whole thing with a 9V 500MA wall wart.

Simple huh? This project went together quite nicely and fairly quickly. If you have questions or comments, please feel free to ask.

DogStairs
Title: DogStairs (1246 clicks)
Caption:
Filename: dogstairs.zip
Size: 8 MB

DogStairs
Title: DogStairs (1246 clicks)
Caption:
Filename: dogstairs.zip
Size: 8 MB