Buchempfehlung:
Roboter-Autos mit dem Raspberry Pi

Roboter Autos mit dem Raspberry Pi

Chapter 8 – live video streaming from inside the car:

In my eighth chapter I will explain the video streaming from the inside of the Raspberry Pi car to my computer. I will explain the basics how to stream a Video with the little RaPi. To get a picture we have to connect a camera. I decided to use the Raspberry Pi NoIR camera module and bought it. It should be also possible to use USB webcams you already have at home. Maybe I will explain the usage of a normal USB webcam in an additional chapter but in this chapter I will only explain how to use the Raspberry Pi camera module.

I must also say that the Raspberry Pi has not much power and the video transmitting / streaming is very challenging for the small CPU of the Raspberry Pi to keep the lag time at a minimum.

Update 26.07.2014: Just stream HowTo

I recommend to use the following HowTo paper for the video streaming with the Raspberry Pi. With this HowTo the lag time is at a minimum and the controlling of the car with the live stream works very good. Unfortunately the HowTo paper is only available in German.

HowTo paper: Einfach nur Streamen

Update 26.07.2015: mjpg-streamer patch

With the latest kernel the mjpg-streamer is no longer running as described in the article “Just stream  HowTo”.  You need to install a patch before you install the mjpg-streamer on your Raspberry Pi. The patch and all the files are available in the following zip file.

Download: mjpg-streamer-patch

Raspberry PI - remote controlled car with a Raspberry Pi camera NoIR

Raspberry PI – remote controlled car with a Raspberry Pi camera NoIR

Raspberry Pi NoIR Camera – connect

First you have to think about how to attach the camera module on the RaPi car. The problem is the ribbon cable is very short.

Attention:

Please ensure to use the right CSI-Interface (Camera Serial Interface) connector to attach the camera module with the Raspberry Pi. You have to use the one next to the RJ45 connector. For the first time I used the wrong connector and was wondering why the camera module does not work.

This video shows how you have to attach the Raspberry Pi camera modul.

Raspberry Pi NoIR Camera – setup / configuration

If the camera is attached to the Raspberry Pi it has to be enabled via the command line and setup window. Start the setup screen with the following command:

>Sudo raspi-config

Select the menu item “Enable Camera” and after enabling the camera you have to restart the Raspberry Pi.

Raspberry PI - remote controlled car with a Raspberry Pi camera activation

Raspberry PI – remote controlled car with a Raspberry Pi camera activation

Attention

If the menu item “Enable Camera” is not available you have to update your Raspberry Pi to the latest version. For this just execute the next two commands:

>Sudo apt-get update

>Sudo apt-get upgrade

After enabling the camera module and the restart of the Raspberry Pi the camera should work now. In the following sections I explain the basics how to take pictures and record movies with the Raspberry Pi camera module.

Live Stream – configuration

The next steps explains how to install a software component to enable live video streaming in your home network. Many different solutions are possible but I will explain the easiest way I found to guarantee a fast success. But I know it is not the best way to stream a video… First we have to install ananother software package on the Raspberry Pi the VLC player. Please login and use the following command to install the player:

>Sudo apt-get install vlc

After you have executed the command it is time for a coffee break. It will take a while to install the vlc module. During this process you should also install the VLC Player on our Window PC it not already installed.

Download VideoLanPlayer: Download

 

[sam_zone id=”18″ codes=”true”]

Live Stream – start

Different ways are possible to start the live video stream on the Raspberry Pi. An overview of the possibilities like time-lapse photography, to take pictures… is available here:

To start the live video stream form the inside of the RaPi car the following command has to be executed:

raspivid -o - w 640 -h 480 -b 200000 -t 9999999 |cvlc -vvv stream:///dev/stdin --sout '#standard{access=http,mux=ts,dst=:8554}' :demux=h264

On the client side / Windows PC you have to open the stream with the following URL:

URL für den Client: http:<IP Raspberry PI Auto>:8554

This is a screenshot of my desktop with a putty window to control the car, a putty window where I executed the video streaming command and a VideoLanPlayer window with the live stream of my car in front of a mirror.

Raspberry PI - remote controlled car with a Raspberry Pi camera live stream

Raspberry PI – remote controlled car with a Raspberry Pi camera live stream

Tip:

I you use the command >rapivid you will get a list of all options available in rapivid.

Conclusion:

For me the live streaming works but with a lag time of round about 3 seconds. I have to find a solution how I can minimize the lag time. The cause for this big 3 seconds lag is not only the Raspberry Pi hardware. The WIFI connection and the cache settings are also responsible for the 3 seconds. To control the car with this big time offset is very difficult and annoying.

Contents:


Chapter 1: Raspberry Pi WIFI radio controlled rc vehicle – introduction
Chapter 2: Raspberry Pi WIFI radio controlled rc vehicle – component list
Chapter 3: Raspberry Pi WIFI radio controlled rc vehicle – chassis
Chapter 4: Raspberry Pi WIFI radio controlled rc vehicle – wiring
Chapter 5: Raspberry Pi WIFI radio controlled rc vehicle – software installation
Chapter 6: Raspberry Pi WIFI radio controlled rc vehicle – power supply
Chapter 7: Raspberry Pi WIFI radio controlled rc vehicle – programing
Chapter 8: Raspberry Pi WIFI radio controlled rc vehicle – live video streaming
Chapter 9: Raspberry Pi WIFI radio controlled rc vehicle – web-interface and smartphone
Chapter 10: Raspberry Pi WIFI radio controlled rc vehicle – cooling with passive heat sinks
Chapter 11: Raspberry Pi WIFI radio controlled rc vehicle – startup scripts
Chapter 12: Raspberry Pi WIFI radio controlled rc vehicle – cardboard car model
Chapter 13: Raspberry Pi WIFI radio controlled rc vehicle – power consumption
(Visited 1,053 times, 1 visits today)