Skip to main content

Bring your old printer online with Raspberry Pi


If you have an old printer at home that does not have a network interface, but has a USB port, you can connect it to your raspberry pi. Since your pi is reachable in your private network (see my previous post), you can make it a print server for your printer and make it available on your LAN. Using Google Cloud Print, you can even take a step further and make your printer reachable over the internet. This good article explains how to set up the print server on your pi. I will repeat the steps here for the record and go on to the Google Cloud Print part. 

For the print server on the pi, you need CUPS (Common Unix Printing System). But before that, to make your pi visible to your Windows machines, you need samba:

> sudo apt-get install samba
> sudo apt-get install cups

These may take a few minutes to install. Just follow the instructions that may come on the screen and you'll be fine. After installing CUPS, you need to add your current user (by default: pi) to the printer admin group. Here's how you do it:

> sudo usermod –a –G lpadmin pi

CUPS give you a web interface on port 631. So open a browser and go to http:\\mypi:631, and there you have your CUPS administration interface. Click on Add New printer and then choose your own from the list. To make sure that you choose the correct one, you can list your usb devices connected to your pi by this:

> lsusb

If you cannot see your printer listed in the CUPS administration it means that you need to install a driver for it. Search for your printer model in Open Printing of The Linux Foundation and see what driver you need to get. In my case I needed to install brlaser:

> sudo apt-get install printer-driver-brlaser

After choosing the correct printer, on the next page, make sure that you check "Share this printer". Finally you can click on "Print Test Page" to make sure that printer works with the selected driver.

Now to make your printer available to your Windows machines you need to add below to /etc/samba/smb.conf:

> sudo pico /etc/samba/smb.conf

# CUPS printing.  See also the cupsaddsmb(8) manpage in the
# cupsys-client package.
printing = cups
printcap name = cups
[printers]
comment = All Printers
browseable = no
path = /var/spool/samba
printable = yes
guest ok = yes
read only = yes
create mask = 0700

# Windows clients look for this share name as a source of downloadable
# printer drivers
[print$]
comment = Printer Drivers
path = /usr/share/cups/drivers
browseable = yes
read only = yes
guest ok = no

The only thing that remains is to add your printer as default on your other network machines. In Winows, open the Windows Exporer and type in \\mypi and press enter. You should get your printer listed there. Right click on it and choose "Connect". Your printer is now ready to be used on your LAN.

Try to send a couple of print jobs from your Windows machine to make sure that it works. Now if you check CUPS administration page, under tab "Printers", choose your printer and on the printer page, click on "Show All Jobs", and you'll be able to see all of the jobs the printer has done. By default, for the matter of security, the user who has sent the job is mentioned as "Withheld" and the name of the document is shown as "Unknown". To change this, you need to edit /etc/cups/cupsd.conf like this:

> sudo pico /etc/cups/cupsd.conf

<policy default="">
  JobPrivateAccess default
  JobPrivateValues none

Google Cloud Print

Now you can take a step further and connect your printer to Google Cloud Print. This enables you to send print jobs to your printer from anywhere on the internet and even from your mobile devices.

Google Cloud Print works with chrome service, therefore you need to install chrome browser on your raspberry pi. In my case, since there are no binaries for the CPU on my raspberry pi Model B Rev. 2, I have to build it from the source code. But otherwise it's easy to install it:

> sudo apt-get install chromium-browser

After the installation, go to your raspberry pi desktop and launch Chrome. Log on with your Google account in Chrome and then type in "chrome://devices" in the address bar and from there it's pretty straight forward how you can add your printer to the Goolge Cloud Print. Now if you are logged on on any device, with the same Google account you used to add your printer to the cloud, you'll be able to send print jobs to your printer.

UPDATE: After writing this I learned that there's another way of enabling your CUPS print server with Google Cloud Print, and it's by using cups-connector. I followed the instructions there but could not make it work. I will update this post when I find out why.

Comments

  1. Lots of valuable data can be taken from your article about a mattress. I am happy that you have shared great info with us, It is a gainful article for us. Thankful to you for sharing an article like this.Printing and packaging inspection system

    ReplyDelete

Post a Comment

Popular posts from this blog

Run your Raspberry Pi with wifi and static IP addresses

In this post I'm going to go through steps I took to get my quite old raspberry pi (Model B Rev. 2) up and running again for some future projects. We will install NOOBS, change hostname, setup the wifi, and finally we setup static IP addresses on the pi to make it easily available on our private network. Installation Installation is very easy if you follow the original raspberry pi instructions . You just download NOOBS, format your SD card with SD Formatter , and copy NOOBS files to your SD card. And then you boot your raspberri pi, and follow the instructions on the screen. A couple of tools that will come handy after the installation are: Win32 Disk Imager  to get backups of your SD card, after installing and configuration of different stuff. So spare some hard disk space on your computer for the backups. A good SSH client. I use mobaXterm . There are of course plenty of them out there.  After NOOBS installation just run two below commands. It's good