Convert your old printer to a wireless printer with CUPS and OrangePi

To reserve a physical place on the desk for home PC users is often an annoying work. You don't really need printers all the time, but you would like them to be accessible whenever you need them. So why not connect it to a single chip computer that has any Linux distribution on it and then share on the network. Single chip computers now as less as 7 USD on AliExpress. Raspberry Pi for this solution may be a bit expensive unless you already use it for still have resources for CUPS. I used Orange Pi Zero with 512 MB which is 9 USD at the moment.

I will assume that you already have a single chip computer which you had connected to your local network and can SSH into. Now we will install CUPS on it and share with other computers on our local network.

SSH into your Orange Pi

CUPS (Common Unix Printing System) is an open source software developed by Apple. A computer running CUPS is a host that can accept print jobs from client computers, process them, and send them to the appropriate printer.

Let's first update our system, install generic printer drivers and CUPS.

sudo apt-get update  
sudo apt-get install -y printer-driver-escpr  
sudo apt-get install -y cups cups-client cups-common cups-pdf  

Generic drivers will work on most systems. Now we will give access to Linux user (login screenshot above I use username 'cuneyt') and then make CUPS panel accessible remotely.

usermod -a -G lpadmin cuneyt  
sudo cupsctl --remote-any  

and restart CUPS.

sudo service cups restart  

Above steps actually change the content of the file /etc/cups/cupsd.conf.

You don't need to change it manually but it should look something like below.

LogLevel warn
PageLogFormat
MaxLogSize 0
# Allow remote access
Port 631
Listen /var/run/cups/cups.sock
Browsing Off
BrowseLocalProtocols dnssd
DefaultAuthType Basic
WebInterface Yes
<Location />
  # Allow remote access...
  Order allow,deny
  Allow all
</Location>
<Location /admin>
</Location>
<Location /admin/conf>
  AuthType Default
  Require user @SYSTEM
</Location>
<Location /admin/log>
  AuthType Default
  Require user @SYSTEM
  Order allow,deny
</Location>
<Policy default>
  JobPrivateAccess default
  JobPrivateValues default
  SubscriptionPrivateAccess default
  SubscriptionPrivateValues default
  <Limit Create-Job Print-Job Print-URI Validate-Job>
    Order deny,allow
  </Limit>
  <Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job Cancel-My-Jobs Close-Job CUPS-Move-Job CUPS-Get-Document>
    Require user @OWNER @SYSTEM
    Order deny,allow
  </Limit>
  <Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default CUPS-Get-Devices>
    AuthType Default
    Require user @SYSTEM
    Order deny,allow
  </Limit>
  <Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After Cancel-Jobs CUPS-Accept-Jobs CUPS-Reject-Jobs>
    AuthType Default
    Require user @SYSTEM
    Order deny,allow
  </Limit>
  <Limit Cancel-Job CUPS-Authenticate-Job>
    Require user @OWNER @SYSTEM
    Order deny,allow
  </Limit>
  <Limit All>
    Order deny,allow
  </Limit>
</Policy>
<Policy authenticated>
  JobPrivateAccess default
  JobPrivateValues default
  SubscriptionPrivateAccess default
  SubscriptionPrivateValues default
  <Limit Create-Job Print-Job Print-URI Validate-Job>
    AuthType Default
    Order deny,allow
  </Limit>
  <Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job Cancel-My-Jobs Close-Job CUPS-Move-Job CUPS-Get-Document>
    AuthType Default
    Require user @OWNER @SYSTEM
    Order deny,allow
  </Limit>
  <Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default>
    AuthType Default
    Require user @SYSTEM
    Order deny,allow
  </Limit>
  <Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After Cancel-Jobs CUPS-Accept-Jobs CUPS-Reject-Jobs>
    AuthType Default
    Require user @SYSTEM
    Order deny,allow
  </Limit>
  <Limit Cancel-Job CUPS-Authenticate-Job>
    AuthType Default
    Require user @OWNER @SYSTEM
    Order deny,allow
  </Limit>
  <Limit All>
    Order deny,allow
  </Limit>
</Policy>

Then in the administration console we will add a new printer. We should see our printer in the local printers list.

CUPS Admin Console

Don't forget to select checkbox "Share" before continuing. I've chosen "Generic PCL Laser Printer" which should work in most computers unless you see your exact model in the list.

CUPS Generic PCL Laser Printer

After we've added printer we should see it in an address like below depending on the name we've while creating it.

Printer installed successfully

Now the last step. To actually use the printer from another computer which is not physically plugged to our printer. Copy the exact address from the address bar from previous screen and paste it to the the "Select a shared printer by name" part in Windows 10. Now you should be able to see the printer connected successfully.

Add printer in Windows 10

Of course instead of Orange Pi you can also use Raspberry Pi but I find Raspberries to be pricey for this kind of mission. But if you have a Raspberry that you're using as a small server you can also add an extra task like this.