Sunday, 07 July 2013 15:40


This project uses an inexpensive TP-LINK TL-MR3020 Portable 3G/4G Wireless N Router with an Linux UVC supported camera to create an IP Camera that can be placed in a good location for surveillance.



Installing pacakges for OpenWRT

  • Make sure you have Internet connection
  • SSH to the router
  • Install the following packages

opkg update
opkg install kmod-video-uvc
opkg install mjpg-streamer
It should look like this

[email protected]:~# opkg update
Updated list of available packages in /var/opkg-lists/attitude_adjustment.
[email protected]:~# opkg install kmod-video-uvc
Installing kmod-video-uvc (3.3.8-1) to root...
Installing kmod-video-videobuf2 (3.3.8-1) to root...
Installing kmod-video-core (3.3.8-1) to root...
Installing kmod-i2c-core (3.3.8-1) to root...
Installing kmod-input-core (3.3.8-1) to root...
Configuring kmod-i2c-core.
Configuring kmod-video-core.
Configuring kmod-input-core.
Configuring kmod-video-videobuf2.
Configuring kmod-video-uvc.
[email protected]:~# opkg install mjpg-streamer
Installing mjpg-streamer (r148-4) to root...
Installing libpthread ( to root...
Installing libjpeg (6b-1) to root...
Configuring libjpeg.
Configuring libpthread.
Configuring mjpg-streamer.
[email protected]:~#

Check if drivers has been installed

[email protected]:~# dmesg | grep -i usb
[ 8.490000] usbcore: registered new interface driver usbfs
[ 8.490000] usbcore: registered new interface driver hub
[ 8.500000] usbcore: registered new device driver usb
[ 9.670000] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 9.680000] ehci-platform ehci-platform: new USB bus registered, assigned bus number 1
[ 9.740000] ehci-platform ehci-platform: USB 2.0 started, EHCI 1.00
[ 9.740000] hub 1-0:1.0: USB hub found
[ 10.000000] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 10.070000] usb 1-1: new high-speed USB device number 2 using ehci-platform
[ 10.230000] hub 1-1:1.0: USB hub found
[ 10.510000] usb 1-1.4: new full-speed USB device number 3 using ehci-platform
[ 348.190000] usbcore: registered new interface driver uvcvideo
[ 348.190000] USB Video Class driver (1.1.1)
[ 517.550000] usb 1-1.2: new high-speed USB device number 4 using ehci-platform
[ 517.690000] input: Microsoft?? LifeCam HD-5000 as /devices/platform/ehci-platform/usb1/1-1/1-1.2/1-1.2:1.0/input/input0
[ 771.450000] usb 1-1.2: USB disconnect, device number 4
[ 774.120000] usb 1-1: USB disconnect, device number 2
[ 774.120000] usb 1-1.4: USB disconnect, device number 3
[ 777.500000] usb 1-1: new high-speed USB device number 5 using ehci-platform
[ 777.680000] input: Microsoft LifeCam HD-5000 as /devices/platform/ehci-platform/usb1/1-1/1-1:1.0/input/input1
[email protected]:~#


Enable video streaming

Video streaming is diabled by default. To enable video streaming, edit /etc/config/mjpg-streamer and change option enabled "0" to option enabled "1" 
Note: Microsoft LifeCam HD-5000 support resolution up to 1280x720,  I'm using option resolution "1280x720" for my case. 

config mjpg-streamer core
         option enabled "1"
         option device "/dev/video0"
         option resolution "640x480"
         option fps "5"
         option www "/www/webcam"
         option port "8080"

Restart the router, you are ready to stream the video.
  • start on boot
    /etc/init.d/mjpg-streamer enable
  • start mjpg-streamer right now
    /etc/init.d/mjpg-streamer start
  • Stop mjgp-streamer
    /etc/init.d/mjpg-streamer stop

Nanavigate to, you should see the following screen

About M-JPEG streamer
More command to stream the video

Show Date and Time on top of video

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

   setInterval(function(){showDateTime()},500); //run showDateTime function every 500ms
   function showDateTime() {
      document.getElementById("dateNow").innerHTML = new Date().toDateString();
      document.getElementById("timeNow").innerHTML = new Date().toLocaleTimeString();

<style type="text/css">
   position: fixed;
   top: 10px;
   left: 10px;

<!-- show video from camera, please use your own router IP & port -->
<div class="img">
   <a target="_parent"><img src=""></a>
<div class="dateTime">
   <div id="dateNow">Show the date</div>
   <div id="timeNow">Show the time</div>

Manage dynamic controls in uvcvideo

  • Listing available controls for device video
    opkg install uvcdynctrl
    uvcdynctrl -c
  • Disable auto focus
    uvcdynctrl --set='Focus, Auto' 0
  • Enable auto focus 
    uvcdynctrl --set='Focus, Auto'
Read here for more about TL-WR1043ND+OpenWRT+Webcam 
Read 42672 times Last modified on Sunday, 12 June 2016 10:43


Leave a comment