Adding Wifi to any printer

I own a Brother HL-L2310D Black and White Laser Printer. It prints great the toner is cheap and I've never had a problem with it.

But it doesn't have wifi. And so everytime I want to print something I have to walk over to my printer, connect my laptop to it with a wire and wait around until its finished.

That's unacceptable.

Instead of replacing an otherwise great printer I'm just going to add wifi capabilities to it, by turning a spare raspberry pi zero into a print server.

There are many guides on the internet explaining how to do this, but I want to write down exactly what I did, just in case something breaks a few years down the line and I don't remember what I did to get it working in the first place.

I'll try to be brief in case you want to follow along as well as to spare myself boring prose when I dig this up in the future.

Headleass Install of Raspberry Pi OS

Raspberry provides the Raspberry Pi Image for easy installation of the os onto a micro-sd card. Download and install it. Select other, then Raspberry Pi OS Lite 32 bit. Don't use the standard os, it contains all kind of stuff that we don't need.

Click on the little cog, enable ssh and fill in you wifi settings. Click save and then write it to your micro-sd card. Once done, put your card back into the pi, and connect it to power, as well as your printer via usb.

If your Pi has trouble detecting the printer later on, try using a usb otg adapter.

If you have a 3d printer, now would be a great time to print a case. I used this one: https://www.thingiverse.com/thing:4770769 (If you don't have a 3D printer, consider getting one, it's a very useful tool to own and nobody is forcing you to print useless figurines unlike the internet might make you believe.)

Installing CUPS

After you gave the pi some time to boot up find its IP in your router settings (Mine was 192.168.178.68). While you're at it give it a static IP. If you don't you might need to remove and re-add it to your print settings everytime you want to print something. Don't ask me how I know this.

SSH into your pi.

Update the system with the following commands:

sudo apt update
sudo apt upgrade

Don't worry if this takes a while, the raspberry pi zero is sloooooow.

Install CUPS:

sudo apt install cups

CUPS creates the new usergroup lpadmin. Add your user to this group, otherwise you won't be allowed to print.

sudo usermod -a -G lpadmin pi

Enable CUPS to be accessible over your network:

sudo cupsctl --remote-any

Check if you can reach the CUPS server from your browser. The default CUPS port is 631

If you have a brother laserprinter, install the brlaser package:

sudo apt install printer-driver-brlaser

Edit: If you're having trouble installing with paper formats (like A4) than a different driver might be worth a look. This one (https://download.brother.com/welcome/dlf103532/hll2310dpdrv-4.0.0-1.i386.deb) is available directly from Brother and can be installed via:

sudo dpkg --force-architecture -i dlf103532/hll2310dpdrv-4.0.0-1.i386.deb

force-architecture is needed because the package isn't meant for arm devices (like the raspberry pi zero), but it just unpacks the ppd file, so it'll work just fine.

Configuring CUPS

On the CUPS configuration page, go to Administration -> Add Printer CUPS will ask you to switch to https. Log in with your ssh credentials (This is why we added the user to the lpadmin group).

If you had your printer connected and powered on it should just show up in the local printers section. Select it, change its name and description if you want to and check the "Share This Printer" option.

Now just select Make and Model, set some default settings and you're done.

There's a dropdown menu that says Maintenance, it will also contain an option to print a test page. If evertying went well you should be able to print a page. Your printer will now also be availabe via wifi to every other device in you network.