The Problem: You want to restrict the time when your pet is allowed to go outside. This could be because the neighborhood is not safe for your cat or small dog at night (marauding coyotes comes to mind). But you would like your pet to be able to come in at any time.

The Solution: Pet Curfew, an arduino controlled pet door, with real time clock, cat status led light and servo latch.
Video here.

Step 1: You Will Need...

1. Staywell Manual 4 way deluxe locking cat flap door
2. An Arduino Nano V3 micro-controller
3. 2x roller switches for detecting cat in/out status (or magnetic reed switches). Similar to this one.
4. 2x momentary push button switches (normally open) for manually opening or closing the door at any time
5. A breadboard
6. A BlinkM MinM LED module (I2C)
7. A Chronodot high precision real time clock module (I2C)
8. A Servo.
9. 4x 10K resistors (for interfacing the 4 switches)
10. Miscellaneous wiring
11. Small nuts and bolts for securing the switches and servo to the door
12. A mini-B USB power supply

The Staywell 4 way locking pet door provides the perfect housing for this prototype, because it is already designed to accommodate additional hardware and electronic modules (other models from the manufacturer) . It also features a flap and an indoor flap guard. The flap guard prevents smart pets from opening the door from the inside.
The arduino nano's size is perfect for fitting inside the door; however other arduino will probably fit too.
The Chronodot real time clock (RTC) is an I2C module that keeps track of the current date and time, even when power is not present.
The BlinkM MiniM is a smart I2C LED module that can fade in and out of a wide range of colors.
<p>I made a simpler version that fits my needs, which are simply to prevent our cat going out between 4pm and 9am, to reduce the risk of her being run down by a car. My version has a 9g servo mounted to the front plate over the red control knob. I've fitted some dogs to the servo plate which lock into the knob to turn it. If there is an issue, we can simply slide the servo back and twist the knob as required. Note that although my version doesn't (currently) monitor in/out status, it takes advantage of the 'in only' setting which is already a feature of the Pet Safe 900 cat flap. I also had to shave down the dowel that the knob turns to reduce the torque needed to turn it. I've uploaded a demo video of the system cycling through it's 180 degree range of movement, which covers the following 3 modes: in-only, fully locked, fully unlocked.</p>
<p>Well done Rustille! And putting the electronics outside the door simplifies the mod a lot.</p>
<p>There isn't an &quot;I'm making it&quot; button...<br>Half way through. Software works (I'm on a Raspberry Pi as I'm mounting a calendar on the wall near the catflap), servo works.</p><p>I'm just a little concerned about my mounting - it seems to work OK for now but I expect if it's knocked it'll come off. Does anyone have any suggestions about mounting servos in this orientation? (I know programming, but &quot;making&quot; is pretty new to me)</p>
<p>Checkout the newer version of petcurfew here: </p><p><a href="https://www.instructables.com/id/PetCurfew-II-An-Automated-Cat-Door-featuring-the-P/">https://www.instructables.com/id/PetCurfew-II-An-Au...</a></p><p>for a servo mounting example. </p><p>Also checkout this site: </p><p><a href="https://www.servocity.com/servos">https://www.servocity.com/servos</a></p><p>for servo mounts. Good luck!</p>
<p>This is pretty cool. I've been wanting something like this for years for my cats. The coyotes around here are bad. I guess the in/out indicator doesn't work when you have multiple cats or can you use it like a semaphore? I sure wish there was something pre-built on the market. This looks fun but my free time is pretty thin. </p>
<p>Glad you liked it. I am not sure semaphore/counters would work because all it would take is for one pet to exit or come in through another door for everything to be out of sync permanently, unless there is a reset mechanism once a day. What is probably needed is a camera that takes a picture every time a cat uses the door and stores it online with a time stamp, but that would require another type of processor altogether...</p>
<p>Thank you for this nice Instructable. I like it</p><p>Rima</p>
You really shouldn't put collars on cats unless they're breakaway types. Cats can get caught on all sorts of things and strangle.<br><br>I can see this being VERY useful in a chicken coop! Can it be worked so that it stays open all day, and is programmed to open in the morning and close at night by a light meter?
I am not sure chickens would be able to push such a door open. Also, in the current version there is nothing to keep predators out. But the light sensor is definitely doable.
LOL No, I can't see chickens pushing their heads against anything! Auto poultry doors are available but they cost around $200. (These are very well made in Germany; don't waste your money or your birds on the cheap ones.) With poultry, you must be home at dawn and dusk to let them out and back in, and you leave the door open so they can go inside to eat, drink, and lay their eggs. They could spend a day in the coop now and then, but once let out they absolutely must be locked up at dusk because that's when all the predators come around. This puts quite a crimp in your social life! The only homemade solution I've seen involves an automatic curtain closer. Can you come up with something that would work? This whole project is way above my head, but there is a computer whiz in the family who would know what you're talking about.
<p>I use a small dog door for my chickens. I had to herd them through it the first several times, and I don't know if they really like it, but they use it, and seem to have no trouble pushing it open from either side. Mine is just a stock pet door so it does not provide any security, but I have a very secure chicken yard so I'm not afraid of predators. If you combined that with this, you should have a good solution, but if it is outdoors, it needs to be protected from the weather and dust.</p>
Actually, a light sensor could easily be tampered with; blocking the light sensor in a non-momentary way would trap the animals inside or outside.
so glad i found this... it is the closest thing to what i was seeking. Goal, Dogs can not go out (unescorted) between 9pm and 8am - (avoid coyotes at night, and waking neighbors in the morning ) But, they can come in anytime... just in case they are out at 8:57,, don't want them trapped outside. I will need to build/adapt the current dog door as i didn't find a similar ready made lockable of sufficient size.
Oh and why does everybody use BlinkM's when a couple of bright 5mm LEDs will do the job just as well for a small fraction of the price!? <br>That's three projects I've seen browsing just now that use them unnecessarily!<br>
You're right that a BlinkM isn't needed here, but one could save the day if you use a &quot;bare processor&quot; (an MCU with some buses but no GPIO).
Heliospan: The door only prevents the cat going out, and never prevents entry. Regarding reliability, the electronics has shown quite reliable over the past 8 months (it is housed inside the indoor half of the door). I have had the system &quot;hang&quot; once requiring power cycling, not sure why (a watchdog to perform a daily reset would take care of this). From a mechanical point of view, our cat, renamed Houdini, was able to push with his head and snap the plastic servo arm that came standard with the servo and exit that way. So I would recommend using extra strength (&quot;super-duty&quot;) servo arms (available at places like ServoCity). Re. LEDs vs BlinkM, it is true that a couple of LEDs would probably work just as well if cost was an issue. <br> <br>VirtualBoxer: I thought of rotating the built-in knob, but could not find a way to make the servo fit neatly behind the door (it would have to sit somewhere inside the drywall). Also, the manufacturer chose to position the knob in the corner and a determined pet (read Houdini) can escape by pushing the other corner and bending the plastic flap. My next version will have the servo in the middle of the bottom of the frame for that reason.
I first thought that the servo was turning the built-in knob. For that matter, you would get the same versatility as the built-in knob with two servos: one that controls entry, and one that controls escape.
Hi<br>First thing that springs to mind (to me) is whether the system might at some point for some reason fail to detect that the cat is indoors and lock your poor cat out of the house instead.<br>Might happen when the electronics / switches / sensors etc are exposed to excessive moisture or cold at various points in the year.<br>Is the cat flap at least lockable in a position which allows entry but not exit during curfew? Is that what this actually does? What would happen during a power cut if in the locked position?<br>.<br>I have a self developed home house alarm with relays to control the bell box and sirens, and one relay has died of its own accord just by being under the stairs, not even exposed to much cold or moisture (yes it was diode protected too) so I wouldn't trust such perfboarded electronics not to get it wrong on occasion, the risk of your cat getting locked out and essentially turning stray is too great.<br>I'd put much more trust in a professionally produced green circuit board...<br>
Actually, they already make one that reads your pet's implanted microchip and only lets YOUR pets in or out after its programmed. It can be programmed for in &amp; out, in only, out only and locked. Microchip Cat Flaps on Facebook.
Just trying to understand the goal - from what I gather, this: <br><br>1) Lets me know if my cat is outside, or has come in.<br>2) Changes the lock mechanism by programming the clock, instead of manually changing it.<br><br>Is this correct? Thx<br>
The main goal is for the door to automatically lock around noon (we lost a cat who went out just before 5PM). We both work and so do not have the opportunity to do this ourselves. Our cat got used to that schedule, and now turns in around or just before noon and goes to sleep. And yes, as a bonus, we can now tell at a glance whether the cat is in the house.
Nice. I would like to see a video of it in action. Also how do you handle the door flapping back when the cat leaves? How do you know if the cat is in or out?
This particular door already includes a magnet that minimizes flapping and keeps the door &quot;centered&quot;. The two roller switches are used to detect whether the door was opened to the inside or the outside last, and that status is then displayed by the LED as green or red/blue . <br>I tried uploading a short .MOV clip (24MB), but am getting an http error at the end of the upload. Any suggestion?
That worked. Added a link to the video on youtube in the intro.
That video is flagged private, so you have to invite people individually for them to view it.
Fixed. Thanks!
Put it on Photobucket.com, and then just give us the email address that they give you to give out. It's free.
What happens if you have 2 or 3 cats/dogs?
Great question. Didn't think about that, since we have only one cat but...<br><br>You could modify the sketch and add a counter:<br><br>When the door opens to the outside: <br> counter++;<br> set status light = blue;<br>When the door opens to the inside:<br> counter--;<br> if (counter == 0)<br> set status light = green;<br><br>The light would be green only when all pet are accounted for :)<br><br>Assuming of course they do not come in and out through another door; all bets are off in that case.
I think they also make one that has an electronic collar, and it only lets cats in that have that collar, which has a radio signal transponder, similar to your garage door. That addresses the issue of more than one cat.
Awesome. I have the same doors. -Lee
My only issue would be how would the door deal with times that you open the main door (or another) and call the cat in. Such as when it is late at night and you are concerned about the things that would inspire such a device. The door would not know the cat was inside then.
@tareker; Hi! I sent this immediately to cat-fanatic friend. Also tweeted. Cheers! : ) Site
How would you know that it is in fact your cat and not the neighbors that is coming in and out ? You should also add a microchip reader and have your cat/s implanted with it as well . Other than that great project !
RFID tag so the racoons don't come too :) I was going to make one, but my cat is too dumb to figure it out.
I didn't see a servo in the parts list.
Nice catch. Also added the USB power supply.

About This Instructable




More by tareker:Voice Control of a Ceiling Fan with Alexa Controlling your Photon device with SmartThings and Alexa Feedme, an Electric Vehicle Plug In Reminder 
Add instructable to: