Wednesday, March 20, 2013

Cheap Wifi/Ethernet enabled DIY Webcam Streaming

This little DIY webcam project is pretty simple, and costs roughly $65 with parts found online.  You may be able to find it cheaper elsewhere (I picked up an MR 3020 for $25 and an HD 3000 for $25) at my local retailer.  Its a pretty quick project that can give you a Wifi enabled (or wired) webcam that can be streamed outside your home, or even checked by Zoneminder or other IP based security camera software.  As a bonus, if you are using the router in a wired mode, it can act as an extra Wifi repeater!

You will need the following:
  • TP-Link MR 3020 Travel Router ($37 @ Amazon)
  • Microsoft HD-3000 Webcam ($27 @ Amazon)
  • Download: OpenWRT firmware for MR 3020
You will get:
  • 800x448 resolution at 7.5fps internet webcam.
Grab a coffee, and lets get to work!



Step 1, install OpenWRT to the MR 3020.  

I use the Attitude Adjustment RC1 download.

Taken from the OpenWRT site itself:
"Connect to the TL-MR3020 router via Ethernet cable at IP address 192.168.0.254, log in to the router's web GUI (default login/password: admin / admin) and overwrite the factory firmware by installing the openwrt-ar71xx-generic-tl-mr3020-v1-squashfs-factory.bin firmware image like a regular firmware update."

Wait for the router to reboot.  Set your computer to an IP address of 192.168.1.10, and login to the web page "http://192.168.1.1".  Set your password, and then head to the "Network" tab.  Click on the "DHCP and DNS" sub-tab, and uncheck "Domain Required" and "Authoritative".  We are disabling the DHCP server here to make sure we have no conflicts when we introduce the router to the network.  Click "Save & Apply" on the bottom right hand corner.
Now click on the "Interfaces" sub-tab.  Depending on your network, either define the IP address of the router, or change the "Protocol" to "DHCP Client".  Click "Save & Apply".
For WiFi, click on the "WiFi" sub-tab, and set it to point to the WiFi you wish to connect the camera to by clicking on "Edit".  Under "Interface Configuration", set the mode to "Client", and fill in your WiFi's SSID in the box labeled "ESSID".  Click on the "Wireless Security" tab just above that to type in your WiFi's security type and password.  Click "Save & Apply".

For wired, plug in your MR 3020 to your main network.  Go ahead and unplug the router from power, plug in the webcam, then reconnect the power to the router.

At this point, your router may get a new IP.  Once you find it, type that IP into your browser.


Step 2, install camera software.

Using PuTTY, or some other SSH interface, login to your router's IP address.  Username is "root", and the password is what you set right after you installed the OpenWRT firmware.

Type in (no quotes) "opkg update".  You will be updating the software database on the router.
Next: "opkg install  kmod-video-uvc mjpg-streamer" (you can add in "v4l-utils" if you want, but its not needed)  The router will go out, grab some packages and install them on its own.  You are done here.

Back in the web browser, login to the router.  Click on the "System" tab, followed by the "Startup" tab.  In the "Local Startup" box at the bottom, paste in (no brackets) [mjpg_streamer -i "input_uvc.so -d /dev/video0 -r 800x448 -f 7.5" -o "output_http.so -p 8080 -w /www/webcam"&] to the line just before "exit 0".  Click "Save & Apply".  You can change the number "8080" to any port you desire, and forward that port to the MR3020's IP if you so desire.

Test the result by visiting: "http://your.router's.ip.addy:8080/?action=stream".  Results?  Finish the coffee!


If you want to use this webcam in Zoneminder, create a new monitor, and set it to "Remote".  Enter in the information from the line in brackets above in the boxes needed, and let it watch your new webcam.