Breathe new life into your old home router
USB Drives
To add USB drives, remotely SSH into the router and enter the code from Listing 1. After the USB packages are loaded, reboot the router.
Listing 1
Adding USB Drives Remotely
## update okpg is required to get info on new packages opkg update ## get packages for USB2/3 and ext4 type devices opkg install block-mount e2fsprogs kmod-fs-ext4 kmod-usb-storage kmod-usb2 kmod-usb3
Under the System menu, you will now see the Mount Points item has been added to the LuCI web interface. This option allows for easy addition and removal of portable USB drives (Figure 4).
Adding USB drives to a router opens up the possibility of a number of interesting projects, such as a SAMBA file/printer server, an FTP server, or a Network File System (NFS).
USB Webcam Project
For a fun router project, you can connect a USB webcam and start a video-streaming service. A number of excellent USB video solutions are available, but you need to ensure that the router's small memory size can accommodate the video package and all its dependencies. A good lightweight USB video option is mjpg-streamer
, which can be installed with the code in Listing 2.
Listing 2
Installing mjpg-streamer
## install video streaming software and nano editor opkg install kmod-video-uvc mjpg-streamer nano ## enable video service ## edit config file, and set "option enable '1' nano /etc/config/mjpg-streamer
Once you've installed mjpg-streamer
, you need to start the video service:
## to start the service: /etc/init.d/mjpg-streamer start ## to enable the service to start on boot /etc/init.d/mjpg-streamer enable
You can access the USB webcam as a web page from the router's IP with the default port of 8080 (Figure 5).
USB-Serial Connections
A router doesn't have external General Purpose Input/Output (GPIO) pins like a Raspberry Pi or an Arduino, but USB ports can be used to pass data.
Because there aren't a lot of USB sensors available, a good workaround to this problem is to use an older microcontroller. Low-end modules such as the Arduino Nano, littleBits Arduino Bit, or a BBC micro:bit can be directly connected to sensors, and the data can be passed with the USB-to-Serial interface.
To start the video service, you need to enable USB-to-Serial communications in OpenWRT:
## add USB-Serial packages opkg install kmod-usb-serial kmod-usb-acm ## add terminal config package opkg install coreutils-stty
For our project, we used a BBC micro:bit [4], which is very user-friendly for coding: It only took five blocks to send the on-board temperature reading and to show the value on the front panel (Figure 6).
The OpenWRT firmware runs a light version of the Bash shell called Ash. The Ash script in Listing 3 connects to the micro:bit USB port and prints out the temperature data.
Listing 3
Reading USB-Serial Data
#!/bin/ash # # microbit.sh - reads microbit temperature # # set terminal speed stty -F /dev/ttyACM0 115200 # read USB-Serial device (/dev/ttyACM0) while read -r line < /dev/ttyACM0; do echo " Temp: $line DegC" done
« Previous 1 2 3 4 Next »
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
![Learn More](https://www.linux-magazine.com/var/linux_magazin/storage/images/media/linux-magazine-eng-us/images/misc/learn-more/834592-1-eng-US/Learn-More_medium.png)
News
-
NVIDIA Released Driver for Upcoming NVIDIA 560 GPU for Linux
Not only has NVIDIA released the driver for its upcoming CPU series, it's the first release that defaults to using open-source GPU kernel modules.
-
OpenMandriva Lx 24.07 Released
If you’re into rolling release Linux distributions, OpenMandriva ROME has a new snapshot with a new kernel.
-
Kernel 6.10 Available for General Usage
Linus Torvalds has released the 6.10 kernel and it includes significant performance increases for Intel Core hybrid systems and more.
-
TUXEDO Computers Releases InfinityBook Pro 14 Gen9 Laptop
Sporting either AMD or Intel CPUs, the TUXEDO InfinityBook Pro 14 is an extremely compact, lightweight, sturdy powerhouse.
-
Google Extends Support for Linux Kernels Used for Android
Because the LTS Linux kernel releases are so important to Android, Google has decided to extend the support period beyond that offered by the kernel development team.
-
Linux Mint 22 Stable Delayed
If you're anxious about getting your hands on the stable release of Linux Mint 22, it looks as if you're going to have to wait a bit longer.
-
Nitrux 3.5.1 Available for Install
The latest version of the immutable, systemd-free distribution includes an updated kernel and NVIDIA driver.
-
Debian 12.6 Released with Plenty of Bug Fixes and Updates
The sixth update to Debian "Bookworm" is all about security mitigations and making adjustments for some "serious problems."
-
Canonical Offers 12-Year LTS for Open Source Docker Images
Canonical is expanding its LTS offering to reach beyond the DEB packages with a new distro-less Docker image.
-
Plasma Desktop 6.1 Released with Several Enhancements
If you're a fan of Plasma Desktop, you should be excited about this new point release.