DEV Community

Cover image for Raspberry Pi + Old Printer = Wireless Network Printer
Tripad
Tripad

Posted on • Originally published at tripad.Medium

Raspberry Pi + Old Printer = Wireless Network Printer

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 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 to connect to WiFi

*If you just burnt your OS image to the card : Setup WiFi & SSH Without a Monitor

*Having a wired/wireless network connection with a static IP address will make your life easy — checkout this guide

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
Enter fullscreen mode Exit fullscreen mode

2. Lets Install CUPS server

sudo apt-get install cups
sudo usermod -a -G lpadmin pi
sudo cupsctl --remote-any
sudo systemctl restart cups
Enter fullscreen mode Exit fullscreen mode

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

*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

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

CUPS Driver List

(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)

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

Printer Defaults

  • This pretty much wraps it up for your CUPS setup. Go ahead and try a test print! Test Print Option

A Test Printer Page

Oh Yeah! If you have reached this far .. give your self a pat on the back


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 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

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

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

Top comments (0)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.