Basic Software Environment

Share for us
Share on facebook
Share on twitter
Share on pinterest
Share on whatsapp

Operation on PC

Prepare the PC for remote

Install python-tk for a remote interface

sudo install apt-get install python-tk

For Windows users:

Go to the Python website www.python.org, find the latest Python 2 and install. After installation, DO restart the computer.

Operation on Raspberry Pi

Install python-dev, python-smbus

Install python-dev and python-smbus:

sudo apt-get update

sudo apt-get upgrade

sudo apt-get install python-dev

sudo apt-get install python-smbus

Setup I2C port

Run the command to open Raspberry Pi Software Configuration Tool (raspi-config)

sudo raspi-config

Enable I2C:

Select Advanced Options => I2C => <Yes> => <Ok> => <Yes>

Select <Finish>. Close the window.

If a message of rebooting appears, click <No>. Before reboot, we still need to complete some configurations.

MJPG-streamer

Introduction

The acquisition and transmission of video data by the SunFounder Smart Video Car is fulfilled based on MJPG-streamer.

MJPG-streamer is a command line application that copies JPG-frame from a single input plugin to multiple output plugins. It can be used to stream JPEG files over an IP-based network from the webcam to a viewer like Firefox, Cambozola and Videolanclient or even to a Windows mobile device running the TCPMP-Player.

It was written for embedded devices with very limited resources in terms of RAM and CPU. Its origin, the “uvc_streamer” was written, because Linux-UVC compatible cameras directly produce JPEG-data, allowing fast and performant M-JPEG streams even from an embedded device running OpenWRT. The input module “input_uvc.so” captures such JPG frames from a connected webcam.

Installation

Plug the USB camera into Raspberry Pi, and run the command lsusb. The GEMBIRD represents the USB camera; since it is printed on the screen, it indicates the system has recognized the camera.

lsusb

You’ll see:

pi@raspberrypi:~ $ lsusb

Bus 001 Device 004: ID 1908:2310 GEMBIRD

Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter

Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Check whether the driver for the camera works normally:

ls /dev/vid*

You’ll see:

pi@raspberrypi:~ $ ls /dev/vid*

/dev/video0

If /dev/video0 is printed, the driver is in the normal state.

Then, install the following software needed:

sudo aptget install subversion

sudo aptget install libv4ldev

sudo aptget install libjpeg8dev

sudo aptget install imagemagick

Compile the source code of MJPG-streamer:

cd /home/pi/Sunfounder_Smart_Video_Car_Kit_for_RaspberryPi/mjpgstreamer/mjpgstreamer

sudo make USE_LIBV4L2=true clean all

Install:

sudo make DESTDIR=/usr install

Testing

Type in sudo sh start.sh and press Enter.

Type in the following address (replace 192.168.0.126 with your Raspberry Pi IP address) at the address bar of your browser (Firefox is recommended):

http://192.168.0.126:8080/stream.html

Press Enter and you will see the view captured by the camera displayed on the screen in a real-time manner.