GithubHelp home page GithubHelp logo

hama0013 / raspicam-ir-switch Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 708 KB

Raspicam IR-Switch by geographical location horizont sunrise/sunset calculation

Python 100.00%
sunset-sunrise-python switching-ir-filter

raspicam-ir-switch's Introduction

MotionEye is a great tool for building a surveillance camera. The only problem is the missing IR switching functionality but can be simply integrated via Python programming by using a switchable IR-filter camera over GPIO-port. The control to turn on/off should be calculated for every sunrise/sunset automatically by its location defined coordinates(latitude/longitude). Additionally an external IR spot light can/should be used for night recordings/views. I recommend something like this: ScreenShot
What do we need?:
RaspberryPi CSI camera with switchable IR activation port. I recommend this one from Banggood: (It can be used any other one, but note the possibility to connect an activation hardware line with 3.3V support) ScreenShot

Hardware connection:
Typically the CSI cable is delivered with the camera. But the hardware wire for the IR activator has to be organiced self. The hardware wire to the activation port must be soldered at the camera and connected over single pin connector to the Raspis GPIO-port. I‘m using port 17(Pin 11). That’s all to make it working… ScreenShot
Software:
Preparation:
This described integration is not working with MotionEyeOS because of its limited OS. Better is to install latest Raspbian https://www.raspberrypi.org/downloads/raspbian/ and install MotionEye manually. Well described here: https://github.com/ccrisan/motioneye/wiki/Install-On-Raspbian.
I‘ve made all coding with Python over the programming software „Geany“. The programing should calculate next sunrise/sunset automatically every minute and decide, what's the current situation (day/night) and turn on/off the IR filter over GPIO-17. The Python libraries need an additional installation to use the sunrise/sunset calculations from “ephem”, that can be made very easy with this command in the terminal window:

sudo pip install ephem

The original program is derived from http://rhodesmill.org/pyephem/ The changes are:

  • additional text output for local times (current, next sunset/sunrise)
  • additional decision of current situation (day/night), text output, set of the IR pin
  • cyclically call every 60 seconds

Take the code from this repository: "horizont.py" and start at your Raspi with following command:

python horizont.py

You should see something like this:
ScreenShot

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.