[Who’s Stealing My Cheese?] Raspberry Pi Video Monitor Setup

[Who’s Stealing My Cheese?] Raspberry Pi Video Monitor Setup

Introduction

Video monitors have a lot of usage in IoT. You can use simply as a remote security camera or add digital image processing to perform activities when something happens.

In this tutorial we will use Raspberry Pi and its camera module to stream video live (with a few seconds delay due to hardware limitation). This setup serves the first step for digital image processing IoT projects.

2016-09-09 11.56.28

About Raspberry Pi

Raspberry Pi (RPi) is one of the most widely used microcontroller besides Arduino. Unlike Arduino which is optimized for controlling hardware, Raspberry Pi is essentially a “tiny computer” that is capable for doing what a normal PC can do.

Compared to arduino, raspberry pi has much stronger computing power. For example RPi 2 has quad-core CPU that runs at 900MHz and a 1GB RAM, an Arduino UNO has only 16MHz and tiny 2KB RAM.

One immediate advantage of raspberry pi over arduino is digital image processing. A typical 640×480 JPEG image file size can easily be over 7KB. This is too large to store in an arduino UNO. As a result, you will often see raspberry pi used for home video projects.

Prerequisite

  • You have installed linux operating system (Raspbian) on RPi. (I’ll create a tutorial for this in the future).
  • You know how to use command line in linux.

Equipment

  • Raspberry Pi 2 or 3 plus protection case.
  • Official RPi camera and case.
  • An android tablet for viewing.

Process

Connect Devices

Follow this tutorial‘s image to connect camera’s wiring to raspberry pi:

  1. Pull UP the two handles at the socket’s side
  2. Put the band wire in. Make sure every part of the band wire touches the socket’s end.
  3. Push down the two handles. Double check that the band wire is evenly tuck into the socket.

Streaming Setup for RPi

Connect to RPi (by HDMI or via VNC). Do the standard linux update. Install vlc by:

sudo apt-get install vlc

Start streaming by the following command:

raspivid -o - -t 0 -hf -w 640 -h 360 -fps 25|cvlc -vvv stream:///dev/stdin --sout '#standard{access=http,mux=ts,dst=:8090}' :demux=h264

Explanation:

  • -t 0 : means to stream indefinitely. For other integer N it means to stream video of N milliseconds. If you set the device to stream indefinitely you can stop it by pressing the good old ctrl -c .
  • -w 640 -h 360 : width and height of the video.
  • dst=:8090 : streams the video via port 8090.

This will make the video stream available from RPi’s ip address and from port 8090. When executed you will see the following messages in the command line:

2016-09-09 11.59.17

Streaming Setup for Android Tablet

Go to Play Store and install vlc. Open vlc and click “Stream”:

Screenshot_2016-09-09-14-45-13-1

Once opened, enter your ip address plus 8090 port. You can find your ip address in RPi via command hostname -I 

Screenshot_2016-09-09-14-51-06-1

2016-09-09 11.58.34