luetzel / motion_eye_servo_action

Python scripts to add pan-tilt action buttons for motioneye using an Adafruit PCA9685 servo controller
GNU General Public License v3.0
6 stars 5 forks source link

motion_eye_servo_action

Python scripts to add pan-tilt action buttons to motionEye using an Adafruit PCA9685 servo controller

Purpose and features

Collection of Python scripts to add pan-tilt action buttons to motionEye.

A pan-tilt bracket, equipped with two SG90 standard servos is wired to an Adafruit PCA9685 16-channel servo driver to control a Raspberry Pi Cam.

Image

The scripts add action buttons (up/down, lef/right) to the camera overlay, in order to pan/tilt the camera. Current servo positions are stored as integer values in file vert_pos and horz_pos.

Wiring

Adafruit Shield -> Raspberry Pi

Vertical servo -> Channel 0 Horizontal servo -> Channel 1

Since micro servos tend to make some noise when idle, they can be powered-off by pulling the Enable Output (EO) Pin to HIGH.

Installation

The scripts require the Adafruit PCA9685 Python library, available from:

git clone https://github.com/adafruit/Adafruit_Python_PCA9685.git
cd Adafruit_Python_PCA9685
sudo python setup.py install

Files must be copied into the motionEye configuration directory, which is usually located at

/etc/motioneye

Pyhton scripts must be made executable with:

sudo chmod 755 /etc/motioneye/up_1

In case that you have multiple cameras connected, you may have to rename the files to match your camera_id

Please note that you have to adjust servo_min/servo_max value for both, the vertical and horizontal servo.

Credits