This repository contains the configuration and software for transforming a Raspberry Pi into a headless print server and web-based scanning dashboard. The system provides a centralized interface for printing and scanning
The printer web dashboard enables:
- Initiating Scans
- Managing Scanned Documents
- Viewing Storage Usage
- Monitoring Ink/Toner Levels
- Restarting CUPS or the Pi
It can be accessed via either:
http://<hostname>.localhttp://<pi-ip>.local
If you do not want to use the default port 80 - edit the last line of ./print-dashboard/app.py to your preferred port e.g. 5000
- Hardware Mutex: Uses
threading.Lock()to prevent ink polling conflicts during scanning. - Data Persistence: Dual-layer cache ensures hardware info remains visible during low-power states.
- Pre-Scan Routine: Automatically terminates background status processes (
pkill) to clear the USB interface.
- Raspberry Pi: Optimized for the Raspberry Pi Zero 2W, but compatible with Pi 4/5
- Printer: HP DeskJet 2300 Series (or any HP printer supported by HPLIP)
- Connectivity: The printer must be plugged directly into the Raspberry Pi via a USB OTG adapter or standard USB cable
📦Print-Server
┣ 📂images
┃ ┗ 📜screenshot.jpeg
┣ 📂print-dashboard
┃ ┣ 📂static
┃ ┃ ┣ 📂css
┃ ┃ ┃ ┗ 📜style.css
┃ ┃ ┣ 📂js
┃ ┃ ┃ ┗ 📜script.js
┃ ┃ ┗ 📂scans
┃ ┃ ┃ ┗ 📜.gitkeep
┃ ┣ 📂templates
┃ ┃ ┗ 📜index.html
┃ ┣ 📜app.py
┃ ┗ 📜utils.py
┣ 📜.gitignore
┣ 📜install.sh
┣ 📜LICENSE
┗ 📜README.md
- Step 1: OS & Hardware Setup
- Step 2: Client Connection (Windows Setup)
- Step 3: Dashboard Installation
Networking Note: It is highly recommended to assign a static IP to your Pi via your router's DHCP reservation settings. In addition to using the hostname configured below (e.g., http://print-server.local)
Note: Not required if you already configured the hostname during imaging
sudo raspi-config # Navigate to System Options -> HostnameEnabling Root SSH Access:
Note: Not required if configured during imaging or using direct monitor access
- Install micro (highly recommended over nano):
sudo apt install micro - Set a password:
sudo passwd root - Modify the SSH configuration:
sudo micro /etc/ssh/sshd_config - Locate
PermitRootLoginand change it toyes - Restart the SSH service:
sudo systemctl restart ssh
Note: Some of these packages are installed with the default Pi image and will be "set to manually installed" - included for completeness
sudo apt update && sudo apt upgrade -y
sudo apt install cups hplip sane-utils imagemagick python3-flask micro git -y
# Add user to administrative groups
sudo usermod -a -G lpadmin $USER
sudo usermod -a -G scanner $USER
# Allow remote management
sudo cupsctl --remote-any
sudo systemctl restart cupsAccess at: http://<hostname>.local:631 or http://<pi-ip>:631
- Click Administration in the navbar (log in with your Pi user/password)
- Click Manage Printers
- You should see your printer there
If you do not see your printer continue to the next step below
YOU DO NOT NEED TO DO THIS IF THE PRINTER WAS AUTOMATICALLY ADDED
CUPS should detect the USB printers automatically. If it does not, generating a specific HP URI (via the HPLIP drivers) is the most reliable way to do so
-
Identify the USB Bus: Run
lsusband look for your HP Printer.
Example output:
Bus 001 Device 002: ID 03f0:ef11 HP, Inc DeskJet 2300 series -
Generate the URI: Use the Bus and Device numbers found above.
sudo hp-makeuri 001:002 # Replace 001:002 with your specific IDs -
Note the Output: Copy the string (e.g.
hp:/usb/DeskJet_2300_series?serial=CN5815BKBQ) - you'll need it for the CUPS web interface
Go back to the cups Administration page - as in 3. Check Printer via CUPS Management Page
- Click Add Printer
- Select Other Network Printers > AppSocket/HP JetDirect or paste your URI directly into the connection field
- Ensure "Share This Printer" is checked
- Note: You cannot change the name of the printer after creation, so choose something you will be happy with
- Open Printers & Scanners and click Add device
- Find your printer and click Add Device
- Click "The printer that I want isn't listed"
- Select "Select a shared printer by name"
- Enter URI:
http://<your-pi-ip>:631/printers/<printer_name_in_cups>
Note: this is why we want the printer to have a static IP
- Find your model under the manufacturer's tab
- If not present, click Windows Update - this will take a while so be patient
- Select the correct driver from the updated list
If the driver is missing even after a Windows Update:
- Download the HP Driver Installer for your model
- Press
Win + R, type%temp%, and hitEnter - Optionally: Delete all the files you can to simplify the search (skip those you can't)
- Run the HP Driver Installer - while the installer is open, return to the
%temp%folder - Search for
*.infand locate the folder containing your driver (e.g.,HPWia_DJ2300.inf) - open the file properties and look at the location in the window - In the Windows Add Printer wizard, click Have Disk... and browse to that the folder's location seen in the file properties
git clone <your-repo-url>
cd Print-Server
chmod +x install.sh
sudo ./install.shIf you prefer to set it up manually, copy the files to /opt and create the service:
sudo mkdir -p /opt/print-dashboard
sudo cp -r ./print-dashboard/* /opt/print-dashboard/
sudo micro /etc/systemd/system/print-monitor.servicePaste and save the following:
[Unit]
Description=Print and Scan Dashboard
After=network.target
[Service]
ExecStart=/usr/bin/python3 /opt/print-dashboard/app.py
WorkingDirectory=/opt/print-dashboard
User=root
Restart=always
[Install]
WantedBy=multi-user.targetFinalize the service:
sudo systemctl daemon-reload
sudo systemctl enable print-monitor
sudo systemctl start print-monitor# Check if the service is active
sudo systemctl status print-monitor
# Watch real-time logs for debugging
sudo journalctl -u print-monitor -f- Permissions:
Ensure the scan directory is writable:sudo chmod -R 777 /opt/print-dashboard/static/scans
(This is done in theinstall.shscript for you) - Headless Operations:
Hardware status warnings are redirected to/dev/nullto keep logs clean
