A print server that gets attached to a USB printer and shares its printing capability over the network using WiFi 📶
-
- Printer with USB cable - Of course :)
- Working Wifi AP at home - Should I even need to mention this? :P
-
- Monitor with HDMI support
- Standard HDMI cable
- Keyboard
- Micro SD card Adapter/SD card Reader
- A PC or Laptop with Mac/Linux/Windows OS
-
-
Banana Pi M2 Zero
- Allwinner H3/H2+ Quad-core Cortex-A7 H265/HEVC 1080P CPU
- Mali400MP2 GPU @600MHz, Supports OpenGL ES 2.0
- 512 MB DDR3 (shared with GPU)
- Upto 64 GB SD card support
- Onboard WiFi and Bluetooth with SDIO AP6212 chip
- Audio/Video output from the Mini HDMI 1.4 port, supports 1080P@30fps
- Micro USB DC power supply 5V/2A
- Micro USB 2.0 OTG for data transfer
- Power Button
- Reset Button
- Power LED/Status LED
- U.fi antenna connector
-
-
- A Banana Pi M2 Zero compatible Linux image. Here I am using Debian 11 (BullsEye) from the Current (main) branch with 5.10.60 Mainline kernel and Armbian 21.08.1 build script. Debian BullsEye is the stable Debian release at the time of writing this article. Armbian Archive Source
- Tool for Flashing Linux image to SD card balenaEtcher / Raspberry Pi Imager
- Printer drivers for Linux on ARM CPU - IMPORTANT
⚠️ - I used the HP Laserjet Professional m1136 MFP printer for this setup.
- HP Printer drivers for Debian can be installed from
- apt package manager
sudo apt install hplip
- apt-get package manager
sudo apt-get install hplip
- SourceForge hplip
- apt package manager
- You should check your printer website for driver availability and installation. Alternatively, you can check Open Printing PPD or foo2zjs for driver files and installation.
-
- Download the Debian image on your PC/Laptop. I'll add the image that I used for this setup in the repository. You can check out the Armbian GitHub repository and build your image. They also provide official images for most SBCs on their website. If one is not available you can also check out the archives.
- Download balenaEtcher or Raspberry Pi Imager for your OS and install it on your PC/Laptop.
-
- Insert the SD card in the micro SD card adapter/SD card reader and attach it to your PC/Laptop.
- Format the SD card. - Optional:question:
- Mac
- Open Terminal.
- Run
diskutil list
. - Look for the disk identifier that contains the SD card. It should be in the format
/dev/diskX
where X will be a number. - Run
diskutil eraseDisk FAT32 UNTITLED MBRFormat /dev/diskX
after replacing X with the disk number. (CAUTION:exclamation: - Verify the selected disk before running.)
- Linux
- Open Terminal.
- Check the device name with
lsblk
. It should be in the format ofsdX
ormmcblkX
where X is the disk identifier. - Run
fdisk /dev/sdX
orfdisk /dev/mmcblkX
. - Enter
d
until all existing partitions are deleted. - Enter
o
to create a new DOS partition table. - Enter
n
to create a new partition and accept all default values by pressing enter. - Enter
t
to select the partition and then Enter 7 to select the exFAT file system. - Enter
w
to save changes and quit. (CAUTION:exclamation: - Verify the selected disk before running.) - Run
sudo mkfs.exfat -n "SDCard" /dev/sdX1
orsudo mkfs.exfat -n "SDCard" /dev/mmcblkXp1
after replacing X with the disk identifier. This process will write the exFAT filesystem.
- Windows
- Open Command Prompt using Run as Administrator.
- Run
diskpart
to open the Microsoft DiskPart interactive utility. - Run the
list disk
command and look for the disk number where the SD card is present. - Run
select disk X
where X is the disk number. - Run
clean
to empty the SD card. (CAUTION:exclamation: - Verify the selected disk usinglist disk
before cleaning. Selected Disk will be marked with an "*".) - Run
convert mbr
will convert it to Master Boot Record. - Run
create partition primary
to create a new partition with all the available space. - Run
select partition 1
to select the newly created partition. - Run
active
to activate the MBR partition. - Run
format fs=exfat label=SDCard quick
to quick format the partition to the exFAT filesystem and rename it to SDCard. You can enter any label of your choice. - Run
assign
to assign a Drive letter. - Run
exit
to close the DiskPart utility.
- Mac
- Open balenaEtcher/Raspberry Pi Imager on your PC/Laptop.
- Select the Debian image which will be written on the SD card.
- Select the SD card to write. (CAUTION:exclamation: - Verify the selected disk is the SD card and not any other disk before proceeding.)
- Click on the Flash/Write button to start the process. (CAUTION:exclamation: - All existing data on the SD card will be formatted.)
- Wait for the write and verification process to complete and then eject the SD card. We now have our Operating System ready for the Banana Pi M2 Zero.
-
-
- Open your router setup page in a web browser. It is usually located at
192.168.1.1
,192.168.0.1
,192.168.1.100
, or10.0.0.1
. - Login to your router web page and find the settings for LAN or DHCP server.
- Check if your DHCP server is enabled and check the DHCP server pool settings.
- Change the start IP address to leave one address unassignable by DHCP. For example, if the DHCP start IP address was
192.168.1.2
then change it to192.168.1.3
. This way the DHCP server cannot assign the192.168.1.2
address to any of the devices connected to your home network. We can now use this address as a static IP for our print server.
Original Router Configuration Updated Router Configuration - Open your router setup page in a web browser. It is usually located at
-
- Stick the Heak sink on top of the Banana Pi M2 Zero's H3/H2+ processor to prevent the board from overheating.
- If your Printer and Router/Wireless AP are far apart, you might need to connect an external antenna to the Pi's U.fi/IPEX connector. Check the Further Enhancements section for the antenna details.
- Insert the SD Card with the flashed image into the
MICRO_SD
port of the Banana Pi M2 Zero. - Take the micro USB-B Male to USB-A Female Adapter and connect a USB keyboard to the USB-A side. Connect the micro USB side of the adapter to the
OTG
port of the Banana Pi M2 Zero. - Connect the micro USB power supply to the
DC_IN
port of the Banana Pi M2 Zero. - Connect the mini HDMI adapter to one end of the HDMI cable and insert it into the
HDMI
port on the Banana Pi M2 Zero. Connect the other end of the HDMI cable to the monitor. - After completing this setup turn on the monitor and Banana Pi M2 Zero's power supply.
- The Pi's LED will blink once and then stay turned on. Subsequently, the boot process will begin and the output should be visible on the monitor.
-
- Root password setup and Create a new user.
-
- Setup Static IP on Pi.
-
- Connect to WiFi
- reboot
- pi should be automatically connected to the router with the static IP. Check the router web page to confirm.
-
- Check if ssh is installed and running else install ssh.
- Disconnect the keyboard from the USB-A side of the adapter and connect the USB printer
- Disconnect the monitor from the mini HDMI port.
- ssh into the pi from the PC/Laptop using user creds.
-
- update and upgrade
- reboot
- ssh again
- install hplip
-
- install SAMBA
- Setup smbd.conf file
guest ok = yes
read only = no
- restart samba
-
- Add our print user to the
lpadmin
user group. sudo cupsctl --remote-admin --remote-any --share-printers
- Note: If the first print job since power on completes successfully but the subsequent ones fail then run this command
lpadmin -p PRINTERNAME -o usb-no-reattach-default=true
- setup cupd.conf file
- restart cups
- Add our print user to the
-
- Run the CUPS web interface on the browser
- Add the printer
- Setup default options
-
- run hp-setup -i
- install hp plugin
- reboot pi
-
-
- Install RJ45 port for Ethernet connectivity. Socket Reference, Enable Port in OS, Buy RJ45 port
- Add U.fi/IPEX to SMA antenna for better 2.4GHz WiFi connectivity. Buy a 2.4GHz antenna
- Add LEDs for showing boot sequence and Network connectivity. GPIO Reference
- Setup using BuildRoot. buildroot.org, WiFi Packages, BuildRoot GitHub
- Headless Initial Setup with Debian image. (Configure WiFi connectivity, Configure Static IP, Enable ssh with username and password) - Research Required 😓
- BalenaOS and Cloud deployment looks quite promising.
- SSH and CUPS print outside of the local network. Requires Dynamic DNS for handling public IP. Setup port forwarding on the router. Change the default SSH and CUPS ports.
- Set up Avahi daemon/Bonjour for automatic printer discovery on other devices.
- Access the scanner functionality of a Multifunction printer over the network using SANE. SANE Reference, SANE Frontend
-
-
Android
Use Let's Print Droid instead of the default android printing service to mitigate the below issues. Add your printer as a new CUPS server with the static IP and share all the prints to this app. Make sure the Page Description Language is selected as RAW.Page margin error. Content gets cut on the right side of the page for some PDFs that are not in A4 size. - PortraitPage margin error. Content gets cut on the bottom of the page PDFs/images. - LandscapeIf a captured image is converted to PDF using Adobe scan, Camscanner, or similar apps and filters are applied then printing such PDFs results in garbage prints.
-
iOS/iPadOS
Testing in progress -
macOS
Testing in progress -
Linux
Testing in progress -
Windows
Testing in progress
-