/ivc-kolpak

IVC-KOLPAK - smart CCTV system powered with Telegram

Primary LanguageShell

IVC KOLPAK - smart CCTV system powered with Telegram

WARNING! REPOSITORY IS UNDER CONSTRUTION

This is template article. For any questions please ask in Telegram group @ivckolpak

Overview

IVC KOLPAK is DIY smart CCTV system that alerts to Telegram if motion is detected in the camera area. This gives feature to reduce human attention for CCTV system and provides Internet traffic economy. It comprises the principles of simplicity and convenience, and low cost of ownership. It's best for far objects with rare motion events where only available 3G/4G Internet connection.

ivc-kolpak-gen2_assembled

Features

  • CCTV with motion detection and alerts to Telegram
  • Filtered content from CCTV. No need to revise recordings and archive - all information in the smartphone or PC
  • Text, photo and video (animations) with motion object into Telegram chat, group or channel available 24/7
  • WiFi hotspot service (used internal 3G/4G modem for Internet access)
  • Automatic enable/disable CCTV when trusted device connected to WiFi hospot
  • Periodical system reports about uptime, system life parameters, connected devices and other
  • 2 week (or more) archive on SD card for archive purposes
Technical features
  • Using motion 4.2+ feature movie_passtrough allows to convert from mpeg to h264 videos direct from camera's stream. In case of use h264-camera no recompression needed.
  • Ramdisk improves SD-card lifecycle
  • Photos can be send as originals or as media groups.
  • Telegram bot core (estgb and telebot library) written in C. It works faster and consumpts less memory.
  • Expremental use of cedrus264 codec for hardware accelerated video encoding (with legacy kernel only).

Why Telegram?

Using Telegram service providing following advantages, dramatically simplifies the device and reduces costs:

  • Cloud storage for photos and videos in the chats, groups or channels. All information from the device will be kept in the Telegram's cloud. No need to make your own infrastructure or use other paid service.
  • Access to Telegram from any device and platform even at the same time
  • Simply to share photo and videos from the camera
  • Telegram has an open API and protocol free for everyone (hey, Whatsapp and Viber!)

Software

Ready-to-use images

Ready-to-use images are available for:

  • Orange Pi Lite (with H3 CPU) for mainline kernel (Debian 9 Stretch). Also available experimental image with legacy kernel (Ubuntu Xenial) for test purposes of hw-accelerated x264 codec (cedrus264);
  • Orange Pi Zero Plus (with H5 CPU) for mainline kernel (Debian 9 Stretch).
    Ask for mentioned images in Telegram group @ivckolpak.

Hardware

Hardware part includes:

  • Orange Pi board
  • UVC USB camera (or any IPCam with RTSP)
  • SD Card
  • High gain WiFi antenna
  • Power supply 5V/2A (or 12V/1A with UBEC or other DC-DC converter)
  • Box, cables, screws, nuts ivc-kolpak-gen2_open case

Bill of materials

IVC KOLPAK Generation 1 "Leningrad" with USB UVC Camera
Item # Component Q-ty Est. price Link to shop
1 Orange Pi Lite 1 US $12.00 AliExpress
2 SD card 32G 1 US $4.99 AliExpress
3 UVC USB Camera (OV2710 2MP 1080P HD) 1 US $20.00 AliExpress
4 WiFi antenna with pigtail 1 US $4.84 AliExpress
5 Power supply 5V/2A 1 US $1.61 AliExpress
6 Short USB Cable for 3G/4G modem 1 US $0.52 AliExpress
7 Screws and nuts 1 US $4.68 AliExpress
8 CPU and RAM heatsinks 1 US $1.76 AliExpress
9 3G/4G modem (any Huawei with HiLink firmware) 1 - Local shop
10 Junction box 1 - Local shop

ivc-kolpak-gen1-inside

IVC KOLPAK Generation 2 "Minsk" with XM H264 IP Camera
Item # Component Q-ty Est. price Link to shop
1 Orange Pi Zero+ 1 US $14.90 AliExpress
2 SD card 32G 1 US $4.99 AliExpress
3 XM H264 IP Camera 1 US $18.47 AliExpress
4 WiFi antenna with pigtail 1 US $4.84 AliExpress
5 Power supply 12V/1.5A 1 US $1.61 AliExpress
6 UBEC Hobbywing 6-36V to 5V/3A 1 US $1.98 AliExpress
7 Short USB Cable for 3G/4G modem 1 US $0.52 AliExpress
8 Screws and nuts 1 US $4.68 AliExpress
9 Cables 1 US $1.21 AliExpress
10 USB socket 1 US $0.80 AliExpress
11 CPU and RAM heatsinks 1 US $1.76 AliExpress
12 3G/4G modem (any Huawei with HiLink firmware) 1 - Local shop
13 Junction box 1 - Local shop

ivc-kolpak-gen2-inside

Building from the scratch

Step 1. Install OS and software
  1. Download, burn, install Armbian according to installation guide for Armbian
  2. Build and install motion 4.2+ according to abbreviated building guide
  3. Install from repository ImageMagick: sudo apt-get install imagemagick
  4. Install from repository libjson-c3: sudo apt-get install libjson-c3
  5. Install from repository usb-modeswitch: sudo apt-get install usb-modeswitch
  6. Extract ivc-kolpak package from this repository into /etc/ivc-kolpak
Step 2. Create Telegram bot
  1. Create your own telegram bot using @BotFather bot according to the official guide. Get bot token.
  2. Create 3 channels (or groups): Photo, Video and System. Get id for each channel (or group) using @getidsbot.
  3. Add your new bot to the channels (or groups) as administrator.
Step 3. Configuring system
  1. Configure ramdisk
    • Add into file /etc/fstab following line: ramdisk /mnt/ramdisk tmpfs rw,size=256M 0 0
  2. Configure WiFi hotspot
    • Use armbian-config utility to configure WiFi hotspot
  3. Configure ImageMagick
    • In the file /etc/ImageMagick-6/policy.xml find line policy domain="path" rights="none" pattern="@*"/ and comment it like <!-- policy domain="path" rights="none" pattern="@*"/ -->
  4. Configure telegram bot.
    • Write bot token of your bot into files .token in paths /etc/ivc-kolpak/channels/photo/, /etc/ivc-kolpak/channels/video/, /etc/ivc-kolpak/channels/system/
    • Write id for each channel (or group) into files .userid in the same way as bot token.
  5. Make symlinks
    • make symlinks for all scripts from /etc/ivc-kolpak/scripts/ to /usr/bin/. Be sure that all scripts have permissions to execute.
    • make symlinks from /etc/ivc-kolpak/motion/ to /usr/bin/.
    • make symlink for /etc/ivc-kolpak/bin/telebot.so.0.5.0 to /lib/
    • make symlink for /etc/ivc-kolpak/bin/estgb to /usr/bin/. Be sure that estgb have permissions to execute.
  6. DOES ANYBODY WANT TO CREATE INSTALLATION SCRIPT? :)

Similar or related projects

Support

Telegram group @ivckolpak is provided for info and questions