Converting the Raspberry Pi to a wireless print server

Lead Image © Javier Brosch, 123RF.com

Under Control

Use a small and unobtrusive Raspberry Pi to convert your legacy USB printer to a new wireless network printer system.

A chunky, multifunction printer with a USB connection is no feast for the eyes, especially when it is sitting next to your up-market laptop or tablet. On the other hand, a network printer can disappear unobtrusively into a corner of the room and serve multiple users on the LAN. The convenience, flexibility, and invisibility of network printers is one reason why they have replaced their USB counterparts in many offices.

However, that's still no reason to drag your old USB printer down to the nearest recycling center. The Raspberry Pi can connect the USB world with the Internet, providing a print server service for your old USB clunker thanks to CUPS. With a wireless adapter plugged into your Rasp Pi, the location of your printer depends only on wireless reception and a suitable power supply.

Shopping List

Because USB-only printers are no longer in vogue, you can find used equipment at very reasonable prices. Thus, even if you cannot use your existing USB printer for this experiment, it might still be worthwhile purchasing a used printer for cost reasons. Used printers are up for grabs on eBay for less than US$ 30 (EUR 20).

The shopping list in Table 1 shows the ingredients for a complete package, including a second-hand multifunction Canon Pixma MP160 printer, which you can also use as a scanner. At a total cost of just over US$ 100 (EUR 90), a complete package, including the printer itself, is still slightly cheaper than purchasing a comparable new, WiFi-enabled printer.

Tabelle 1

Shopping List

Component

Source

Approx. Price (US$/EUR)

Canon MP160 multifunction printer

EBay

30/20

Raspberry Pi type B

Amazon

35/41

Rasp Pi case

Amazon

13/7

EDIMAX EW-7811UN wireless USB adapter

Amazon

12/11

Micro USB 5V power supply

Amazon

10/7

SD Card (2GB)

Amazon

10/6

Total

 

US$ 110/EUR 92

If you have individual components from the list in your treasure trove of IT relics – say, a micro USB power adapter from an old smartphone, a suitable SD card, or even a dusty old USB printer – the solution here offers an unbeatably low price.

Configuring the Network

In this article, I assume you are running Raspbian [1] on your Raspberry Pi system, but similar instructions will work for other Rasp Pi distros. See the HowTo Corner at the Raspberry Pi Geek website [2] for information on getting Raspbian installed on your Pi and setting up a wireless adapter.

Once you get the system up and running, it is time to put the Raspberry Pi on your home network. On many home networks, the router/firewall system assigns a network IP address to each device. By default, the Rasp Pi system will request an IP address from the DHCP service running on your home router.

Although it is easy to put the Pi on the network, a dynamic IP address assigned through a DHCP server could change every time the system boots and requests a new address. If you want your new wireless printer to be a permanent part of the network, you might want to assign the Rasp Pi a permanent IP address, so other devices on the network will know where to find it.

In many cases, you can assign your computer a permanent IP address by registering its hardware address with the DHCP server. See the vendor documentation for your home router for instructions on how to log in to the router's management interface.

If you want to assign a fixed IP address to the Rasp Pi, but the router does not have an option for setting an address reservation, you need to modify the /etc/network/interfaces configuration file on the Raspberry Pi system (see the HowTo Corner at the Raspberry Pi Geek website for information on using the Nano text editor).

The fixed IP address must not be an address assigned by the router to other DHCP clients. If the router residing at 192.168.0.1 distributes an address range of 192.168.0.100 to 192.168.0.254 to DHCP clients on the network, edit the /etc/network/interfaces file as shown in Listing 1.

Listing 1

/etc/network/interfaces

#/etc/network/interfaces
auto lo
iface lo inet loopback
iface eth0 inet static
address 192.168.0.64
netmask 255.255.255.0
gateway 192.168.0.1
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

The Rasp Pi system configured in Listing 1 can be reached under the fixed IP address of 192.168.0.64. For the system to resolve common URLs to Internet addresses, you must specify a DNS name server. In some cases, your router might act as a DNS server. In other cases, you might need to ask your Internet provider for the IP address of a DNS server system. To add a name server to the /etc/resolv.conf file, enter:

#/etc/resolv.conf
nameserver 192.168.0.1

For the other basic system settings, you can call sudo raspi-config. For example, when you first installed Raspbian, this is where you should have extended the system partition to the entire SD card, set up your location information, and chosen your keyboard setup. If you didn't do so then, you may do so now. Finally, enter

sudo apt-get update
sudo apt-get upgrade

to update the software on your Rasp Pi system.

Buy this article as PDF

Express-Checkout as PDF

Pages: 4

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content