Raspberry Pi Camera Surveillance

My goal was to use the raspi as a surveillance camera. It should send me pics if movement is detected. Here my tips and tricks…

(remember : this is just my logbook, not a tutorial with all details…)

The difficult way — Motion

Using Raspberry Pi Imager to burn the sd card. First surprise:

CTRL+SHIFT+X gives you an advanced menu and you can configure you ssh and wlan before even burning. Sweet!

Install motion software.

sudo apt-get install motion

sudo motion start

cd /etc/motion/

sudo nano motion.conf

stream_localhost – set it to off

Install sendmail

$ sudo apt-get remove postfix
$ sudo apt-get purge postfix

$ sudo su

apt-get install sendmail sendmail-bin mailutils

Later I found (long search) I had to install this, too

# sudo apt-get install libsasl2-modules

#  mkdir -m 700 /etc/mail/authinfo

create a file named gmail-smtp-raspi (or else) and input your gmail account here

#  nano /etc/mail/authinfo/gmail-smtp-raspi
Fill in : 
AuthInfo: "U:root" "I:USER@gmail.com" "P:GMAIL_USER_PASSWORD"

We have to create a database map from gmail-smtp-raspi (or else) file using makemap utility as below command.

# makemap hash /etc/mail/authinfo/gmail-smtp-raspi < /etc/mail/authinfo/gmail-smtp-raspi 

# nano /etc/mail/sendmail.mc

Next, Copy and Paste below lines in /etc/mail/sendmail.mc file above MAILER_DEFINITIONS as shown below,

dnl #
dnl # Defining Gmail Smarthost for sendmail
define(`RELAY_MAILER_ARGS', `TCP $h 587')dnl
define(`ESMTP_MAILER_ARGS', `TCP $h 587')dnl
define(`confAUTH_OPTIONS', `A p')dnl
FEATURE(`authinfo',`hash -o /etc/mail/authinfo/gmail-smtp-raspi.db')dnl

dnl #
dnl # Default Mailer setup

# make -C /etc/mail

# /etc/init.d/sendmail reload

Test it:

# echo „test mail for sendmail gmail relay“ | mail -s „Sendmail Test“ fosstechnix@gmail.com

You may have to switch the settings in your google account to allow unsecure apps.

The easy way — Motioneye

Download the latest MotionEyeOS software release

Install the image on the sd card

Now we install the wlan access

sudo nano /media/<user>/rootfs/etc/wpa_supplicant/wpa_supplicant.conf

and put this in the above created file:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
    ssid="<network id>"
    psk="<network key>"

Now ssh enable if you want:

cd /media/<user>/boot/

touch ssh

Strg C

Now the sd card in the raspi,

OK, get the raspi IP with a ip scanner,

than login with your browser to this IP.

    Username: admin
    Password: [No password, leave blank]

You can configure pretty much everything in your web user interface. We recommend taking a look at the following configurations when configuring the MotionEyeOS for the first time.

    Go to the three bars menu, and open the General Settings;
    Enable Advanced Settings;
    You can set the admin username and set a password;
    You can also set a name for a surveillance user, and its password;
    Set your timezone and a hostname.

Click the orange button at the top right “Apply”  – this will require a reboot.

Ready to go