Many might think why am I even making this tutorial. I can just buy a new wireless printer. Well, a new printer will be quite expensive and I have been using my printer for the past 8-9 years without any issue except for the fact that the ink drains rapidly. But thats fine as I print just about 20 pages a month which is less than a page a day. I would like to increase the longevity of the printer by making it wireless using Raspberry Pi. It will simply make my task of printing simpler and wire free. So let’s begin.
Steps To Success
- Make sure the Raspberry Pi is connected to the local Wi-fi network. If not then click here.
- SSH into your Raspberry Pi using Terminal on Mac/Linux and Putty on Windows
- Update and Upgrade the packages!
- Its time for some file sharing. So we will install the Open Source file sharing service named samba.
- Now we will install CUPS. CUPS is a printing service for Apple devices and devices running UNIX. And as Linux derives, number of things from Linux, it should work on Raspberry Pi.
- We will select the default admin for printing using the following command.
- Connect your printer to Raspberry Pi. Now let’s check the devices connected to the Raspberry Pi via USB.
- It’s time to disconnect from SSH. Reboot Raspberry Pi and connect to a display using HDMI. Open web browser on the Raspberry Pi and visit local loopback address i.e. 127.0.0.1:631
- Click on Administrator and then click on Advanced Settings. Modify it to the settings given in image below. Click on Change Settings.
- Reboot Raspberry Pi and perform SSH using Terminal on Mac/Linux and Putty on Windows.
- Open web browser on your Mac or Windows and visit x.x.x.x:631 where x.x.x.x is the IP of your Raspberry Pi. The CUPS local servers web interface will now be wirelessly accessible.
- Go to Administrator tab and click on Add Printer. Select the local printer. Give it a good name, description and location. Click on Continue.
- A list of drivers will be populated based on your Printer’s make and model. This may take some time. Select the appropriate driver and click on Add Printer.
- CUPS will load the default options for your printer which you just added. Set the default preferences and click on Set Default Options.
- You can try printing a test page in Maintenance section to test your Printer.
sudo apt-get update
sudo apt-get upgrade
This can take around 15 minutes. So get a good cup of coffee!
sudo apt-get install samba
sudo apt-get install cups
sudo usermod -a -G lpadmin pi
Mac Specific Steps
It’s extremely simple on Mac because CUPS is developed by Apple.
Windows Specific Steps
- Open SSH connection with Raspberry Pi and edit the Samba configuration file.
- Next press Ctrl+W and search for Workgroup. Change your workgroup depending on the workgroup to which your Windows Machine is connected to. Usually it is WORKGROUP itself.
- Just below WORKGROUP, uncomment wins support and make it yes.
- Press Ctrl+X and press Y. Then press Enter.
- Now restart samba!
- Exit SSH and open Windows Control Panel. Navigate to Hardware & Sound and select Advanced Printer Setup.
- Windows will look for wireless printers. Select the one connected to Raspberry Pi. It may say no driver found and will ask you to select the driver from drop down menu. However if the driver is not visible in dropdown menu then download the driver by directly connecting the printer to Windows Machine via USB or from vendors website and then perform this step again. The driver will now show and select it.
- Windows will configure the printer and now you can print anything you want wirelessly from your Windows Machine.
sudo nano /etc/samba/smb.conf
Go to the bottom of the file and paste the following code,
# CUPS printing. See also the cupsaddsmb(8) manpage in the
# cupsys-client package.
printing = cups
printcap name = cups
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
comment = Printer Drivers
path = /usr/share/cups/drivers
browseable = yes
read only = yes
guest ok = no
wins support = yes
sudo /etc/init.d/samba restart