Code Monkey home page Code Monkey logo

dogcam's Introduction

DogCam

This is a simple camera capture and web server script to stream data from a Raspberry Pi camera to a web browser. I use it to see what my dogs throughout the day.

WARNING: This is insecure. There is no password protection or SSL protection.

Hardware

The hardware includes:

  • Raspberry Pi Zero W (with Wifi)
  • Official case for Raspberry Pi Zero
  • 8 GB micro SD card
  • Raspberry Pi Camera Module (v2)

Everything but the camera were purchasd as a bundle:

Total cost is around $50. I used existing montiors and keyboards for initial setup.

Software

Once the hardware is set up and assembled, the following steps will get it going.

  • Set up Wifi using sudo raspi-config. More details available here.
  • Ensured python v3 and virtualenv were installed. You may need to sudo apt-get install python3 virtualenv or something like that.
  • Copy this repository into a directory like ~/dogcam
  • In that directory, create a new environment virtualenv env
  • Install the dependencies: env/bin/pip install -r requirements.txt
  • Run the script in the background env/bin/python3 webstream.py 8000 & to serve on port 8000

Note to access outside the home, the port must be opened on your router.

Implementation

There are three components, the image capture, the motion detection, and the web server. The image capture is performed using community tools for the raspberry pi, and motion detection using CV2. In order to do the capture, motion detection, and web service through a single script, maintaining simplicity, and avoid the challenges of multithreaded or multiprocess programming, the new asynchronous capabilities of python were used, using aiohttp as the webserver, and adapting the camera utilities to work in an asynchronous manner.

This was also my chance to experiment with the new async tools.

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.