How To Turn Almost Any Printer Wireless Using Raspberry Pi?

Have you got that same old model of the Laser, Inkjet USB printer that you’ve been using since the last few years? Possibly it’s one you’ve had for quite a long while, or perhaps it’s a less expensive one you’ve recently chosen and wished it had the support for your Apple iPhone, iPad, etc. In case you’ve bought yourself a Raspberry Pi, all you need is some experience of the Secure Shell (SSH) and you can get your printer working natively in AirPrint instantly!

It doesn’t make a difference whether your printer interfaces by means of USB, Ethernet or Wi-Fi – this trick will at present work.

Hardware Components (Raspberry Pi Zero, Printer & iPhone) Used In The Project

Now, Let’s move towards setting up the Raspberry Pi, installing necessary packages on it and making certain hardware changes!

Step 1: Make Sure That Raspberry Pi Is Up To Date.

Keep the sources of your Pi up to date otherwise, the outdated software will cause some problems. Enable the Virtual Network Computing (VNC) viewer on your Pi, then connect your Raspberry Pi with the VNC viewer. The link is provided below for downloading VNC and then connecting it with Pi.

VNC

Now, open the terminal and run the following command :

sudo apt-get update

then,

sudo apt-get upgrade

If any updates are installed, press Y and then press Enter to continue downloading updates. When that is done, you can begin introducing your gadget.

Step 2: Connect Your Printer with To Pi’s USB Port.

There are two options. You can connect the printer either using a USB cable or via ethernet or either Wifi. If you are using ethernet or Wifi, ignore this step and directly move towards step 3.

Connect the printer via USB cable and reboot the Pi using the following command :

sudo reboot

After rebooting, run the terminal and run :

lsusb

All devices that are associated with the means of USB ought to be displayed now. On the off chance that your printer doesn’t appear, ensure it is turned on and working properly.

Step 3: Install samba and CUPS.

Now, we can start installing the software that will provide the printer networking. In the terminal run the following commands :

sudo apt-get install samba

Numerous packages will be installed and if asked press Y and then Enter to install them properly. After the packages are installed run:

sudo apt-get install cups

Most probably we’ll see apt wanting to install the combination of packages. There is no need to panic and carry on as done previously. From that point forward, we simply need to include a printing administrator with the goal that CUPS can manage printers on the Pi. Run the following command :

sudo usermod -a -G lpadmin pi

Step 4: Add Your Printer.

We presently need to add your printer to your print server. To do this, we will have to explore to the CUPS User Interface. Open the web browser on Pi and run the IP : 127.0.0.1:631. The result should be like this :

CUPS Admin Homepage

Click the ‘Administration tab’ and then click ‘Add printer’. We might be asked to switch to SSL and we will follow the link if told. After that, we will be prompted to log in. We will use the default login details that we use to log in to VNC or the customized details if we’ve changed them.

  1. Choosing Your Printer: After logging in a list of currently connected printers will be shown. Some printer details will also be shown as the mode of connectivity (Either by USB cable or Wifi). We will find our printer on that list. We will select our printer and then click on continue.
    Choosing A Printer
  2. Defining Details Of Printer: Now, we need to give it a name (default name can be given), a description (this is the way our printer will be distinguished to iDevice) and a location (optional). We will ensure that we’ve clicked on Share This Printer and then Continue.
    Defining Details
  3. Selecting The Driver: A driver needs to be selected now. Most probably Pi will identify suitable driver itself – if not we will scroll through the list of drivers and choose an appropriate one. At this point click on Add Printer and select any default preferences we may have. Click Set Default Options and now the difficult part is done.
    Selecting The Suitable Driver
  4. Ensuring The Addition Of Printer: We will ensure that the printer has been added successfully. We’ll move over to the Printers tab and see whether our printer is shown or not. If somebody wants to print the test page he/she can do so by selecting the printer from the list, clicking on the Maintenance dropdown and then clicking Print Test Page.
    Ensuring The Addition Of Printer

Step 5: Fine-Tune Some Settings.

Performance can be made better by fine-tuning some settings. Go to the Administration tab and look for Share printers connected to the system. If we want to add new printers remotely in the future over our network check for Allow Remote Administration. Click on change settings and the server will reboot.

Fine Tune

Step 6: Add Samba Support For Windows Networking (Optional).

Samba for windows should be activated if someone wants to use this printer with a Windows device. For that run the following command:

sudo nano /etc/samba/smb.conf

Now, move to the bottom and paste the following :

# 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

Now, press CTRL + W and type in workgroup followed by Enter to find workgroup configuration. Most probably your workgroup is already set and rarely there is a chance that you’ve changed your workgroup before –  if you have, set the correct name at workgroup =. Then change wins support = no to wins support = yes.

Then press CTRL + O, followed by Enter to save the configuration. After that restart the samba with the following command :

sudo /etc/init.d/samba restart

All set, now our printer will work on the Windows network.

Step 7: (If your Raspberry Pi is connected to your network via Wi-Fi) Change a quick setting here.

As displayed in the start we are using Raspberry Pi Zero in this project so our Pi is connected to the network via Wifi. Those who own the latest models of Pi which are connected via Ethernet cable should ignore this step. Our raspberry model uses Wifi so we need to turn off the power saving for its Wifi adapter to prevent it from going to sleep and isolating AirPrint.

For this task, we need to edit a file in the Terminal :

sudo nano /etc/modprobe.d/8192cu.conf

Add the following at the bottom :

# No power saving
options 8192cu rtw_power_mgnt=0 rtw_enusbss=1 rtw_ips_mode=1

Now press CTRL + O for the changes to take effect followed by Enter.

Step 8: Install Bonjour for AirPrint.

About there, I guarantee! We currently need to introduce AirPrint software.

Run the command in the terminal :

sudo apt-get install avahi-discover

Now we will reboot our Pi :

sudo reboot

Step 9: Testing.

Now all the necessary configurations are done. Grab an iOS device, open up email or Safari page and click on Share option until we find a Print option. Hit Select Printer and it should (decently fast) show up.

Testing

Select your printer, modify any inclinations you wish, and afterward click on Print. An AirPrint printer with a little configuration from your Pi is now ready. Regardless, you should now have a printer that works over your system and on the majority of your preferred iOS gadgets, without the requirement for any outsider application!

Hamza Iqbal
Hey! I am Hamza. I am an Electrical Engineer who has a very innovative approach towards daily life stuff. I tend to make life easier by making circuits and designs to automate things around me. I mainly work with printed circuit boards on proteus to bring life to my inventions.