Sunday, June 07, 2020

Raspberry Pi Zero setup for Motion Eye



First off, I'd like to say thanks to  Calin Crisan for his work on Motion eye. He's posted a few how to's on his Github page. This page is a modified version of his page. I've found the following method to work a bit more smoothly for me. Your Millage May vary. Before you go further, this post assumes that you know about installing Raspbian on your SD card, and have access to your Pi Zero via SSH.

I'm installing Motion eye on a Raspberry Pi Zero W.

In this example Raspbian Buster Lite is already installed on it.  I used 2020-02-13-raspbian-buster-lite.zip for my install. It also needs to be setup headlessly to use SSH.  I wrote a little post about that here. 


 Before Proceeding

    Read Calin Crisan's general Installation page first.

These instructions are intended for an up-to-date Raspbian Buster install, but they should work for Raspbian Stretch as well.

    All commands require root; use sudo before each command or become root using sudo -i.
    If you want to use the CSI camera module for the Raspberry PI, make sure you have enabled it in raspi-config.  Also don't forget to run Apt Update and Apt Upgrade if doing this on a fresh install of buster.



Instructions

Install ffmpeg and other motion dependencies:

apt install ffmpeg libmariadb3 libpq5 libmicrohttpd12

I still needed to run apt update --fix-missing to get all the packages to install when I used this method. Lately, I have not had to. 

Install the dependencies from the repositories including "python-pil instead" of python-pillow, and selecting 'zlib1g-dev' instead of 'libz-dev'. 

apt install python-pip python-dev libssl-dev libcurl4-openssl-dev libjpeg-dev zlib1g-dev python-pil


Once all of the packages for ffmpeg and motion dependencies are install, proceed to install Motion.

 Install  motion:


wget https://github.com/Motion-Project/motion/releases/download/release-4.2.2/pi_buster_motion_4.2.2-1_armhf.deb
dpkg -i pi_buster_motion_4.2.2-1_armhf.deb
Install motioneye, which will automatically pull Python dependencies (tornado, jinja2, pillow and pycurl):
pip install motioneye
Prepare the configuration directory:
mkdir -p /etc/motioneye
cp /usr/local/share/motioneye/extra/motioneye.conf.sample /etc/motioneye/motioneye.conf

Prepare the media directory:
mkdir -p /var/lib/motioneye

Add an init script, configure it to run at startup and start the motionEye server:
cp /usr/local/share/motioneye/extra/motioneye.systemd-unit-local /etc/systemd/system/motioneye.service
systemctl daemon-reload
systemctl enable motioneye
systemctl start motioneye

To upgrade to the newest version of motionEye, just issue:
pip install motioneye --upgrade
systemctl restart motioneye



These instructions were modified from the original found here:

https://github.com/ccrisan/motioneye/wiki/Install-On-Raspbian

https://github.com/ccrisan/motioneye/wiki/Installation

Monday, May 25, 2020

Setting up a Raspberry Pi Zero W for Headless Use on Linux





This shouldn't take to long, and it's fairly simple to do. But if you're a novice and don't know about it, it might drive you crazy trying to figure this out.  And that's not the kind of crazy that is good for anyone.

This assumes that you've already figured out how you're going to get your Pi's SD card imaged.  I use BalenaEtcher myself.  There is dd and other methods a person can use.

Once the SD card is imaged you'll need to create an empty file on the Boot Partition called ssh.
Just right click in your file manager to create an empty document called ssh




Now you'll need to right click again to create a document, but you'll want to call it  wpa_supplicant.conf in that file you'll need your wifi network login information. Open that in Pluma or Nano or whatever your default text editor is, and put these lines below in in. Edited of course, with the correct SSID and Password for your Wifi network.  

country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="SenturyLink"
psk="Passw0rds"
}

Save this file, making sure that it's named correctly and in the \boot partition of the SD card. At this point you can eject the SD card from your PC.

Next you're going to SSH into the Pi from the terminal on you Linux machine.

What I found easiest was to log into my router and get the IP address of connected devices.  It might take a little time, so be patient. 



I have also used an Android App called Fing,  and you can also use nmap. But my router info does the trick for me. Once you have figured out what the IP address is for your Raspberry Pi Zero W, you need to open up a terminal to SSH into it.The Default username is pi and default password is raspberry

yourname@linuxpc:~$ ssh pi@192.168.1.17
pi@192.168.1.17's password:raspberry

If all has gone well, you've now successfully logged into your Pi Zero over Wifi!
For your initial log in you'll get a security warning. Say Yes to it.

Now would be a good time to run raspi-config  now that you've logged into it to change your default password, and expand the file system if needed.
You'll also want to run
Apt Update and  Apt Upgrade 
to get your machine up to date with it's packages.


That's pretty much it. You should have a Raspberry Pi Zero W that you can SSH into.

I've used this method a few times to get my Pi's setup for use with MotionEye. I've modified the original process with my own blog post on how to get Motion Eye installed and going, the original seemed to have a couple of steps out of order. 

I'd like to say that I took most of my information for this blog post from Mitch Allen's post about how to do this via Windows.



Raspberry Pi Zero setup for Motion Eye

First off, I'd like to say thanks to  Calin Crisan for his work on Motion eye. He's posted a few how to's on his Github page...