How to Install and Set Up MotionEye on Raspberry Pi

Ben
Ben
@benjislab

MotionEye is a web-based frontend for the motion daemon, allowing you to create a powerful and flexible video surveillance system using your Raspberry Pi. This guide will walk you through the steps to install and configure MotionEye on your Raspberry Pi, turning it into a robust security camera setup.

Prerequisites

Before starting, ensure you have the following:

  • Raspberry Pi (any model, preferably Raspberry Pi 3 or later for better performance)
  • MicroSD card with Raspberry Pi OS installed
  • Raspberry Pi Camera Module or a compatible USB webcam
  • Stable internet connection
  • Access to the command line (via monitor and keyboard or SSH)

Step 1: Update and Upgrade Your Raspberry Pi

First, make sure your Raspberry Pi is up to date.

  1. Open a terminal on your Raspberry Pi or SSH into it.
  2. Run the following commands to update and upgrade your system:
sudo apt update
sudo apt upgrade -y

Step 2: Install Motion

Motion is the software that MotionEye uses to detect motion and handle video streams.

  1. Install Motion:
sudo apt install motion -y
  1. Verify the Motion version:
motion -h

Ensure you have version 4.0 or higher installed.

Step 3: Install MotionEye

  1. Install Dependencies:
sudo apt install ffmpeg v4l-utils -y
  1. Download and Install MotionEye:
wget https://github.com/Motion-Project/motion/releases/download/release-4.3.2/motion_4.3.2-1_armhf.deb
sudo dpkg -i motion_4.3.2-1_armhf.deb
  1. Install MotionEye:
sudo pip install motioneye
  1. Prepare the Configuration Directory:
sudo mkdir -p /etc/motioneye
sudo cp /usr/local/share/motioneye/extra/motioneye.conf.sample /etc/motioneye/motioneye.conf
  1. Prepare the Media Directory:
sudo mkdir -p /var/lib/motioneye

Step 4: Configure MotionEye

  1. Generate Configuration Files:
sudo motioneye_init
  1. Enable and Start the MotionEye Service:
sudo systemctl enable motioneye
sudo systemctl start motioneye

Step 5: Access the MotionEye Web Interface

  1. Find Your Raspberry Pi’s IP Address:
hostname -I
  1. Open a Web Browser:

Open a web browser on your computer and navigate to http://<your_raspberry_pi_ip>:8765.

  1. Log In:

The default username is admin with no password. After logging in, you can set an admin password for better security.

Step 6: Add and Configure Cameras

  1. Add a Camera:
  • Click on the "Add Camera" button in the MotionEye web interface.
  • Select the camera type (e.g., Local V4L2 Camera for USB webcams or MMAL Camera for Raspberry Pi Camera Module).
  • Configure the camera settings as needed.
  1. Configure Motion Detection:
  • Go to the camera settings and enable motion detection.
  • Adjust the motion detection settings, such as sensitivity and threshold, to suit your needs.
  1. Set Up Storage:
  • Configure the storage settings to save recordings to your desired location, such as a network drive or an external storage device.

Step 7: Optimize and Secure Your Setup

  1. Optimize Performance:
  • Adjust the resolution and frame rate settings in the camera configuration to optimize performance.
  • Disable unnecessary features to reduce CPU load.
  1. Enhance Security:
  • Change the default admin password.
  • Enable HTTPS for secure access to the web interface (you may need to configure a reverse proxy like Nginx for this).

Conclusion

By installing MotionEye on your Raspberry Pi, you can create a flexible and powerful video surveillance system. Whether you're using it for home security, monitoring a pet, or keeping an eye on your property, MotionEye provides a robust solution with a user-friendly web interface. Follow these steps to get your MotionEye setup running and enjoy the peace of mind that comes with a reliable surveillance system.