News

Wireless Raspberry Pi print server

Breathe new life into an old printer by using your Raspberry Pi as a wireless print server

The basic components

Wireless printing has made it possible to print to devices stored in cupboards, sheds and remote rooms. It has generally shaken up the whole process of printing and enabled output from smartphones, tablets, laptops and desktop computers alike. But you don’t have to own a shiny new printer for this to work; old printers without native wireless support don’t have to end up in the bin, thanks to the Raspberry Pi.

The setup is simple. With your Raspberry Pi set up with a wireless USB dongle, you connect your printer to a spare USB port on the computer. With Samba and CUPS (Common Unix Printing System) installed on the Raspberry Pi, all that is left to do is connect to the wireless printer from your desktop computer, install the appropriate driver and start printing.

CUPS gives the Raspberry Pi a browser-based admin screen that can be viewed from any device on your network, enabling complete control over your wireless network printer.

The basic components
The basic components

Resources

Latest Raspbian image
USB printer
USB wireless card

Step-by-step

Step 01 Check your printer works

Before starting, check that the printer you’re planning to use for the project still works and has enough ink. The easiest way to do this is to check the documentation (online if you can’t find the manual) and run a test print.

Step 02 Detect your printer

With your Raspberry Pi set up as usual and the printer connected to a spare USB port, enter:

$ lsusb

This will confirm that the printer has been detected by your Raspberry Pi. In most cases you should see the manufacturer and model displayed.

Step 03 Install Samba and CUPS

Install Samba to enable file and print sharing across the entire network:

$ sudo apt-get install samba

Next, install CUPS:

$ sudo apt-get install cups

With a print server created, begin configuration by adding default user ‘pi’ to the printer admin group:

$ sudo usermod -a -G lpadmin pi

Step 04 Set up print admin

Set up the CUPS print admin tool first. Boot into the GUI (startx) and launch the browser, entering 127.0.0.1:631.

Here, switch to Administration and ensure the ‘Share printers’ and ‘Allow remote administration’ boxes are selected. Next, select Add Printer and enter your Raspbian username
and password when prompted.

Step 05 Add your printer

A list of printers will be displayed, so select yours to proceed to the next screen where you can confirm the details, add a name and check the Share This Printer box. Click Continue to load the list of printer drivers and select the appropriate one from the list.

Step 06 Configure Samba for network printing

Using a Windows computer for printing? Samba will need some configuration. Open ‘/etc/samba/smb.conf’ in nano, search (Ctrl+W) for ‘[printers]’ and find ‘guest ok’ which you
should change as follows:

guest ok = yes

Next, search for “[print$].” Then change the path as follows:

path = /usr/share/cups/drivers

Step 07 Join a Windows workgroup

With these additions made, search for “workgroup” in the configuration file and add your workgroup:

workgroup = your_workgroup_name
wins support = yes

Make sure you uncomment the second setting so that the print server can be seen from Windows. Save your changes and then restart Samba:

$ sudo /etc/init.d/samba restart

Step 08 Accessing your printer on Linux

Meanwhile, it’s a lot easier to access your wireless printer from a Linux, Mac OS X or other Unix-like system, thanks to CUPS. All you need to do is add a network printer in the usual way and the device will be displayed.

Step 09 Add AirPrint compatibility

It’s also possible to print wirelessly from your iPad using Apple’s AirPrint system. To do this, you need to add the Avahi Discover software:

$ sudo apt-get install avahi-discover

Your wireless printer will now be discoverable from your iPad or iPhone and will be ready to print.

×