Raspberry Pi + Old Printer = Wireless Network Printer
Tags: diy, raspberrypi
Published: 2020-12-29 17:29:31

Every few weeks my dad would remind me that I need to print a physical piece of paper for “keeping records”. And like the weeks before I would keep forgetting to do so until one day I get another reminder saying that its been almost a month since the last reminder. Oh Well!

###So here is the Scenario :

* Connect my old but trusty HP LaserJet 1020 to the home WiFi network (Using a Raspberry Pi)
* Make it easy (and reliable) enough for my (not so tech-savvy) parents to print from their phones
* Never be asked to print anything ever again :)

###Here’s the Setup I used:

* nHook up the printer to a Raspberry Pi (_Literally any Pi works here, I am using a “Headless” Raspberry Pi 3B because I have it handy_)
* Connect the Raspberry Pi to your network (_I am using WiFi .. I guess thats the point of this guide 😛_)
* Use [CUPS](http://cups.org/) to start sharing the printer using IPP — Internet Printing Protocol
* Install/Setup CUPS support on Android and Windows Clients

###But wait … Why Not:

* Connect it to a computer .. use Google Cloud Print .. yada yada ? Because it still needs a computer to be booted up and running for when someone wants a print out. My Raspberry Pi is already Pi-Hole and is a lot more energy efficient
* Buy a new WiFi Printer ? Because even after being a printer from mid 2000s, trusty LaserJet 1020 is fast, virtually maintenance free and its “compatible” toner cartridges sell for as low as ₹400 (~ US$ 5)

---

##Installing Stuff on the Raspberry Pi

All we need to make this setup to work is CUPS (Common Unix Printing System) which is the thing that makes Linux computers spit out paper.

Installing CUPS is rather straight forward on Rasbian/RPi OS.

Here are the steps:

###0. Connecting Raspberry Pi (over WiFi) to your Network

Like with everything on the Pi there are multiple ways to connect the Pi to your network (using WiFi)

*If you have a keyboard/mouse/monitor connected : Use [Raspi-Config](https://www.raspberrypi.org/documentation/configuration/raspi-config.md) to connect to WiFi

*If you just burnt your OS image to the card : [Setup WiFi & SSH Without a Monitor](https://howchoo.com/g/ndy1zte2yjn/how-to-set-up-wifi-on-your-raspberry-pi-without-ethernet)

*Having a wired/wireless network connection with a static IP address will make your life easy — checkout [this guide](https://www.raspberrypi.org/documentation/configuration/tcpip/)

I prefer to keep the Raspberry Pi’s network configuration set to DHCP and assign a static lease on the router. In my opinion, this makes it easier to make changes to my network setup without remembering to reconfigure the Pi.

In my setup, even with almost 3 walls between my Pi and WiFi router, the signal strength is pretty good.

###1. Update the Raspberry Pi

```
sudo apt-get update
sudo apt-get upgrade
```

###2. Lets Install CUPS server
```
sudo apt-get install cups
sudo usermod -a -G lpadmin pi
sudo cupsctl --remote-any
sudo systemctl restart cups
```

The CUPS server should now be accessible on `http://[RaspberryPi's-IP]:631`

_(Tip: to quickly find the IP of the Pi — Run `hostname -I`)_

Adding any user to the **lpadmin** group gives that user access to the administrative options of the web console.

I’ve added the **pi** user to the lpadmin user group using the `sudo usermod -a -G lpadmin pi` command

By default CUPS is only accessible on the Pi itself. To make it available remotely, we have change the access rule using `cupsctl --remote-any`

_(This makes the server available to all IPs which is not secure — We can change this layer in cups conf file using the website console)_



###3. Adding a Printer to CUPS Server
Plug in your printer to any USB port of the Raspberry Pi and power it on.

Navigate to the CUPS console and follow these steps

*https://(Your-Pi-IP):631
*Administration → Printers → Add Printers
*Should give you the prompt to login — you use your Pi user's credentials to continue

You should be able to see the printer you have connected: 

![Add A Printer Section on Cups](https://dev-to-uploads.s3.amazonaws.com/i/hiztk25poo70b72xyzwc.png)

*Select the printer from list and click continue
_(If you are able to see your printer in the “Local Printers” list : check if the printer is turned on and is connected with a good USB cable. My printer wasn’t showing up in the list and so changing the USB cable fixed this issue for me)_

*On the next screen you would be able to set some identification for the printer you are adding. Ensure that your enable *“Share this Printer”* option at this screen and click continue

![Adding Printer Step 2](https://dev-to-uploads.s3.amazonaws.com/i/2yhv0h92udnizcuq0s2h.jpg)

* CUPS will show a list of models and drivers for your printer model.

![CUPS Driver List](https://dev-to-uploads.s3.amazonaws.com/i/emy6414u2jgc8081zuvy.jpg)

_(PS : Here is where you might need to search the interwebs for which drivers work best for your model) 
(PS : If you are trying to setup **HP LaserJet 1020** or a Host-Based Printer see instructions [posted here](https://tripad.medium.com/turning-my-old-printer-into-a-wireless-printer-with-a-raspberry-pi-1fb6d73e35a4#21f6))_

* On the final screen you would be presented with some options to set default options for the printer.

![Printer Defaults](https://dev-to-uploads.s3.amazonaws.com/i/elbz1ofjya5hphxlglyo.jpg)


* This pretty much wraps it up for your CUPS setup. Go ahead and try a test print!
![Test Print Option](https://dev-to-uploads.s3.amazonaws.com/i/nc5rvczyaxmplkhw82zz.jpg)

![A Test Printer Page](https://dev-to-uploads.s3.amazonaws.com/i/dohqvz41wlp29j8oyk35.jpg)

Oh Yeah! If you have reached this far .. give your self a pat on the back
<img width="100%" style="width:100%" src="https://media.giphy.com/media/gFi7V9CRBQVW0/giphy.gif">

---

### Next Up : Setting up your Client Devices

#### For Android : 
**Install CUPS (IPP) Support:**

I found the easiest way to achieve this was using an open-source app by [UpActivity](https://benoitduffez.github.io/AndroidCupsPrint/) called CUPS Printing on:

Google Play: https://play.google.com/store/apps/details?id=io.github.benoitduffez.cupsprint

F-Droid : https://f-droid.org/packages/io.github.benoitduffez.cupsprint/

#### For Windows 10 : 
Internet Printing Protocol support is enabled on Windows 10

*Under **Control Panel →  “Printers & Scanner”**- Click _Add Printers & Scanner._ 

* Click on the “The Printer that I want isn’t listed” option

* On the next screen, copy/paste the CUPS printer URL to the “Select a Shared Printer By Name” textfield. Do ensure that you copy the HTTP URL and not the HTTPS one

![Windows 10](https://dev-to-uploads.s3.amazonaws.com/i/edu5574cx420gzjhertg.jpg)

If the connection is successful, on the next screen you will be presented with a list of drivers to choose from. Find and choose the appropriate driver from the list or download the driver files from the manufacturer’s website. Thats it!


---

Though nothing in a DIYers life is as smooth as a tutorial so I have documented some challenges I have with cables and power supply in my [original post](https://tripad.medium.com/turning-my-old-printer-into-a-wireless-printer-with-a-raspberry-pi-1fb6d73e35a4#6e4d)

I hope this helps in getting started with your own printer server setup. If you have any question, do ping me Twitter: https://twitter.com/_Tripad

👋Until Next Time