Giter Site home page Giter Site logo

asjidkalam / cameras_robonomics Goto Github PK

View Code? Open in Web Editor NEW

This project forked from 418sec/cameras_robonomics

0.0 1.0 0.0 1.01 MB

Using Robonomics tools to control IP cameras

License: Apache License 2.0

Python 100.00%
418sec huntr security cameras-robonomics

cameras_robonomics's Introduction

Cameras for Transparent Production Under Robonomics Parachain Control

This repository is an example of using Robonomics tools with single-board computer, IP camera and label printer to demonstrate providing trustworthy production surveillance

Record video, store it in IPFS and send hash to blockchain. Optionally print sticky label with qr-code link to pinned video

Used hardware

  • RaspberryPi4 2 GB with Ubuntu 20.04 installed;
  • IP camera Hikvision HiWatch DS-I200C + power supply/PoE injector;
  • Label printer Brother QL-800;
  • Optional: Wi-Fi router Mikrotik RB941-2nD for scalability (e.g. add more cameras), remote access or stable Wi-Fi connection;
  • Tumbler for triggering recording. Generally, GPIO may be used with other hardware.

Used services

  • Pinata as a pinning service to widely spread video over IPFS;
  • YOURLS to print qr-codes with short predefined links.

Used software. This is to be installed on RaspberryPi4, connection to which may be established by yggdrasil + ssh

sudo apt install ffmpeg
wget https://dist.ipfs.io/go-ipfs/v0.6.0/go-ipfs_v0.6.0_linux-arm.tar.gz
tar -xvf go-ipfs_v0.6.0_linux-arm.tar.gz
rm go-ipfs_v0.6.0_linux-amd64.tar.gz go-ipfs_v0.6.0_linux-arm.tar.gz
sudo ./go-ipfs/install.sh
rm -rf go-ipfs
sudo apt-get -y install python3-rpi.gpio
sudo usermod -G dialup -a $USER
pip3 install brother_ql
sudo usermod -G lp -a $USER
#reboot
sudo reboot

Preparations

  1. Install [Ubuntu 20.04] on RaspberryPi4;
  2. Install all the software;
  3. Set up IP camera. It should have a static IP to put it in configuration file. HD quality is recommended for less file size. Feel free to adjust OSD info. You may need windows to set it up for Hikvision;
  4. Set up YOURLS server;
  5. Set up a printer. For this case, you can follow this manual
  6. Solder a tumbler to 5V (PIN4), GND(PIN6) and GPIO18 (PIN12) (in this example) pins on Raspberry Pi;

Raspberry

  1. If you use router, set it up to connect camera to RaspberryPi4 and connect router to the internet;

To run:

  1. Download source code and install additional python libraries:
git clone https://github.com/PaTara43/cameras_robonomics
cd cameras_robonomics
sudo pip3 install -r requirements.txt
  1. Specify all the information in configuration file.
nano config/config.yaml

It has comments for better understanding. Read them carefully. All the information about creating accounts may be found here. To send transactions between accounts they should have some tokens.

  1. Launch script
python3 main.py
  1. Now you can start and stop recording with a tumbler. May need some debugging to find out which position is ON and OFF.

How it works

Tumbler stands into ON, camera creates a short URL redirecting to nowhere (IPFS gateway with no hash), creates a qr-code with this short URL, prints the qr and starts filming. Once tumbler is switched to OFF, camera stops filming, publishes video to IPFS, changes short URL redirection link to gateway with hash address of the video and sends the video to Pinata pinning service for wider spreading over IPFS. IPFS hash of the video will be available on Robonomics platform Chainstate->datalog->CAMERA account and stored there securely.

Auto-start

You may want to auto-restart this script. To be able so, edit service file

nano services/robonomics_cameras.service

and fill it with path to python3 and the script. Don't forget to fill in username. E.g.:

ExecStart=/usr/bin/python3 /home/ubuntu/cameras_robonomics/main.py
User=ubuntu

Then move it to /etc/systemd/system/ and run:

sudo mv services/robonomics_cameras.service /etc/systemd/system/
systemctl enable robonomics_cameras
systemctl start robonomics_cameras

To check service status do:

systemctl -l status robonomics_cameras

cameras_robonomics's People

Contributors

asjidkalam avatar patara43 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.