WiFi Print Server: From a Raspberry Pi Zero W to Windows 10/11

by brighterfusion in Circuits > Raspberry Pi

11346 Views, 6 Favorites, 0 Comments

WiFi Print Server: From a Raspberry Pi Zero W to Windows 10/11

20220324_211159.jpg

Make your USB printer into a WiFi connected printer which can been seen from Windows.

This is an updated guide for 2022 and will work where older guides may not due to changes in Windows protocols.

I've tried to make this guide as simple as possible. I found that it was more work to try to make the printer appear in the File Manager under Network than it was to add it using the command prompt.

[If you're really interested in making the print server and its printer appear while browsing the Network in Windows, look into putting WSDD on the RPi and possibly turning on SMB1.0 in Windows Features. SMB1.0 is a security hazard.]

Supplies

20220324_211148.jpg
20220405_014820.jpg

RPi Zero Wireless with a case.

Fast, not-too-big MicroSD Card:

Cables:

  • MicroUSB power supply. I plugged the RPi into my tower's USB out, but that will require the PC to be on for the printer to be available.
  • MicroUSB OTG short cable:
  • https://amzn.com/dp/B00N9S9Z0G
  • Original USB cable for printer.

Prepare the MicroSD Card

Raspberry Pi Imager v1.7.1 3_20_2022 1_53_09 PM.png
Raspberry Pi Imager v1.7.1 3_20_2022 1_53_41 PM.png
Raspberry Pi Imager v1.7.1 3_20_2022 1_54_50 PM.png
C__Users_sb_Desktop_RPi 3_20_2022 2_07_19 PM.png

Naming:

  • For this guide, I'll be naming things as follows. Every time you see one of these names, replace it with your own.
  • pi = username on the RPi
  • print-server = the computer name of the RPi
  • sam = the printer queue name of my Samsung Printer
  • RPi is short for Raspberry Pi.


Download RPi Imager:

https://www.raspberrypi.com/software/

Launch. Select the desired OS image. (I chose RPi OS Lite, 32-bit, for the Zero.)

Click the gear icon to get to Advanced Options. Scroll to see all options.

  1. Turn on SSH.
  2. Hostname to "print-server".
  3. Set RPi un and pw. We are using "pi" for the username.
  4. Set Wifi, using 2.4 signal if you're using a Zero.
  5. Set locale.

"WRITE" OS to the card.

Go make coffee.

Initialize the RPi and Install Packages

Insert SD card into the RPi and power up. Give it a few minutes.

Find the IP address for printer-server on the router's LAN > DHCP page. Give it a fixed IP.

SSH into the RPi from Windows:

Open command prompt by typing: ⊞ Win+R > cmd > press Enter.

Copy and paste this command, replacing the username (pi) and server name (print-server) with your own:

ssh pi@print-server

Type in the password. Then you should be at the RPi's prompt.


For the rest of the guide, copy each of my example lines one by one and paste them into the SSH window. To paste inside the SSH environment, right-click and choose paste from the contextual menu.

Update and upgrade. You should go make some soup.

sudo apt update -y && sudo apt upgrade -y


Install the CUPS print server and SAMBA file sharing packages. This will take a several additional minutes.

sudo apt install -y cups samba

Config CUPS

Add an administrative user for the printer. Replace pi with your username.

sudo usermod -a -G lpadmin pi


Enable web-based admin pages.

sudo cupsctl --remote-any


Restart CUPS.

sudo systemctl restart cups

Config SAMBA

Edit config file:

sudo nano /etc/samba/smb.conf


Go to the bottom of the file. Ctl-V jumps you down one page at a time.

Under [printers]:

guest ok = yes


Under [print$]:

read only = no


Ctl-X, Y, Enter to save and exit nano.

Restart Samba service.

sudo systemctl restart smbd

On CUPS Config Web Site

Add Printer - CUPS 2.3.3op2 - Google Chrome 3_22_2022 9_38_50 PM.png
Add Printer - CUPS 2.3.3op2 - Google Chrome 3_22_2022 9_41_21 PM.png
Add Printer - CUPS 2.3.3op2 - Google Chrome 3_22_2022 9_41_41 PM.png
Add Printer - CUPS 2.3.3op2 - Google Chrome 3_22_2022 9_41_47 PM.png
  1. Shut down the RPi politely.
sudo shutdown now
  1. Plug the printer in with the USB OTG cable. Power up the print server. Turn on the printer.
  2. Go to the CUPS config web page: https://print-server:631/admin/
  3. Click through the warning about an insecure HTTPS connection.
  4. "Not Private" > Advanced > Proceed.
  5. Click the "Add Printer" button.
  6. Log in using your RPi un (pi) and pw.
  7. Select your printer from local printers. Continue.
  8. Fill out names as you prefer. I named my printer "sam". Check "Share This Printer". Continue.
  9. Find your Make. I uploaded a PPD file for a similar model Samsung printer (Samsung-M2022W-splix.ppd) which I dug up from a Google-cached version of a page on OpenPrinting.org. Continue.
  10. Set printer options. I kept defaults.
  11. Now you're under Printers menu. Administration pulldown > Set as server default.
  12. You're done here.

On the Windows PC

C__Users_sb_Videos_Captures 3_24_2022 9_38_46 PM.png
Local Group Policy Editor 3_24_2022 9_40_03 PM.png
Local Group Policy Editor 3_24_2022 9_39_37 PM.png
__PRINT-SERVER 3_20_2022 3_39_04 PM.png
__PRINT-SERVER 3_20_2022 8_51_51 PM.png
Settings 3_24_2022 9_26_27 PM.png

Enable the insecure guest logon:

  • ⊞ Win+R > gpedit.msc
  • Local Computer Policy > Computer Configuration > Administrative Templates > Network > Lanman Workstation > Enable insecure guest logons > Enabled > OK.


Use the Windows command line to add the new network printer. Remember to use your own names for the server (print-server) and printer (sam).

  • Win-R, cmd, then:
rundll32 printui.dll PrintUIEntry /in /n \\print-server\sam
  • Choose a print driver using the wizard.
  • Set as the default printer in Windows. Print a test page.
  • You're done! Good job.

Back Up Your New MicroSD Card

Win32 Disk Imager - 1.0 4_1_2022 11_36_37 PM.png

Now that you're finished with the installation and configuration, it's a wise idea to make a .img backup of the card. In Windows, use the "READ" function of Win32 Disk Imager. (I had to quit out of Google Drive before that app would open in Windows 11.)

For me, the writing process took a bit over one minute per GB to complete. (I recommend a 16GB card because a bigger card will only take longer to write the OS to and to back up, and will forever take up more storage space for the backup img.)

In case of need, you can use RPi Imager to burn that .img file to a new MicroSD card and you'll be back in business.

How to Label Your Tiny SD Cards

20220402_145315.jpg
20220402_145324.jpg
20220402_150642.jpg

Wrap a 9mm label maker tape around the end and use it as a handle to remove the card.

Much Thanks To: