LinkIt smart 7688 provides USB host capability that enables it to connect to various USB devices such as webcams, USB drives, keyboards, joysticks and more. This time, we will describe how to stream a web camera which is connected to the USB host.
01 Connection
Things you need:
Linkit smart 7688 *1
Breakout for LinkIt smart 7688(or a USB OTG cable) *1
USB web camera(support MJPEG) *1
USB Cable *1
The USB host connector on7688 is a USB micro-AB type. And Breakout for LinkIt smart 7688 expands it into USB type-A port. It means you can connect the web camera to a USB port directly if you have a breakout, while a USB OTG cable is needed if you don’t.
02 How to use a web camera
After the connection, power the LinkIt smart 7688, login and check if the web camera is detected or not:
ls /dev  Video0 should be in the list as the following picture. If you can’t see any “video” in the list, please check the connection.
After that, we can use MJPG_streamer to stream the video via HTTP. MJPG-streamer takes JPGs from Linux-UVC compatible webcams, filesystem or other input plugins and streams them as M-JPEG via HTTP to webbrowsers, VLC and other software. It’s pre-installed in LinkIt smart 7688, type the following command for more details :
mjpg_streamer -h
If your 7688 doesn’t contains MJPG-streamer, install it with opkg command:
opkg install mjpg-streamer
Now let’s start our web camera project! The following command is the stream setting:
mjpg_streamer -i "input_uvc.so -d /dev/video0 -r 640x480 -f 30" -o "output_http.so -p 8080 -w /www/webcam" You can see the video on the website now. Visit 192.168.x.x:8080(x means your 7688 IP address) in your browser.
03 Improvement
If you want to set up the web camera automatically when LinkIt smart 7688 starts, edit the configuration file as follow:
vim /etc/config/mjpg-streamerconfig mjpg-streamer 'core'
        option enabled '1'
        option input 'uvc'
        option output 'http'
        option device '/dev/video0'
        option resolution '640x480'
        option yuv '0'
        option quality '80'
        option fps '30'
        option led 'auto'
        option www '/www/webcam'
        option port '8080'
        option username 'openwrt'
        option password 'openwrt' 



Comments