While it might be easy enough to buy a new printer for under $50, you might have spent enough on your last one, and be unable to justify the outlay. Additionally, your old printer might have a special function, or manage duplexing in a particularly satisfying way, to bother replacing it.
The solution, then, is to make it wireless. Several solutions are available, but one popular choice is to use your Raspberry Pi as a wireless print server.
Benefits Of Wireless PrintingIf you haven’t already enjoyed the benefits of wireless printing, then this project is definitely the place to start. Got a big bulky printer taking up space in your office that you don’t use too often? Perhaps the cables get in the way?
With a wireless printer you can move your printing into a separate room (perhaps even your shed) and collect your print jobs when they’re complete. This way, the space taken up by the printer on your desk can be used in other ways. Using wireless technology, printing can also take place via any device you might have, whether it’s a laptop, smartphone or tablet.
Wireless printing really is about making printing flexible rather than “locking” it to the desk. And the Raspberry Pi can help with this.
Preparing For Wireless Printing With The Raspberry PiFor this project, you’ll need to ensure you have connected and setup a wireless USB dongle for your Raspberry Pi. You should also be using a USB printer. It’s possible to make this work with a parallel printer coupled to a parallel-to-USB adaptor, but you’ll need to research elsewhere if you run into any problems with that.
You’ll also need a USB cable from your printer to your Raspberry Pi.
Finally, if you haven’t already done so, setup your Raspberry Pi with a preferred operating system, and ensure it is up to date (If you haven’t done this before, NOOBS is probably the best solution.).
To update, enter
sudo apt-get update
This tutorial was written based on a wireless print server running on Raspbian.
sudo apt-get upgrade
Configuring Your Raspberry Pi As A Print Server With CUPSWith the equipment connected and setup, the first thing to do is ensure that your USB printer is detected.
Open a command line (either on your Raspberry Pi directly or over SSH) and enter:
A list of attached USB devices should appear. Check it, and identify your printer.
Following this, you’ll need to install Samba, the open source file sharing software. This can be done by entering the command.
Follow any instructions that are displayed.
sudo apt-get install samba
Next, it’s time to install CUPS, the Common Unix Printing System (note that you must install Samba first).
CUPS provides drivers for your printer. Many manufacturers now provide Linux drivers, but in the event one isn’t available, use this.
sudo apt-get install cups
You’re now ready to add the default user to the printer admin group.
sudo usermod –a –G lpadmin pi
Adding Your PrinterNext, you’ll need to setup your printer with your Raspberry Pi. Boot into the GUI with startx, launch your browser and go to 127.0.0.1:631 and switch to the Administration tab.
Select Add new printer, input your Raspbian credentials when requested and then select your printer from the displayed list. Proceed to the next screen, selecting the correct device from the list. In the following screen, confirm the details and assign a name, then check Share This Printer and click Continue.
Depending upon your device manufacturer, the next page may take a while to load. This is because a whole host of device driver names are being loaded up, so if you’ve connected a HP printer you may be in for a long wait. Once the list has downloaded, select the correct printer driver (which should be selected by default) and continue. Alternatively, click Select Another Make/Manufacturer and select Raw. You can let Windows handle the driver!
Click Add Printer, then Set Default Options. A few moments later the printer will be ready to start accepting jobs. To ensure it is working, click Maintenance and select Print Test Page.
Connecting To Your Raspberry Pi From WindowsWith that all done, you need to ensure that access from Windows to your Raspberry Pi is enabled so that you can start printing.
This is done by editing the samba config file in /etc/samba/smb.conf – you can do this in the GUI as you should still be in there, although it is simple enough to launch it in bash with a text editor.
The following should be added:
Next, press CTRL + W to search for “workgroup” and setup as follows (replacing your_workgroup_name as necessary – usually Workgroup):
# CUPS printing. See also the cupsaddsmb(8) manpage in the # cupsys-client package. printing = cups printcap name = cups [printers] comment = All Printers browseable = no path = /var/spool/samba printable = yes guest ok = yes read only = yes create mask = 0700 # Windows clients look for this share name as a source of downloadable # printer drivers [print$] comment = Printer Drivers path = /usr/share/cups/drivers browseable = yes read only = yes guest ok = no
With that saved, exit the GUI and restart samba:
workgroup = your_workgroup_name wins support = yes
sudo /etc/init.d/samba restart
Start Printing From Windows & Mac OS XOnce samba restarts – which shouldn’t take more than a few seconds – you can switch to your Windows PC and add a new printer. First check that the Raspberry Pi is visible by opening Windows Explorer > Network.
Go to Control Panel > Hardware and Sound > Devices and Printers > Advanced printer setup and wait for the system to scan. A quicker option is to expand your Raspberry Pi’s entry in Windows Explorer’s Network view, from which you can right-click on the printer, select Connect, select your Windows printer driver and start printing.
Mac users, meanwhile, can add a new printer in the usual way.
Any administration of the print server that needs to be performed can be done by opening http://[RPI.IP.ADDRESS.HERE]:631, which will display the CUPS printer admin web interface on any networked computer.
Have you given new, wireless life to an old printer with your Raspberry Pi? Let us know how it went!