A lot of Raspberry Pi projects I've seen on the internet are pretty complicated and require the use of a lot of extra components. The projects that get the most attention are usually esoteric or hard to reproduce. I was able to find a couple useful projects that pretty much anyone can do without purchasing any extra components. This is the first blog post in the series, and it covers how to use a Raspberry Pi [Raspberry Pi] as a print server so you can put your printer anywhere in your house.
If you've got an old USB-only printer, you might be a little tired of it by now. It's annoying that the printer has to be on your desk or otherwise within about 10 feet of your computer. And what if you have a laptop? Then the computer that the printer is connected to has to be turned on and properly configured to share that printer with every other computer in your house. It's a hassle, and leaving that main computer powered on is a huge waste of energy. If you use a Raspberry Pi as a printer server, you can save a lot of that energy, and put your printer anywhere you can put your Raspberry Pi. I put mine in my closet along with my WiFi router and cable modem.
Step 1: Basic Setup
These basic steps are the same for pretty much every Raspberry Pi project. Connect all the cables and make sure you have a bootable operating system.
- Download and Install Raspbian Jesse on your Raspberry Pi
- Put the SD card in your Raspberry Pi
- Connect your printer to your Raspberry Pi with a USB cable
- Connect an ethernet cable from your router to your Raspberry Pi.
- SSH into your Raspberry Pi with PuTTY.
- For this step, you'll have to go into your router to figure out your Raspberry Pi's IP address. The default username is "pi", and the default password is "raspberry".
Step 2: Install and Configure CUPS
Run the commands below to install CUPS. CUPS is the software that will any computer on your network to use your printer.
sudo apt update
sudo apt upgrade
sudo apt install cups
Then you need to add the pi user to the "lpadmin" group so you can configure CUPS.
sudo usermod -a -G lpadmin pi
And finally, tell cups to allow itself to be configured remotely.
sudo cupsctl --remote-any
sudo /etc/init.d/cups restart
If you're using Uncomplicated Firewall, open a hole for CUPS with the command below.
sudo ufw allow 631/tcp
Step 3: Setup Printer
At this point, you can disconnect from your Raspberry Pi. The rest of the work can take place on any computer on your LAN. To add a printer, you have to point a web browser to port 631 of your Raspberry Pi. For example, if your Raspberry Pi's local IP address is 192.168.1.123, then you can type "http://192.168.1.123:631" into your browser and hit enter.
Once you've reached the CUPS configuration page, go to the Administration menu and click the "Add a Printer" button. The rest of adding the printer is straightforward. Just make sure to check any checkboxes that enable sharing for this printer. If you can't find the right driver for your printer, you can try searching on Google for "CUPS driver XYZ" where XYZ is your printer's model.
Step 4: Configure Clients
Adding this printer to Windows computers is dead simple. Go to the CUPS configuration page in your browser, click the "Printers" link, and then finally click on the click for the printer that you installed. Once you're on your printer's CUPS page, copy the URL from your browser's URL bar. It should look something like "http://192.168.1.123:631/printers/Brother-HL-2040".
In Windows, press the Windows key, type "printer", and click "Add a printer". In the box that pops up, click "Add a network, wireless or Bluetooth printer". Then click "The printer that I want isn't listed". Click the button "Select a shared printer by name" and paste the printer's URL into the box. Click next.
That's it. You can try printing a test page now to see your networked printer in action. How did these instructions work out for YOU? Let me know in the comments below.
Photo by Clive Darra