All Projects → orosandrei → Home-Monitoring-Raspberry-Pi-Node

orosandrei / Home-Monitoring-Raspberry-Pi-Node

Licence: MIT license
Raspberry Pi & Node.js diy Home Monitoring & Intruder Alert system

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects
shell
77523 projects
CSS
56736 projects

Projects that are alternatives of or similar to Home-Monitoring-Raspberry-Pi-Node

websocket-webcam
A pure javascript HTML5 webcam client using websockets to stream the image
Stars: ✭ 31 (-32.61%)
Mutual labels:  webcam
AntiEye
:.IP webcam penetration test suit.:
Stars: ✭ 21 (-54.35%)
Mutual labels:  webcam
ARFaceFilter
Javascript/WebGL lightweight face tracking library designed for augmented reality webcam filters. Features : multiple faces detection, rotation, mouth opening. Various integration examples are provided (Three.js, Babylon.js, FaceSwap, Canvas2D, CSS3D...).
Stars: ✭ 72 (+56.52%)
Mutual labels:  webcam
videostream
Video Streaming site using Laravel and WebTorrent
Stars: ✭ 36 (-21.74%)
Mutual labels:  video-stream
MTG-Card-Reader
Reads a Magic: The Gathering card in front of a webcam and identifies it in an existing database of cards of a user-specified set.
Stars: ✭ 32 (-30.43%)
Mutual labels:  webcam
Arduino-OpenCV-Human-Follower
Face detector and follower using Arduino and OpenCV in Python
Stars: ✭ 30 (-34.78%)
Mutual labels:  webcam
spotify-rise
⏰ Spotify alarm clock for Ubuntu Linux
Stars: ✭ 32 (-30.43%)
Mutual labels:  alarm
Nager.VideoStream
Get images from a network camera stream or webcam
Stars: ✭ 27 (-41.3%)
Mutual labels:  webcam
DeepFaceLive
Real-time face swap for PC streaming or video calls
Stars: ✭ 7,917 (+17110.87%)
Mutual labels:  webcam
Android-Alarm
This repository is an Alarm application, demonstrate how to use multiple pending intent to set alarm's time wake up. use popup menu, RecyclerView Adapter, use SQLite to store data
Stars: ✭ 25 (-45.65%)
Mutual labels:  alarm
dnn-object-detection
Analyze real-time CCTV images with Convolutional Neural Networks
Stars: ✭ 93 (+102.17%)
Mutual labels:  video-stream
ToxicEye
👽 Program for remote control of windows computers via telegram bot. Written in C#
Stars: ✭ 305 (+563.04%)
Mutual labels:  webcam
Backdoor
A backdoor that runs on Linux and Windows
Stars: ✭ 36 (-21.74%)
Mutual labels:  webcam
webcam-object-detection
Tensorflow.js webcam object detection in React
Stars: ✭ 24 (-47.83%)
Mutual labels:  webcam
Webcam Paint OpenCV
This Python application uses OpenCV library to track an object-of-interest (water bottle cap in my case) and uses the detected object to draw colored lines (Blue, Green, Red and Yellow).
Stars: ✭ 66 (+43.48%)
Mutual labels:  webcam
ioBroker.alarm
little alarm sytem for iobroker
Stars: ✭ 22 (-52.17%)
Mutual labels:  alarm
avatars4all
Live real-time avatars from your webcam in the browser. No dedicated hardware or software installation needed. A pure Google Colab wrapper for live First-order-motion-model, aka Avatarify in the browser. And other Colabs providing an accessible interface for using FOMM, Wav2Lip and Liquid-warping-GAN with your own media and a rich GUI.
Stars: ✭ 187 (+306.52%)
Mutual labels:  webcam
jeelizGlanceTracker
JavaScript/WebGL lib: detect if the user is looking at the screen or not from the webcam video feed. Lightweight and robust to all lighting conditions. Great for play/pause videos if the user is looking or not, or for person detection. Link to live demo.
Stars: ✭ 68 (+47.83%)
Mutual labels:  webcam
temporalis
Slit-scan webcam with canvas
Stars: ✭ 105 (+128.26%)
Mutual labels:  webcam
SimpleDALPlugin
Simple CoreMediaIO DAL virtual camera plugin example written in Swift
Stars: ✭ 138 (+200%)
Mutual labels:  webcam

Home Monitoring with Raspberry Pi and Node.js

Alt text

Description

The project is designed as a end to end solution for a DIY Home Monitoring & Intruder Alert system. Besides offering a live video stream on any device (web responsive client), it also actively monitors for movement with the help of a PIR sensor.

If an Alarm is triggered, you get a SMS notification on your phone and the snapshots taken during the Alarm time span (customizable - default is 1 minute) are uploaded via FTP to your server.

Activation / Deactivation of the Alarm Mode can be done in 2 ways:

  1. from the Web Client user interface
  2. with a Button - for convenience reasons: it is faster than connecting from your phone / pc & toggling the Alert Mode checkbox
    • there is a 10 seconds customizable delay which allows you to move out of the PIR sensor range
    • a Led indicates the Alarm Mode enabled/disabled status

In order to avoid false positives from the PIR motion sensor, extra checks were added - a detection counter & detection interval. The Alarm gets triggered when the sensor detects movement 3 times in 5 seconds (both values configurable in code).

Technology

The project was developed using:

  • Raspberry Pi - raspbian, brick button & led, Pir sensor
  • Node.js - for the main application
  • Mjpg_streamer - to generate the video stream
  • Shell scripting - for easy application start (interactive & background)
  • Htms/Css/Javascript + Bootstrap - the web client

Project components

Hardware

Alt text

this.Gpio = require('pi-gpio');
this.Hardware = { MotionSensor : 8, Led : 26, Button : 12 };
  • Raspberry Pi
    • I used Model B Revision 2 with Raspbian - any model should be Ok, just be careful with the Gpio configuration pin mappings, they can differ
    • Generic USB webcam (compatible with Raspberry Pi & Raspbian)
    • You can find a comprehensive list here http://elinux.org/RPi_USB_Webcams
    • I used a very old 2MP one which seems to work out of the box with the generic drivers
  • Led & Button
    Alt text
  • PIR motion sensor

Alt text

  • The one I used is available here https://www.sparkfun.com/products/13285
  • It normally connects to Analog Input (ex. on Arduino); however you can use it with Digital as well if you connect a 10K resistor between VCC & Signal
    Alt text
  • To make things easier you can purchase this sensor https://www.adafruit.com/products/189 and skip the soldering part (+ this one has configurable sensitivity built-in, so you might be able to skip the one implemented in the code)

Node application

Dependencies

  • express: ^4.12.3
  • ftp: ^0.3.10
  • http-auth: ^2.2.8
  • ini: ^1.3.4
  • pi-gpio: 0.0.7
  • socket.io: ^1.3.5
  • twilio: ^2.3.0

The dependencies you install with NPM:

npm install module --save

Generic Application.js

It is the basic application object, defined to be reusable in other projects Contains the basic server code, generic config file read/write operations, generic Init & Execute & Exit methods implementations

Home Monitoring ApplicationHM.js

  • config.ini file

    • default video quality & alert mode settings
    • Twilio sms Api Sid, Token, To number, From number
    • Ftp settings
  • Authentication (digest http authentication) - defaults are admin & password :)

    admin:Private:6982db7f1ddc36a0b47b5f8427dc3526
    
  • Web Client application

    • Accessible from anywhere via port forwarding
    • Available also on mobile (responsive web client)
  • Monitoring - gets video from Mjpg_streamer server and sends it to the connected app clients

  • Mjpg_streamer was used as server, but if you prefer another tool like ffmpeg, you can easily replace it because of the loose integration via the start-webcam.sh script

Alarm mode

  • Monitoring - via PIR sensor
  • Alarm - Sms notification (implemented with the help of Twilio text messaging API - very cool service, offers great Trial account for development
  • Alarm - Snapshots upload to server via Ftp

Web Client - responsive

The client application was designed to be accessible on all platforms (pc / tablet / mobile).

Alt text

Video streaming quality settings

By default the 480p at 25fps is enabled (initial settings are loaded from the config.ini file)

My webcam is a low-end 5+ years old 2mp device, but for those of you with better webcams I also added 720p & 1080p

Video resolutions & fps can be configured from the /static/js/script.js file

	ui.quality480p.change(function(){ ConfigUpdateQuality("640x480",25); });
	ui.quality720p.change(function(){ ConfigUpdateQuality("1280x720",15); });
	ui.quality1080p.change(function(){ ConfigUpdateQuality("1920x1080",5); });	

Alert Mode

  • initial state is loaded from the config.ini file
  • You can enable/disable monitoring from checkbox button in the UI
  • The state of the Alert Mode is shown both in the UI (the checkbox) but also by the LED
  • The physical Button can be also used to toggle the Alert Mode
  • All state changes are sent to all connected clients
  • If an Alarm is triggered, the UI checkbox button background will be changed to Red Alt text

Connected Clients

The dropdown shows a list of all connected clients (connection timestamp & IP) that are currently viewing the video stream
Alt text

Shell Scripts

start-app.sh

  • You can start the application in 2 modes:
    • Interactive (for dev / testing): ./start-app.sh
    • Background: ./start-app.sh -background
#!/bin/bash
# application start in interactive or background mode
#arguments:  [-background]

cd /home/pi/Desktop/rpiWorkspace/Node/HomeMonitoring/

if [ "$1" = "-background" ]; then
	sudo nohup node ./App-home-monitoring.js &>log.txt &
else
	sudo node ./App-home-monitoring.js 
fi

start-webcam.sh

  • Used by the application to enable/disable video streaming when clients are connected or when an Alarm is triggered by the PIR sensor.
#!/bin/bash
# webcam video stream
# arguments:  [resolution] [port] [fps]

pkill mjpg_streamer

sudo nohup ./mjpg-streamer/mjpg_streamer -i "./mjpg-streamer/input_uvc.so -y -r $1 -f $3 -q 75" -o "./mjpg-streamer/output_http.so -n -p $2" &

Application Execution Session example

Alt text


TO DO

  • Port the application to Windows 10 Iot on Raspberry Pi 2
  • Support for uploading snapshots to cloud (OneDrive / Dropbox) when an Alarm is triggered

References


Links

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].