Raspberry Pi Setup
This page describes an example of setting up Raspberry Pi for streaming videos from FingerVision cameras over Ethernet network by using MJPG Streamer.
Overview †
- Local computer: Raspberry Pi 3B or 3B+.
- OS: Raspbian.
- Install: MJPG Streamer.
- Install: Utility scripts.
Preparation of Raspberry Pi †
- Purchase a Raspberry Pi 3B or 3B+ and peripheral (micro SD, power supply, etc.).
- There is a Raspberry Pi 3 (B/B+), Pi 2 B, and Pi 1 B+ case on Thingiverse.
OS Installation †
We install Raspbian.
- Download Raspbian: https://www.raspberrypi.org/downloads/raspbian/
- The version we tested is:
- Version:June 2018
- Release date:2018-06-27
- Kernel version:4.14
Here we assume the micro SD location as /dev/mmcblk0. Example commands (from Ubuntu 16.04) to install the ISO image onto the SD:
$ unzip 2018-06-27-raspbian-stretch.zip $ umount /dev/mmcblk0p1 $ umount /dev/mmcblk0p2 $ sudo ddrescue -D -d --force 2018-06-27-raspbian-stretch.img /dev/mmcblk0
Booting Raspberry Pi and Configuration †
Connect a keyboard, a mouse, a display, and a network with Raspberry Pi. Insert the micro SD where the OS is installed.
Boot it by supplying power.
- Note
- Resizing file system is automatically done at the initial boot.
After booting the Raspberry Pi, configure it from Preferences->Raspberry Pi Configuration:
- Hostname: aypi## (as you like)
- Auto login: Disable
- SSH: Enable
Then reboot.
Now you can work remotely via SSH.
Since some FingerVision-related scripts assume that the user on Raspberry Pi is ayg, we create a new user.
$ sudo adduser ayg $ sudo usermod -g ayg -G ayg,adm,dialout,cdrom,sudo,audio,video,plugdev,games,users,input,netdev,gpio,i2c,spi ayg $ su ayg
The second command configures the groups of the user ayg, which is similar to the default user pi. Make sure that dialout,adm,sudo are included.
Configure the network as you wish.
Spoofing (changing) MAC address of Raspberry Pi is sometimes useful.
$ sudo nano /boot/cmdline.txt (add the following like at the end of the line with adding a space) smsc95xx.macaddr=xx:xx:xx:xx:xx:xx
Software Installation †
We install MJPG Streamer and utility programs.
On Raspberry Pi,
$ sudo apt-get install git cmake libjpeg8-dev uvcdynctrl v4l-utils $ sudo apt-get install htop dstat $ mkdir ~/prg && cd ~/prg/ $ git clone https://github.com/akihikoy/mjpg-streamer.git mjpg-streamer2 $ cd mjpg-streamer2/mjpg-streamer-experimental $ make
Utility Scripts †
The following commands install utility scripts on Rasbperry Pi. cf. MJPG Streamer#RasPi
On Raspberry Pi,
$ cd $ wget https://raw.githubusercontent.com/akihikoy/fingervision/master/tools/mjpg_stream.sh $ wget https://raw.githubusercontent.com/akihikoy/fingervision/master/tools/stream.sh $ wget https://raw.githubusercontent.com/akihikoy/fingervision/master/tools/stream1.sh $ wget https://raw.githubusercontent.com/akihikoy/fingervision/master/tools/stream4.sh $ wget https://raw.githubusercontent.com/akihikoy/fingervision/master/tools/conf_cam.sh $ wget https://raw.githubusercontent.com/akihikoy/fingervision/master/tools/conf_elp.sh $ chmod 755 stream*.sh conf_*.sh
Performance †
We could stream video from two USB cameras at more than 60 FPS in 320x240.