Coder Social home page Coder Social logo

oprema / momo Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 1.02 MB

Motion Monitor (MoMo) - Unobtrusive surveillance for elderly or handicapped persons with a Raspberry Pi and a PIR-Sensor

License: MIT License

HTML 4.59% Python 20.89% CSS 20.30% JavaScript 54.22%
raspberry-pi react reactjs surveillance handicapped elderly motion-detection alarm client server

momo's Introduction

Using a Raspberry Pi for unobtrusive surveillance or how to know someone is moving around in a flat or a house?

Unobtrusive surveillance? Are you kidding? There is no such thing. Let me explain: In many places around the world demographic change is happening. Although older, people still prefer to stay independant and live at home. Not a problem, you say, as long as a elderly is fit. True, and the most obvious approach is for a family member to check-in daily to be sure everything is ok. A phone call is good too, but the more often you have to call or check in the more stressful it gets for all parties. Today, in times of cheap computing and the internet there are other possibilites. One of these that I had fun implementing uses a Raspi with a PIR-Sensor (pasive infrared sensor) and a React-App to see when the last infrared-emitting, moving object passed the PIR sensor. This could be your relative or it could also be a cat on a roomba.

The App logs every movement within a specific (configurable) duration. If no one passes the sensor within that duration the app sends an alert email to a configurable number of email addresses.

Below is all you need to build a MoMo device yourself

  1. A Raspberry Pi (any type will do it).
  2. A PIR-Sensor (cheap at ebay for example).
  3. Some wiring (solder or with pre-fabricated cables).
  4. An internet connection in your relative's home.
  5. An internet router that can redirect http(s) traffic to the Raspi.
  6. A static IP or a DynDNS-Service pointing to the IP of the current internet connection.

To get you thinking about how this could work in your situation, let me show you an App screenshot. What you see is a clock and a circle that changes color the longer it has been since the last movement was detected, some infos (status and last movement) and on the bottom, a simple chart that counts movements during certain durations.

Placing the PIR-Sensor

The best location for the sensor is somewhere your relative will reliably pass by as often as possible. For example: In front of the refrige or somewhere on the way to the bathroom.

Wiring Plan: PIR-Sensor <-> Raspi

Sensor    Raspi   
5.0V      5.0V    - Pin 17   
PIR-OUT   GPIO.27 - Pin 13   
GND       GND     - Pin 20   

Installation of the Client (React part)

First install Node as described in: https://github.com/audstanley/NodeJs-Raspberry-Pi

sudo apt install git
wget -O - https://raw.githubusercontent.com/audstanley/NodeJs-Raspberry-Pi/master/Install-Node.sh | sudo bash
node --version

Clone this repository directly into /home/pi and execute

npm install
npm run build
sudo npm install -g serve
serve -n -s build -l 3000

For a more flexible setting you can separate client and server. This allows you to have the PIR-Sensor closer to a more often frequented spot (with an additonal Raspi as PIR-server for example).

Installation of the Server (we use gunicorn for production)

cd raspi
sudo apt install python3-dev python3-pip
pip3 install flask flask_cors RPi.GPIO python-dotenv
sudo pip3 install gunicorn

Next rename .env-example into .env and fill out the missing entries in this file.

Finally add the lines below to start client and server in your crontab with crontab -e

@reboot cd raspi && gunicorn -c ./pir-api.config.py pir-api:app
@reboot serve -s build -p 3000

Todo

  • More configuration params
  • Using nginx as proxy for gunicorn with ssl support
  • Text message (SMS) alerts through twilio or another such service

Thanks to

Dan Conrad for his DayLight App which was a really good starter for MoMo. You can see it here: https://github.com/danmconrad/daylight.git.

momo's People

Contributors

jensc avatar oprema avatar

Stargazers

 avatar

Watchers

 avatar  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.