Pet Curfew: an Arduino Controlled Pet Door
Intro: Pet Curfew: an Arduino Controlled Pet Door
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.
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.
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.
STEP 2: Installing the Switches
1. Cut out an opening and install the first micro switch on the wall side of the wall tunnel part of the door. This switch will detect the pet going out (flap up). Bring the switch wires to the other side for connection to the breadboard.
2. Cut an opening and install the second micro switch on the indoor part of the door. This switch will detect the pet coming in.
3. Install both manual override switches on the inside part of the door.
2. Cut an opening and install the second micro switch on the indoor part of the door. This switch will detect the pet coming in.
3. Install both manual override switches on the inside part of the door.
STEP 3: Install the Servo
Install the servo so that the actuator arm is on the inside of the door:
1. You will need to cut out a rectangular opening for the servo using a dremel type tool.
2. You will also need to notch the indoor flap to allow it to close around the servo.
3. Secure the servo using nuts and bolts.
We will use the servo arm as a latch to prevent the door from opening to the outside.
1. You will need to cut out a rectangular opening for the servo using a dremel type tool.
2. You will also need to notch the indoor flap to allow it to close around the servo.
3. Secure the servo using nuts and bolts.
We will use the servo arm as a latch to prevent the door from opening to the outside.
STEP 4: Assemble the Electronics
1. On your breadboard, assemble the electronics.
2. Download the software by clicking the links below. You will need both files.
3. Using the Arduino IDE, upload the sketch to the board.
4. Using the "demo" mode, make sure everything is functional before installing inside the door. In demo mode, the servo arm will toggle between the open and close position every 30 seconds.
Note that the servo is powered before moving and then powered down to prolong the life of the servo. For this lightweight application, the servo gearbox is sufficient to maintain the servo in whatever position it is moved to.
The program also automatically adjusts for U.S. daylight savings time.
2. Download the software by clicking the links below. You will need both files.
3. Using the Arduino IDE, upload the sketch to the board.
4. Using the "demo" mode, make sure everything is functional before installing inside the door. In demo mode, the servo arm will toggle between the open and close position every 30 seconds.
Note that the servo is powered before moving and then powered down to prolong the life of the servo. For this lightweight application, the servo gearbox is sufficient to maintain the servo in whatever position it is moved to.
The program also automatically adjusts for U.S. daylight savings time.
STEP 5: Assemble the Door
This is the hardest part of this project.
1. Install the wall tunnel part of the door.
2. Connect the wires from the manual override switches to the breadboard.
3. Connect the wires from the in/out switches to the breadboard.
4. Create a slot in the wall tunnel part of the door for the servo arm to move freely. When the servo arm is in the "door closed" position, it will sit right behind the plexiglass door, preventing the door from being pushed open.
1. Install the wall tunnel part of the door.
2. Connect the wires from the manual override switches to the breadboard.
3. Connect the wires from the in/out switches to the breadboard.
4. Create a slot in the wall tunnel part of the door for the servo arm to move freely. When the servo arm is in the "door closed" position, it will sit right behind the plexiglass door, preventing the door from being pushed open.
STEP 6: Testing
1. Open the door to the inside. LED should fade to green.
2. Open the door to the outside. LED should fade to Blue or Red depending on whether you are within the curfew window.
3. Press the close door switch. Servo should move to close position.
4. Press the open door switch. Servo should move to open position.
5. Outside of programmed curfew time, servo should be in close position.
6. Inside of programmed curfew time, servo should be in open position.
2. Open the door to the outside. LED should fade to Blue or Red depending on whether you are within the curfew window.
3. Press the close door switch. Servo should move to close position.
4. Press the open door switch. Servo should move to open position.
5. Outside of programmed curfew time, servo should be in close position.
6. Inside of programmed curfew time, servo should be in open position.
STEP 7: What's Next?
- Internet connectivity via the arduino nano ethernet shield
- Twitter feed
- Web site with pet status (inside / outside)
- Simpler version that only indicates pet location (inside/outside)
- Twitter feed
- Web site with pet status (inside / outside)
- Simpler version that only indicates pet location (inside/outside)
36 Comments
gdassieu 3 years ago
tareker 3 years ago
If the only goal is to know for sure where the cat is, or if you have more than one cat, you could always place a raspberry pi or a security camera indoor side and trigger recording whenever either switch is activated. Synology Surveillance Station for example can be triggered via a web command. If I were to build version 3.0, I would consider adding a Jetson Nano to actively recognize and classify each cat passing through the door...
MichaelF13 9 years ago
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.
tareker 9 years ago
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...
SparkySolar 9 years ago
Thank you for this nice Instructable. I like it
Rima
firefly68 12 years ago
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?
tareker 12 years ago
firefly68 12 years ago
bejawo 9 years ago
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.
VirtualBoxer 11 years ago
kenbob 10 years ago
Heliosphan 12 years ago
That's three projects I've seen browsing just now that use them unnecessarily!
VirtualBoxer 11 years ago
tareker 11 years ago
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.
VirtualBoxer 11 years ago
Heliosphan 12 years ago
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.
Might happen when the electronics / switches / sensors etc are exposed to excessive moisture or cold at various points in the year.
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?
.
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.
I'd put much more trust in a professionally produced green circuit board...
hjc4604 12 years ago
winniekate 12 years ago
1) Lets me know if my cat is outside, or has come in.
2) Changes the lock mechanism by programming the clock, instead of manually changing it.
Is this correct? Thx
tareker 12 years ago
Boost 12 years ago