diff --git a/src/content/designing_and_building_an_ai_enhanced_cctv_system_at_home.md b/src/content/designing_and_building_an_ai_enhanced_cctv_system_at_home.md new file mode 100644 index 0000000..7c83972 --- /dev/null +++ b/src/content/designing_and_building_an_ai_enhanced_cctv_system_at_home.md @@ -0,0 +1,55 @@ +Okay, here's the draft blog post, aiming for a professional tone, minimising code examples, and incorporating the provided information. I've tried to smooth out some of the more casual phrasing while retaining the enthusiasm. I've also included the Mermaid diagram as requested. + +--- + +## Designing and Building an AI-Enhanced CCTV System at Home + +For the past six months, I've been immersed in designing a home CCTV system for my homelab. The goal? Locally controlled, owned camera data, combined with the power of AI-enhanced semantic search and intelligent notifications. It's a project that started as a bit of a tinkering exercise, but the potential it unlocks is genuinely impressive. + +The core of this system revolves around Frigate ([https://frigate.video/](https://frigate.video/)), a remarkably intuitive NVR (Network Video Recorder) software. Frigate’s strength lies in its ease of use and its container-native architecture, allowing for repeatable builds managed through a simple YAML configuration file ([https://docs.frigate.video/configuration/reference](https://docs.frigate.video/configuration/reference)). This has been invaluable for testing different configurations and camera setups. While I haven't yet fully publicised the complete system configuration (still working on securing some credentials!), my intention is to share it openly so others can replicate the setup. + +Exploring Frigate’s extensive options has been a fascinating learning experience. I’ve been able to fine-tune camera connections, experiment with FFmpeg configurations, and even implement looping of internal and external streams to reduce the load on the cameras themselves. It’s provided a real insight into how commercial NVR and cloud-based systems operate. + +My current setup utilises three (with plans to expand to four) TP-Link C540 cameras, acquired during a Black Friday sale for a steal at AUD$50 each ([https://www.amazon.com.au/gp/product/B0BJP6JJB3?smid=ANEGB3WVEVKZB&th=1](https://www.amazon.com.au/gp/product/B0BJP6JJB3?smid=ANEGB3WVEVKZB&th=1)). These cameras offer pan and tilt functionality, and even include onboard human detection and tracking, which is working exceptionally well. While they lack zoom capabilities, they perfectly suit my surveillance needs. + +**The System Architecture** + +```mermaid +graph LR + Camera --> FrigateObjectDetections + Camera --> FrigateNVR + FrigateObjectDetections --> OllamaAI[Ollama (qwen3-vl-4b) for semantic search AI enhancement] + FrigateNVR --> HomeAssistant + HomeAssistant --> OllamaAI2[Ollama (qwen3-vl-2b) for context enhancement] + HomeAssistant --> MatrixNotifications[Send response via Matrix] + style OllamaAI fill:#f9f,stroke:#333,stroke-width:2px + style OllamaAI2 fill:#f9f,stroke:#333,stroke-width:2px +``` + +**AI-Powered Intelligence** + +Frigate’s integration with object detectors ([https://docs.frigate.video/configuration/object_detectors](https://docs.frigate.video/configuration/object_detectors)) is a game-changer. It provides basic NVR and vision capabilities, and can detect cars, motorbikes, and animals – a significant upgrade from standard CCTV. If your hardware includes a relatively recent GPU, this detection can be performed locally. Frigate relies on models from Hugging Face ([https://huggingface.co/](https://huggingface.co/)), requiring internet access for initial deployment and occasional model updates. + +A particularly exciting development is Frigate’s integration with Ollama. This allows me to send detections and alerts to a generative AI service, enabling powerful semantic search capabilities. For example, I can now search for "Red SUV" or "White Ute" within my camera footage and quickly narrow down results based on AI-provided context. This significantly enhances the utility of the system. + +**Storage and Integration** + +For storage, I’ve dedicated an SSD for the Frigate software and a 2TB HDD to store video data. This should provide approximately 7 days of full history, 14 days of detections, and 30 days of alerts across the four cameras. Initial results suggest this capacity is sufficient. + +The system seamlessly integrates with Home Assistant ([https://docs.frigate.video/integrations/home-assistant/](https://docs.frigate.video/integrations/home-assistant/)). This allows object detections and other camera metadata to be leveraged within Home Assistant’s automation platform. Because I already use Home Assistant to connect to Ollama and Matrix, I can trigger notifications based on object detection, provide AI with context about the detected object type, and then request further analysis and context before sending the notification via Matrix to my phone. The result is a truly powerful, locally-owned, and AI-enhanced CCTV system. + +**The Hardware Foundation** + +All of this runs locally on a dedicated node within my Proxmox cluster ([https://blog.aridgwayweb.com/proxmox-cluster-1.html](https://blog.aridgwayweb.com/proxmox-cluster-1.html)), deployed using Docker LXC containers. This provides a robust and isolated environment for the system. + +**Looking Ahead** + +While the system is already delivering impressive results, there’s still room for improvement. The prompts used for both semantic context enhancement and notifications are currently a little rudimentary and require refinement. My long-term goal is to leverage AI to make decisions about *whether* to send a notification, as I currently receive alerts for every person or vehicle that passes by. However, even in its current state, the system provides valuable metadata enhancement for targeted semantic searches and AI-powered context for notifications. + +Finally, a huge thank you to my Dad. As someone who isn't particularly adept at running ethernet cables through roofs, I relied heavily on his expertise to get the wired cameras installed. It was a significant undertaking, and his help was invaluable. I couldn't have built this system without his guidance and assistance. + + + +--- + +Let me know if you'd like any adjustments or further refinements! \ No newline at end of file