element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi Projects
  • Products
  • Raspberry Pi
  • Raspberry Pi Projects
  • More
  • Cancel
Raspberry Pi Projects
Blog Use a Raspberry PI Zero W as a Wireless Print Server
  • Blog
  • Documents
  • Events
  • Polls
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi Projects to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: feiticeir0
  • Date Created: 28 Jun 2021 4:33 PM Date Created
  • Views 81401 views
  • Likes 10 likes
  • Comments 15 comments
  • turn a raspberry pi into a shared printer
  • share a printer with a raspberry pi w with wifi
  • raspberry pi shared printer
  • rpiintermediate
  • rpi w
  • raspberry pi w
  • share a printer through wifi with a raspberry pi
  • turn a printer into a shared printer with wifi
  • raspberry pi printer
Related
Recommended

Use a Raspberry PI Zero W as a Wireless Print Server

feiticeir0
feiticeir0
28 Jun 2021

Hi all !

I have a new updated version of this post - creating a Raspberry PI Printer RAW queue - Jetdirect 9100 port with a Raspberry PI

Today, I'm going to share a "hack" that I use in my work when a printer (Laser A4 or labels - Zebra printers) doesn't has network connectivity or a network wall socket is not available - but WIFI is present.

Using a Raspberry PI Zero W I'm able to share the printer with more than 1 client . To this day, I have 8 working without a problem and more are yet to come.

 

This is a neat solution that solves a lot of problems:

  • I don't have to rely on a computer (Windows) to be on all the time for someone to be able to print.
  • It's more stable and reliable
  • Only requires WIFI
  • Installation on Windows is easy

 

Of course, there are some downfalls as well:

  • One more computer to have (albeit being a low power Raspberry PI W)
  • Not compatible with programs/hardware that require a socket connection to a 900X port

 

But, it does provide a solution that works for me in many ways and allows many computers to be able to print.

 

Hardware

There's only a few requirements needed with a Raspberry PI Zero W

  • USB OTG cable - to connect the printer
  • Printer with USB interface (so, not to old printers)
  • Power the RPI W with a power adapter, not a computer USB port.

 

STEPS

There are the steps we're going to take - simple and few

  1. We're going to install Raspbian OS Lite
  2. Configure CUPS and install a printer
  3. Configure SAMBA

 

Each step is easy and the configurations are very straightforward and fast.

 

Raspberry PI

First, let's install the Raspberry PI Zero W.

A 8GB SD CARD is enough. I use the Raspberry PI Imager. It's fast and there's no need to download the img file. Also, it downloads the latest version available.

image

For this, the Raspberry PI OS Lite is enough.  Let's choose it - Second option (Other) - Raspberry PI OS Lite

imageimage

 

Next, you should insert the SD Card in the reader and choose it.

REMEMBER: All that it's inside, will be destroyed !

imageimage

 

And next, press WRITE and wait

image

and done.

image

 

Headless setup

We can now perform a what's called a headless setup. We don't need a mouse, keyboard or monitor to be able to remotely access the Raspberry PI .

Using Windows, Mac or Linux, you now have a new partition (or drive letter) in your file manager - remove the SD card and insert it again if nothing shows up - it's the boot partition.

This is it on Windows

image

 

We will now create two files here: ssh and wpa_supplicant.conf .

If you are in Windows, with Powershell just execute New-Item .

 

image

 

With Linux or Mac, just use the touch command (assuming your current location is the boot partition)

 

touch ssh
touch wpa_supplicant.conf

 

The ssh file can stay with 0 bytes - when booting, the Raspberry PI OS will, if the file is present, enable the ssh service

For the wpa_supplicant, we need to create some configuration. Just edit the file with your favorite editor and put the following lines in it:

 

vi wpa_supplicant.conf

 

country=<your country 2 letter code>
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
        ssid="<wifi_name>"
        psk="<password>"
        proto=RSN
        key_mgmt=WPA-PSK
        pairwise=CCMP
        auth_alg=OPEN
}

 

The lines above, in the network section, those lines are the ones needed to connect to a WPA/WPA2 network that's broadcasting the SSID.

You need to change the <your country 2 letter code>. Without it, WPA_SUPPLICANT won't work.

Unmount the SD Card and put it on the Raspberry PI.

 

I'm going to assume you have a DHCP server on the network and now how to find the IP address of the Raspberry PI.

Pimoroni has a great tutorial on how to do that.

 

If you need to give a static IP address to the Raspberry PI, then you need a keyboard, mouse and monitor.

Raspberry PI documentation explains very well that step.

 

Software

After the PI boots and you know it's IP address, lets access it using ssh and update the software

ssh pi@<ip_of_rpiw>

The default password is raspberry. You SHOULD CHANGE IT :

passwd

or

sudo raspi-config

 

Options 1 and S3

imageimage

 

OPTIONAL

You can, if you want, set a root password. As pi user, just use sudo to launch a bash as root and set a new root password

sudo bash
passwd

 

and set a root password. You will not lose the ability to use sudo with the pi user, but will have root with a defined password.

 

Update

Let's update the software

sudo apt-get update
sudo apt-get upgrade -y

 

Reboot

 

After the reboot, let's install cups and samba

sudo apt-get install samba cups -y

 

Configure CUPS

 

First, let's configure CUPS to allow us to access the Web Interface and use the DNS name instead of just the IP address.

Note: Make a backup of the file first, just in case

 

sudo vi /etc/cups/cupsd.conf

 

We just need to change a line and add 3 new ones

Replace the following line:

Listen localhost:631

with

Listen 631

 

This will allow us to access CUPS web Interface from another computer.

Next, just before the first <Location /> tag, , add the following line:

 

ServerAlias *

 

This will allow us to also use DNS instead of just the IP address

 

Now, inside the <Location /> and <Location /admin> blocks, add the following line, just after Order allow, deny

Allow <your_computer_ip_address>

 

Or, if you want to loosen up a bit, you can use a network range or just all:

Allow 172.100.0.0/24

or

Allow All

 

This will stay like:

<Location />
    Order allow,deny
    Allow 10.11.23.1
</Location>
<Location /admin>
    Order allow,deny
    Allow 10.11.23.1
</Location>

 

where 10.11.23.1 is my IP address

 

Let's add the PI user to the lpadmin group

sudo gpasswd -a pi lpadmin

 

Although gpasswd will require to login again for the changes to take effect, we don't need it because it will be the cups service that will get restarted and thus, we don't need the group in the current session . But feel free .

 

This will allow the pi user to add, remove and configure printers

 

Now, let's enable cups and start it (or restart it)

sudo systemctl enable cups
Synchronizing state of cups.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable cups

sudo systemctl start cups

 

Add a printer to cups

This is the normal procedure - add a printer to cups on any Linux, using the CUPS Web Interface.

 

Open your browser of choice and head to:

https://<your_pi_address/name>:631 and you will land at CUPS web

image

 

On CUPS Administration, press the "Add Printer" button

image

On the Printers list, we want the Local Printers - connected to USB. Choose the one you're connecting. In my case, a HP LajserJet 1022 - old, I know.

image

Fill in all the details. The name is specially important, since it's by it we will reach the printer. My advice is DO NOT USE SPACES.

Don't forget to tick the "Share This Printer" box.

image

 

On the next screen, choose the drivers

image

To terminate, just set the default options for the printer and you are ready. Options may vary according to printers and drivers.

image

Now that cups is set, let's configure SAMBA to share the printer with Windows.

 

Configure SAMBA

We need SAMBA to be able to add the printer on Windows. We can configure samba in many ways, but for this to work, we just need to add a line and change another.

IMPORTANT NOTE: This is the minimal way to allow Windows to print to any printer configured on the Raspberry PI. There's no security whatsoever, meaning that, any user will be able to print to this printer - just needs to add it to its Windows S.O.

SAMBA can be used to share folders and even allow Linux users to logon, with all the security measures and policies that SAMBA/Linux and Windows Active Directory will provide.

With a minimal setup, we could do this and just allow certain users/computers to print to this printer, but that's beyond this tutorial.

There are a lot of good ones out there. You can read this one and this one. And, of couse, the official Samba Wiki.

 

With your editor, open up smb.conf

sudo vi /etc/samba/smb.conf

 

You can read around and change, by example the Workgroup if you want.

On the [GLOBAL] section, add the following line just before the [homes] section

 

load printers = yes

 

And, in the [printers] (there's also a [print$] section - NOT THAT ONE) section, change the following line:

guest ok = no

to

guest ok = yes

 

Save the file and let's enable and start samba

sudo systemctl enable smbd
Synchronizing state of smbd.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable smbd

 

Let's start samba

sudo systemctl start smbd

Let's add the printer to Windows

 

Go to Control Panel -> Devices and Printers and press the "Add a printer" button.

 

image

 

In the next screen you'll see some printers available. Just press "The printer that I want isn't listed".

image

In the next screen, we have two options to add the printer connected to the Raspberry PI.

We can use the third option - "Select a shared printer by name" or the last one - "Add a local printer or network printer with manual settings".

 

Both will be using the same parameters and the same printer path, the former with less steps. The main difference between them is that, using the third option - Select a shared printer by name - will not allow you to change the printer's name.

image

When using the third option, on the final screen - you can't change the printer's name.

image

Let's continue by choosing the last option.  Create a new port with Local Port as the type of port

image

Now, enter the path to the printer.

The path is: \\<raspberry_pi_IP_OR_DNS>\<printer_name>

image

 

Next, Windows will ask you to select a driver for the printer.

image

 

On the next screen, choose a name for the printer

image

 

Now you have the option to share the printer - you can shared it if you like or need.

image

Final screen.

image

As you can see, all the options are the same as if a local printer is installed.

image

 

And, just like this, you can turn an old printer, a printer without network or a networked printer without network wall socket into a shared printer with wifi ! image

  • Sign in to reply

Top Comments

  • mp2100
    mp2100 over 4 years ago +2
    This is a good idea. I occasionally find myself at remote offices, where I don't have access to their network, and need to print a PDF document. I have a CUPS server running on a Pi at home, this is a…
  • DAB
    DAB over 4 years ago +2
    Nice project. DAB
  • colporteur
    colporteur over 4 years ago +2
    Pi as a wireless print server, cool. What operating system are you running on the Pi? What hardware is PiW referring to? Any of the Pi's that support wireless? Would this include the PiZeroW?
  • dougw
    dougw over 2 years ago

    Good app for a W ...

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • NaiJIW
    NaiJIW over 3 years ago

    Good Job

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Former Member
    Former Member over 3 years ago

    There was no driver for Samsung ML-2510, but found a fix on Raspberry forums.

    The fix was to install:

    sudo apt update

    sudo apt install printer-driver-splix

    forums.raspberrypi.com/viewtopic.php

    There's an entire list of supported printers besides this one.

    Also, when finished I could do test print and from notepad++ but not from a pdf.

    Rebooting windows 11 and then printing from pdf also worked.


    As an aside, I installed all this on Raspberry Pi Zero with a USB Mini Hub with OTG
    from Adafruit: www.adafruit.com/.../2991
    The EDUP wifi dongle and the usb printer cable are both plugged into it.
    I think means that a non-wifi zero will work just fine. It has for me so far.

    This is a great article, thanks for the posting!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • for_trials_76
    for_trials_76 over 3 years ago

    Thank for you a great tutorial. I have a HP P1108 which was not listed tried other printer but it had not worked.

    We would need to install HPLIP

    sudo apt-get install hplip

    sudo hp-plugin

    (in options select any default options e.g. d for download)

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • jonchandler
    jonchandler over 4 years ago in reply to jonchandler

    All fixed now.  Please forgive my (what turned out to be) a stupid question.

     

    In the wpa_supplicant.conf file, for our wifi,

     

    PAIRWISE=TKIM rather than CCMP

     

    so I was not getting on the wifi network.  Coincidentally, another PI on the network somehow showed up with two IP addressed when I scanned the network for devices, so when I thought I was on the network but couldn't log in, it was a different device.

     

    Dumb on several levels! 

     

    Thanks for the help,

     

    Jon

     

     

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube