Skip to content
Go back

A-Eye in the Sky

Published:  at  09:12 PM

A Big Purchase—In Both Cost and Size

I recently hit a major life milestone: I bought a brand new couch! No more questionable, used couches for me. In addition to composing a significant portion of my children’s inheritance, it also meant new changes for my dog, Rupert.

You see, Rupert is an angel—just look at him!

Rupert Lounging

Rupert the Half-Human Dog Lounging on the Couch

But, he unfortunately loves sleeping on the couch…

Rupert's Perfect Sleeping Posture

Rupert’s Superior Sleeping Posture

With the new couch came change, and I’m not talking about nickels. His couch-surfing days were numbered due to his relentless shedding. Don’t worry, he still has his own couch he can use however he wants in our office, but the new couch? Off-limits.

Rupert, being a smart cookie, quickly adjusted to the changes. We gave him his own comfy bed (Costco’s finest, highly recommend) to console this abrupt change and make me feel less guilty for abruptly ending his free-reign couch tenure. All was going well. We had a hair-free, pristine couch.

At least, that’s what I thought until my beautiful girlfriend (she’s holding me at gunpoint, send help) realized he was couch-surfing while we were away. Unfortunately, his intelligence gets the best of him when not in our presence, and he learned he can do whatever he wants when unmonitored.

Me At Work While Rupert Sleeps on the Couch

Forever Jealous Dogs Don’t Have to Work

Houston, We Have a Problem…

I started with some makeshift barriers from around the house thinking that would stop him.

Rupert Sneaking onto the Couch

Sneaky Dog…

Nope… So, I moved onto a more established barrier by erecting a gate to block off his access to the area with the couch altogether. That’s when I learned just how much this dog wants to be on the couch.

Rupert Jumping Over and Onto the Couch

He’s Got That Dog in Him

Outsmarting the Pooch

Despite the attempts to prevent his unmonitored behavior, it became clear I needed to outsmart the dog. While Rupert is crate-trained, it always hurts my heart a little leaving him in there. So, I decided to put my engineering skills to use and develop an overly-complicated solution for a minor life inconvenience. Action!

The Plan

I wanted to use a camera combined with some AI tools to monitor Rupert’s activities and detect whether he is on the couch or not. If he is on the couch, I’d use an old training collar to administer a beep, letting him know someone is watching…

Always Watching

Always Watching…

My final solution is available for use in my dog_cam Github repo: tannerjallen/dog_cam - GitHub

Getting Myself Off the Couch

My first idea was to use a Wi-Fi camera feed to keep an eye on Rupert’s activities. However, our Ring camera didn’t broadcast an easy-to-access feed to develop off of. Based on some research, I landed on using a Wyze Cam v3 to broadcast a Real-Time Streaming Protocol (RTSP) video feed. This was a little difficult. Wyze’s current camera firmware does not support RTSP. This required backdating the cameras firmware to an older version that did support RTSP feeds. For more information on this, the following Wyze support articles discuss Wyze’s RTSP support:

Honey, Where is the Dog?

After setting up the RTSP video feed successfully, I processed the data to classify the couch and Rupert. I started with Ultralytics YOLO11 real-time object detection model. This model consumes video data frame-by-fame and classifies known objects.

This model detects dog and couch objects, making it ideal for this use case.

I started with having it detect Rupert and track his position. In addition to having it draw a rectangle boundary around him, I added some logic to calculate his boundary’s centroid. This seemed like a more conservative way to represent his actual position. Here’s the model following him around:

YOLO11 Tracking Rupert

We Found The Dog!

Honey, Where is the Couch?

Now that I’m tracking my son—I swear I’m not that type of dog owner. I transitioned to figuring out how to establish a boundary (a lesson I’m still trying to learn in all aspects of my life). YOLO11 successfully classified the couch and constructed a boundary out of the box.

YOLO11 Detecting the Couch

YOLO11 Model Detects Couch and Draws Boundary

The blue boundary the model draws was a little too liberal for this use case—I didn’t want to detect when Rupert was lying on the floor near the couch or was walking behind it. I only wanted it to detect when he was actually on the couch, so I refined boundary to a tighter detection zone focused on just the couch’s seating surface. The red boundary is the danger zone Rupert is not allowed in.

So, What Are You Gonna Do About It?

Now that I had a functioning way to detect Rupert’s position and an imaginary no-no zone, I moved on to what action would be administered to thwart this canine couch-surfer. I found an old training collar (available here) and tore apart the transmitter.

The transmitter had three contact pads for each of the collar’s functions: beep, vibrate, or shock.

Since I strongly question the ethics of allowing an object detection model to administer a shock to my pup, I decided to only use the beep function.

These pads transmit a signal to the collar to perform the respective action when shorted across each other. It’s just a switch. On the back of the circuit board, there were contact pads to solder to. After soldering prototype wiring to each side of the beep switch, I moved onto the controls.

The wiring from the transmitter connects to the emitter and collector pins of an NPN transistor (2N2222). A Raspberry Pi 4 GPIO pin with a 1kOhm resistor in series connects to the transistor’s gate. This allows me to control the training collar transmitter with the Raspberry Pi 4.

Transmitter and Raspberry Pi Wiring

Wiring Diagram

By setting the GPIO pin to high (or just ON in non-technical jargon), the transmitter commanded a beep from the training collar. I wrote a simple Python function to integrate these systems together.

When Rupert is detected in the couch’s danger zone, the Raspberry Pi closes the transmitter’s switch commanding a beep from the collar. I also implemented some logging to let me know each time the script requested a beep, so I could review the camera footage and validate it was a legitimate trigger.

Did It Work?

After gaining complete confidence in the solution, I left Rupert alone for around 30 minutes and sure enough…

Successfully Deterring the Couch-Surfer

It Worked!

Right as he thought about jumping on the couch, the system administered a beep to let him know he’s being watched.

Fun fact: He only attempted to get on the couch once that day. What can I say? My boy’s a quick learner!

Some Medium-Sized Hurdles Encountered

I know it sounds like this project was a total breeze, but it wasn’t necessarily, and I love being transparent about my stupid moments. Here are a few hurdles I encountered:

Canine Camera: The Reunion

After using the solution for over a week now, Rupert has not made his way onto the couch at all! The logs report he has only attempted to get on the couch five times with absolutely no attempts the past few days.

Great Success

Big Win

The shelf the camera sits on has also encountered a few bumps from the Roomba shifting the camera’s perspective a little bit. If I wasn’t using an object detection model that dynamically classified the couch boundary, this would have required me to recalculate hardcoded couch boundary coordinates. I’m happy I went with the more advanced system that does this all for me and allows me to just move this camera wherever I want.

I learned a bunch about object detection models, and Rupert learned he’s expected to behave even when someone’s not directly monitoring him!

He may have lost the couch, but I promise he’s still living his best life.

Crazy Rupert

Look At Those Chompers!



Next Post
Tanner The Tutor