“And now for something completely different“, I’ve been covering the Raspberry Pi 4 and it’s associated accessories since it launched in June 2019. Whilst I have some more posts in the works, I’ve also been slowly working on a number of other side projects. One of which is to create an Automatic Dog Door.
We already have a Staywell 777 large dog flap and a tunnel through a thick brick wall. However, Lily our current dog is unwilling to push through the flap despite being encouraged with treats. Especially as winter is approaching I’m reluctant to leave the flap off.
Our cats are also quite keen on getting in and out of the back garden and so would welcome a door they can use without needing one of their humans to operate it.
As a DIY effort I’m not going to be able to create something as polished as the ~£1600 PetWalk door:
I’m reasonably confident I can create something which will work and I can iterate on. Though won’t be in the same league.
Given the Dog Door project has a fixed and fairly simple purpose, I don’t need the power and flexibility that a Pi and full Linux OS can bring. Instead, my plan is to use a simpler microcontroller. An Arduino device would be an obvious choice, but I know I’m going to want it integrated into my Home Automation system, so would need WiFi. Fortunately I have a few Particle Photon’s to hand, the Photon is a tiny STM32 ARM Cortex M3 microcontroller with built-in WiFi and connectivity to the Particle cloud in order to publish state and of course, enable over the air updating of the running software.
Dog Door Hardware: Electronics
Connected to the Photon will be:
- A NEMA17 stepper motor to operate a verticle sliding door
- A stepper motor driver (DRV8825)
- Limit microswitches to know when the door is open and closed. Preventing trying to drive the motor past end limits.
- A switch on the door for obstacle detection, don’t want this acting as a guillotine.
- In order to activate the door, as well as some manual controls I’m going to experiment with:
- PIR based motion detectors
- Microwave radar detectors
- Reflective infra-red detectors
- RFID reader designed for reading pet microchips/tags
Dog Door Hardware: Frame
As an initial attempt, I’m going to try out using some 2020 T Slot Aluminium Extrusion often used for 3D printers and CNC machines. With the expectation that the door will run in the slot as a set of guide rails, with some linear sliders providing a robust sliding platform to connect to the door and the motor.
Dog Door Hardware: Door
I wanted to provide a degree of insulation for the door. So I’ve started out with a 5mm foamcore board as a cheap solution. I may replace this with perspex or a combination of layers of different materials. But will wait until I have a working prototype before making that decision.
- Basic frame constructed with sliding rails installed.
- Stepper motor and limit switches installed
- The software has been written to control the stepper motor, with manual activation. ( https://github.com/shortbloke/DogDoor/tree/Initial-Implementation
- Implemented position learning and adaptation. So that stepper acceleration library can correctly accelerate and decelerate and the start and end of travel. Important as when powered on the stepper doesn’t know it’s current position, well it assumes it’s zero.
- Attach the door to the motor drive mechanism
- Implement obstacle detection
- Attach the frame to an MDF backboard, ahead of wall mounting the entire assembly.
- Test presence detection sensors to determine which is most reliable.