• Process from start to finish.

    Benjamin Blundell02/20/2020 at 17:09 0 comments

    I've had a few of these tp-link TL-WR703N, little blue boxes laying around for some time now. I used quite a few in a previous gig sometime ago where they proved quite useful. Since then, I've not had a lot of use for them. They languished for some time in the future projects box, until now!

    Little blue tp-link router.
    The little blue box of joy, used in so many projects.

    As part of a bigger project, I need some remote cameras. From my 3D Scanning dome project I also had a bunch of Logitech c910 cameras and so I wondered, would it be possible to create a remote webcam using the tp-link and the c910s? Something I could just plug into the mains and it would work, over wifi, with no further user intervention? Turns out it is indeed possible though it requires a small amount of faff.

    Some might think this is a silly project, but I've a few good reasons for giving this a go, which I'll talk about at the end. I'm glad I started and finished this project and I hope that it might be useful for some folks.

    Building the right OpenWRT

    I use OpenWRT on most of my projects. At one point this project branched off into something called LEDE but is now back to OpenWRT again. One of the older versions still support the TL-WR703N so I figured this was the place to start. OpenWRT has a lot of cool features, software and documentation through it's wiki. It's an excellent resource for these wanting to mess with their network hardware, and their page on the WR703N is excellent.

    The biggest problem is the amount of memory these things contain. They have 4MB of flash memory and 32M of RAM, so not an awful lot! This means that we need to cut down on some of the packages included in OpenWRT by default. With some space freed up, we can install the bits we need for the webcam, perform setup over SSH and we shoud be done.

    Version 17.01.07 is the version of OpenWRT you can use with this box. You can download it from http://downloads.openwrt.org/releases/17.01.7/targets/ar71xx/generic/lede-imagebuilder-17.01.7-ar71xx-generic.Linux-x86_64.tar.xz. Once you've decompressed the archive, I ran the following command:

    make -j4 image PROFILE=tl-wr703n-v1 PACKAGES=\
    "-libiwinfo-lua -liblua -libubus-lua -libuci-lua -lua \
    -luci -luci-app-firewall -luci-base -luci-lib-ip \
    -luci-lib-nixio -luci-mod-admin-full -luci-proto-ipv6 \
    -luci-proto-ppp -luci-theme-bootstrap -uhttpd -uhttpd-mod-ubus \
    kmod-fs-ext4 kmod-usb-storage kmod-scsi-core block-mount \
    kmod-lib-crc32c kmod-crypto-crc32c kmod-video-uvc mjpg-streamer motion"
    

    It's worth breaking this down a little. I'm removing all the web-based configuration packages - called Luci - along with the lua scripting language and andy themes, plus support for ipv6 (as I doubt I can make use of that yet). This should free up a bit of space.

    The packages I need for the webcam include kmod-video-uvc, motion and mjpg-streamer. Motion probably isn't essentially but I've used it before and I can be fun!

    We should check the size of the resulting image. We can do that with the following command:

    du -b bin/targets/ar71xx/generic/lede-17.01.7-ar71xx-generic-tl-wr703n-v1-squashfs-factory.bin
    

    The next bit depends on what is already installed on your little tp-link. I had a previous version of OpenWRT installed so I used scp to copy the image to the /tmp directory on the router. It's important it goes into /tmp as the following command relies on that. If you have another operating system on this router, you can follow whatever image upgrade steps that OS suggests.

    The command I used was:

    sysupgrade -v /tmp/lede-17.01.7-ar71xx-generic-tl-wr703n-v1-squashfs-factory.bin
    

    The process so far could be adapted to whatever circumstance you are using the router in. There are quite a few software packages one can install in the base image. In fact, I believe one can customise the kernel and do all sorts of things if one desired. For our purposes though, this should be enough.

    Setting up the networking

    The next process is to ssh into our router...

    Read more »