Skip to content

A print server that gets attached to a USB printer and shares its printing capability over the network using WiFi.

Notifications You must be signed in to change notification settings

shivammaggu/bananapi-m2-zero-print-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

A Custom Print Server using Banana Pi M2 Zero

A print server that gets attached to a USB printer and shares its printing capability over the network using WiFi πŸ“Ά

Contents

  1. Requirements

    1. Standard Requirements

    2. Hardware Requirements for initial setup

    3. Hardware Requirements for Print Server

    4. Software Requirements for Print Server

  2. Setup

    1. Software Setup

    2. Hardware Setup

    3. Print Server Setup

  3. Usage

    1. Android

    2. iOS/iPadOS

    3. macOS

    4. Linux

    5. Windows

  4. Notes

    1. Documents

    2. Links

    3. Further Enhancements

    4. Known Issues

Requirements ✍️

  • Standard Requirements πŸ–¨οΈ

    • Printer with USB cable - Of course :)
    • Working Wifi AP at home - Should I even need to mention this? :P
  • Hardware Requirements for initial setup πŸ–₯️

    • Monitor with HDMI support
    • Standard HDMI cable
    • Keyboard
    • Micro SD card Adapter/SD card Reader
    • A PC or Laptop with Mac/Linux/Windows OS
  • Hardware Requirements for Print Server 🧰

    • Banana Pi M2 Zero
      Board Features
      • 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
      Where to buy
  • Software Requirements for Print Server πŸ’»

    • 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
        1. apt package manager sudo apt install hplip
        2. apt-get package manager sudo apt-get install hplip
        3. SourceForge hplip
      • 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.

Setup πŸ› οΈ

  • Software Setup πŸ§‘β€πŸ’»

  • Hardware Setup πŸ§‘β€πŸ”§

    • 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
        1. Open Terminal.
        2. Run diskutil list.
        3. Look for the disk identifier that contains the SD card. It should be in the format /dev/diskX where X will be a number.
        4. Run diskutil eraseDisk FAT32 UNTITLED MBRFormat /dev/diskX after replacing X with the disk number. (CAUTION:exclamation: - Verify the selected disk before running.)
      • Linux
        1. Open Terminal.
        2. Check the device name with lsblk. It should be in the format of sdX or mmcblkX where X is the disk identifier.
        3. Run fdisk /dev/sdX or fdisk /dev/mmcblkX.
        4. Enter d until all existing partitions are deleted.
        5. Enter o to create a new DOS partition table.
        6. Enter n to create a new partition and accept all default values by pressing enter.
        7. Enter t to select the partition and then Enter 7 to select the exFAT file system.
        8. Enter w to save changes and quit. (CAUTION:exclamation: - Verify the selected disk before running.)
        9. Run sudo mkfs.exfat -n "SDCard" /dev/sdX1 or sudo mkfs.exfat -n "SDCard" /dev/mmcblkXp1 after replacing X with the disk identifier. This process will write the exFAT filesystem.
      • Windows
        1. Open Command Prompt using Run as Administrator.
        2. Run diskpart to open the Microsoft DiskPart interactive utility.
        3. Run the list disk command and look for the disk number where the SD card is present.
        4. Run select disk X where X is the disk number.
        5. Run clean to empty the SD card. (CAUTION:exclamation: - Verify the selected disk using list disk before cleaning. Selected Disk will be marked with an "*".)
        6. Run convert mbr will convert it to Master Boot Record.
        7. Run create partition primary to create a new partition with all the available space.
        8. Run select partition 1 to select the newly created partition.
        9. Run active to activate the MBR partition.
        10. 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.
        11. Run assign to assign a Drive letter.
        12. Run exit to close the DiskPart utility.
    • 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.
  • Print Server Setup πŸ‘Ύ

    • Router Configuration
      • 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, or 10.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 to 192.168.1.3. This way the DHCP server cannot assign the 192.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 config updated config
      Original Router Configuration Updated Router Configuration
    • Banana Pi Hardware Configuration
      • 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.
    • Debian OS Configuration
      • Root password setup and Create a new user.
    • Static IP Configuration
      • Setup Static IP on Pi.
    • WiFi Configuration
      • Connect to WiFi
      • reboot
      • pi should be automatically connected to the router with the static IP. Check the router web page to confirm.
    • SSH Configuration
      • 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.
    • HP Driver Configuration
      • update and upgrade
      • reboot
      • ssh again
      • install hplip
    • SAMBA Configuration
      • install SAMBA
      • Setup smbd.conf file guest ok = yes read only = no
      • restart samba
    • CUPS Configuration
      • 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
    • Printer Configuration
      • Run the CUPS web interface on the browser
      • Add the printer
      • Setup default options
    • HP Driver Plugin Configuration
      • run hp-setup -i
      • install hp plugin
      • reboot pi

Usage πŸ‘‡

  • Android ▢️

  • iOS/iPadOS πŸ“±

  • macOS ο£Ώ

  • Linux 🐧

  • Windows πŸͺŸ

Notes πŸ“