iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
🕌

The Road to a Cat Monitoring System: Part 1 - Background and Camera Selection

に公開

Background on Creating the Cat Monitoring System (Optional Reading)

I currently work fully remotely, but on Monday, August 7th, I had to go to the office due to PC trouble and left the house in the morning.

I left around 9:00 AM and returned home around 8:30 PM.
Upon returning, something was wrong with my two cats...
Kohaku was limping, favoring his front right paw,
and Menou was lethargic and wouldn't come out of the cat tunnel.

The kibble in the auto-feeder hadn't decreased at all, and there were no signs of the litter box being used.
At the time, I had SwitchBot products installed, so I was checking the room temperature from outside, but I hadn't installed a pet camera because I didn't think I would be away from home for long periods.

Ultimately, between 9:00 AM on Monday, 8/7, and 10:30 AM on Tuesday, 8/8:
Kohaku ate an estimated 20g of food, peed once, and pooped zero times.
Menou ate an estimated 5g of food, peed zero times, and pooped zero times.
This was clearly an abnormal situation where something had happened.

When I went to our regular vet on 8/8,
they said, "The base of the front right leg is swollen on both of them. They might have fallen from a high place."

Usually, in the mornings, they chase each other around the room,
running up and down the cat tower, so I speculate they might have fallen together during that time.

...So, I decided to buy a camera to record what happens when I'm away.

And while I'm at it, I thought I'd monitor the cats thoroughly.

What I want to achieve

Must-haves

  • Consolidate frequently used smart home functions into a desktop app on the PC
  • Monitor camera footage from the PC
  • Save still images and videos at any timing
  • Motion detection
  • Sound detection
  • Detect only cats (I don't care about people. Assuming no burglars will enter)
  • Distinguish between when they are moving quietly and when they are running around boisterously
  • Record video with audio only while the cats are running around boisterously
  • Between 0:00 and 09:00, if the cats are running around:
    Turn on the TV and play "Videos for Cats" on YouTube.
    Turn off the TV once 30 minutes have passed since the cats became quiet.

Nice-to-haves (if I have extra energy)

  • Notify if a cat is misbehaving in the kitchen
  • If misbehavior is detected in the kitchen, drive them away
    Example: Play a sound cats dislike, automatically spray a water mist, etc.
  • Notify when a cat uses the litter box
  • Manage the time and amount of food the cats eat

Regarding the litter box, it might be faster and more reliable to introduce an automated litter box that has cat identification, usage logging, and weight check functions.
But I want to manage the litter box from my PC too...

Camera Selection

Requirements for the camera

The conditions I sought for the camera are as follows:
(1) Can check footage from PC/smartphone in real-time.
(2) Can take videos/still images from PC/smartphone at any timing.
(3) Can control Pan/Tilt/Zoom from PC/smartphone.
(4) Capable of motion detection and object (cat) detection.
(5) Resolution is Full HD (1920x1080), frame rate is around 25-30fps.
(6) Camera and PC/smartphone connect via Wi-Fi (2.4GHz).

Since I spend overwhelmingly more time at my PC than on my smartphone,
checking footage and operating from the PC were essential.

I had already introduced SwitchBot, so I considered their indoor camera MP3, but it seemed like (1) and (2) were not possible from a PC.

As for (4), I could do something similar using Python on a PC, so it didn't necessarily have to be a built-in function of the camera itself.

I was considering building everything from scratch using a Wi-Fi-enabled net camera, a Raspberry Pi, and motors, but the deciding factor was finding a pioneer who was making a surveillance camera viewer in Python, so I chose a camera called the Tapo C210.

Here is the article that was the deciding factor:
https://zenn.dev/kotaproj/articles/71ab74393a8d32

Other pros of the Tapo C210:

  • 3 megapixels (better image quality than the C200)
  • ONVIF support (necessary for operating from a PC)
  • RTSP support (necessary for viewing from a PC)
  • Affordable price (less than 5,000 yen including shipping)

Compromise points:

  • 15fps
  • No specific function to detect cats (only person detection and baby crying detection functions available)

Impressions after installation

Points I like

  • Easy to install and set up.
  • The image quality is clear.
  • Even in Night Mode (during night recording), the cats are clearly visible.

Points that could be improved

  • The usability when returning from full-screen display in the Tapo app is mediocre.
  • The cats react to the drive noise during Pan/Tilt operations.
  • The camera lacks a Zoom function (I noticed this during viewer development).
  • "Motion detected" notifications come quite frequently.
  • There is no function to detect and notify about loud noises.
  • The AC adapter is large, making the area around the outlet cluttered.
  • Functions like cloud storage for footage are paid (1-month free trial available, but I haven't used it).

Notes: Camera-related Standards

UVC (USB Video Class)

UVC (USB Video Class) is a communication standard for webcams. When connecting a webcam to a PC, DVR, or NAS, if both devices support this method, video transmission and PTZ operations become possible. However, when using a webcam that supports this standard, a USB terminal that supports USB bus power supply is required.
https://bouhancamera-choice.com/words/usb-video-class

The camera I previously used for work was this type.
You can easily obtain footage from a PC just by connecting the camera directly via USB. However, this time I had no intention of connecting the camera and PC directly and wanted to use Wi-Fi, so I excluded this type.

ONVIF (Open Network Video Interface Forum)

ONVIF is a forum that defines common standard interfaces between network camera products, founded by Axis Communications, Sony, and Bosch, or refers to those standards themselves.
When building a security/surveillance camera system, if it complies with the ONVIF standard, there is a significant advantage in being able to combine cameras and recorders from different manufacturers. It is the most widely adopted standardization for network cameras worldwide, with approximately 500 companies and over 7,500 products compatible (as of March 2017).
https://bouhancamera-choice.com/words/onvif

This is a standard for network cameras.
Since the interface is standardized, you can view and control footage using ONVIF-compatible software. In other words, you don't necessarily have to use the camera manufacturer's dedicated app.

RTSP (Real Time Streaming Protocol)

RTSP stands for Real-Time Streaming Protocol. It is a protocol used to achieve real-time streaming communication and is mainly utilized when distributing multimedia content such as video and audio in real-time.
https://the-simple.jp/what-is-rtsp-an-easy-to-understand-explanation-of-the-basic-concepts-of-real-time-streaming-protocols

This is an essential standard for checking real-time footage on a PC or live streaming on YouTube.
Since SwitchBot's indoor cameras do not support this standard, I excluded them this time. This was the biggest reason I couldn't unify the brands of smart appliances in my home.

PTZ Camera

A PTZ camera, or PTZ function, refers to a camera or function that can be operated "remotely" by combining Pan (moving the camera's angle of view horizontally), Tilt (moving the camera's angle of view vertically), and Zoom (enlarging/zooming up or reducing/zooming out the angle of view).
https://bouhancamera-choice.com/words/ptz-camera

Essential for changing the angle of view or zooming in/out.

In the next article, I will actually start the development.

Discussion