Raspberry Pi cat flap project: RPi 3 BLE Bluetooth tag-sensing motorised pet door

By Russell Barnes. Posted

The RPI 3 BLE Cat Door is a motorised Raspberry Pi cat flap project with some high-tech smarts. It uses a Raspberry Pi 3, Node-RED and Bluetooth tracking tags to let cats in.

Living in Santa Rosa, California, Jeremiah Mattison had a major problem with critters getting into his house through his pet door. “There are many cats in the neighbourhood and I was getting woken up every night by them trying to get into the bulk food. Additionally during the fall, in what I have coined ‘Racktober’, we have a problem with raccoons as well.”

The solution was to create a tag-sensing motorised pet door to enable his four cats to get in, but keep other animals out. After a failed attempt based on an Arduino and passive RFID tags, Jeremiah found the purr‑fect solution using a Pi 3 and Bluetooth Low Energy (BLE) tracking tags. “The [RFID] tags had to be really close to the antenna,” he recalls. “The BLE tags are battery powered, so they have greater range and I can use the RSSI metric to control the distance at which they trigger the door.”

Raspberry Pi cat flap: motorised door

To slide open the Ideal Ruff-Weather pet door, Jeremiah originally planned to use a stepper motor with a track or pulley system, but ended up using a motorised car antenna instead. “[I] somehow found myself on a forum thread with people talking about using automotive antennas for DIY automated chicken coop doors. They were just using a simple timer to open and close the door, which wouldn’t work for my project, but the antenna part was perfect.”

Raspberry Pi cat flap

Raspberry Pi cat flap: Controlling the door

Mounted in a metal box to one side of the pet door, the Pi 3 is stacked with two Adafruit Perma-Proto HATs wired up with the extra electronics required – including an H-bridge circuit to drive the motor, and three status LEDs. The blue LED flashes whenever the Pi – programmed using Node-RED – senses a permitted Bluetooth tag within range, currently set to around 2 metres. “This allows the door to open far enough in advance not to spook the cats, but still minimise the time open so other animals can’t sneak in.”

The door waits 15 seconds after the last BLE trigger before closing, which Jeremiah says should be more than enough time for the cats to make it through safely. “There was one time where one of the cats had come into the garage and I walked out and spooked him, sending him running out the cat door right as it was closing so it nicked him a bit; but there’s not much resistance on the automotive antenna so it didn’t really do anything.”

The reaction of his cats to the new door has been mixed. “Two of them are mostly outdoor cats and they had no problem adjusting to the cat door, and even still use it when the garage door next to it is open. The other two are skittish, mostly indoor cats and are still getting used to it.”

To enhance the project, Jeremiah has just mounted a security camera outside the cat door and – as well as snapping photos of critters to tweet via a Twitter bot – plans to use it for image recognition to enable tighter RSSI settings for more accurate door triggering.

Step-01: Motorised door

Jeremiah used a 12 V motorised car antenna, mounted upside-down, to lift and lower the sliding pet door. He ripped out the control circuit and used the motor wires directly.

Step-02: H-bridge motor driver

Wired up on a Perma-Pro HAT, the H-bridge circuit that controls the antenna motor features an Adafruit TB6612 breakout board, plus 1N4001 diodes to protect from reverse voltage.

Step-03: Node-RED flow

After trying to use Python, Jeremiah opted to use Node-RED for the software, employing a BLE scanner node to detect the named Bluetooth tags worn by his four cats.

From The MagPi store

Subscribe

Subscribe to the newsletter

Get every issue delivered directly to your inbox and keep up to date with the latest news, offers, events, and more.