This guide walks you through installing, configuring, and using PiLink from start to finish.
- Prerequisites
- Hardware Setup
- PC Setup (Windows)
- Raspberry Pi Setup
- Configuration
- Starting PiLink
- Using the Interface
- Performing Transfers
- Troubleshooting
- Maintenance
- Raspberry Pi (3B+ or newer recommended)
- MicroSD card (16GB minimum, 32GB+ recommended)
- USB flash drive (8GB minimum)
- Ethernet cable (for direct PC-to-Pi connection)
- Power supply for Raspberry Pi
- Windows PC with Ethernet port
- Raspberry Pi OS Lite (64-bit recommended)
- FileZilla Server (for Windows PC)
- Python 3.8+ (comes with Raspberry Pi OS)
- Git (for cloning the repository)
- Insert MicroSD card into your Raspberry Pi
- Connect Ethernet cable directly between your PC and Raspberry Pi (no router/switch needed)
- Insert USB flash drive into Raspberry Pi USB port
- Connect power supply to Raspberry Pi
Important: The Ethernet cable should connect ONLY your PC and Pi. Do not connect through a router or switch for the initial setup.
- Open Control Panel → Network and Sharing Center → Change adapter settings
- Right-click your Ethernet adapter → Properties
- Select Internet Protocol Version 4 (TCP/IPv4) → Properties
- Select Use the following IP address:
- IP address:
192.168.50.1 - Subnet mask:
255.255.255.0 - Default gateway: (leave blank)
- DNS servers: (leave blank)
- IP address:
- Click OK to save
- Download FileZilla Server from: https://filezilla-project.org/download.php?type=server
- Install FileZilla Server with default settings
- Launch FileZilla Server Interface
- In FileZilla Server Interface, click Edit → Users
- Click Add to create a new user:
- Username:
pilink - Password: (choose a secure password, you'll need this later)
- Click OK
- Username:
- In the Shared folders section:
- Click Add under Directories
- Browse to a folder where you want to share files (e.g.,
C:\PiLinkShare) - Set permissions: Read and Write (check both boxes)
- Click OK
- Click OK to save user settings
- Click Edit → Settings → General settings
- Listen on these IP addresses:
192.168.50.1 - Port:
21 - Click OK
- Listen on these IP addresses:
Create these folders on your PC:
C:\PiLinkShare\downloads- Files you want to transfer TO the flash driveC:\PiLinkShare\uploads- Destination for files FROM the flash drive
Note: Update FileZilla Server user permissions to include both folders with read/write access.
- Open Windows Defender Firewall → Advanced settings
- Click Inbound Rules → New Rule
- Select Port → Next
- Select TCP, enter port
21→ Next - Select Allow the connection → Next
- Check all profiles → Next
- Name: "FileZilla FTP Server" → Finish
- Download Raspberry Pi Imager from: https://www.raspberrypi.com/software/
- Insert your MicroSD card into your computer
- Open Raspberry Pi Imager:
- Click Choose OS → Raspberry Pi OS (other) → Raspberry Pi OS Lite (64-bit)
- Click Choose Storage → Select your MicroSD card
- Click the gear icon (⚙️) to configure:
- Enable SSH
- Set username:
pi(or your preferred username) - Set password: (choose a secure password)
- Configure wireless LAN: (optional, not needed for Ethernet)
- Click Write to flash the OS
-
Boot the Raspberry Pi and connect via SSH:
ssh pi@raspberrypi.local
Or if that doesn't work, find the IP address from your router and connect:
ssh pi@<pi-ip-address>
-
Edit the network configuration:
sudo nano /etc/dhcpcd.conf
-
Add these lines at the end of the file:
interface eth0 static ip_address=192.168.50.2/24 static routers=192.168.50.1 -
Save and exit (Ctrl+X, then Y, then Enter)
-
Reboot:
sudo reboot
-
After reboot, SSH back into the Pi
-
Clone the PiLink repository:
cd /opt sudo git clone <your-repo-url> pilink
Or if you have the files locally, copy them:
sudo mkdir -p /opt/pilink # Copy all PiLink files to /opt/pilink -
Run the setup script:
cd /opt/pilink sudo chmod +x scripts/setup_pi.sh sudo ./scripts/setup_pi.shThis script will:
- Install required system packages (Python, lftp, vsftpd, etc.)
- Install Python dependencies
- Copy configuration template
- Install systemd services
- Install udev rules for USB mounting
-
Wait for the setup to complete (may take 5-10 minutes)
-
Open the configuration file:
sudo nano /etc/pilink.yaml
-
Update the following sections:
PC FTP Connection:
pc_endpoints: - name: "default_pc" host: "192.168.50.1" # Your PC's IP address port: 21 username: "pilink" # FileZilla Server username password: "your-password" # FileZilla Server password download_root: "/downloads" # Path on PC for files to transfer TO flash upload_root: "/uploads" # Path on PC for files FROM flash
Paths (adjust if needed):
paths: staging_root: "/data" pc_inbox: "/data/pc_inbox" flash_outbox: "/data/flash_outbox" flash_mount: "/mnt/flash" flash_transfer_root: "/mnt/flash/transfers"
USB Flash Drive:
flash_drive: min_required_gb: 8 # Minimum flash drive size
-
Save and exit (Ctrl+X, then Y, then Enter)
sudo mkdir -p /data/pc_inbox /data/flash_outbox /data/logs /mnt/flash
sudo chown -R pi:pi /dataTest that the Pi can connect to your PC:
lftp -u pilink,your-password -e "ls; quit" 192.168.50.1You should see a directory listing. If not, check:
- PC firewall settings
- FileZilla Server is running
- IP addresses are correct
- Username/password are correct
PiLink is configured to start automatically on boot. Simply reboot:
sudo rebootAfter reboot, the PiLink blue-screen interface will appear automatically.
If you need to start manually:
-
Start the USB watcher service:
sudo systemctl start pilink-usb-watcher.service
-
Start the UI:
python3 -m pilink.ui.app --config /etc/pilink.yaml
# Check if services are running
sudo systemctl status pilink-ui.service
sudo systemctl status pilink-usb-watcher.service
# View logs
sudo journalctl -u pilink-ui -f
sudo journalctl -u pilink-usb-watcher -fWhen PiLink starts, you'll see a blue-screen interface with:
-
Status Panel (top):
- Flash drive status (mounted, capacity, free space)
- PC connection status (online/offline)
- Last transfer information
-
Main Menu (center):
1- Computer → Flash: Transfer files from PC to flash drive2- Flash → Computer: Transfer files from flash drive to PCL- View Logs: Display recent transfer logsP- Prune Staging: Clean up old staging filesQ- Quit: Exit to shell
- Use Arrow Keys to navigate menus
- Press Enter to select
- Press Esc to go back
- Press Q to quit
Purpose: Copy files from your PC to the USB flash drive via the Raspberry Pi.
Steps:
-
On the main menu, select
1 - Computer → Flash -
The system will:
- Connect to your PC via FTP
- List available files in the PC's download folder
- Show transfer progress
-
Files are automatically:
- Downloaded to
/data/pc_inbox/<timestamp>on the Pi - Copied to
/mnt/flash/transfers/<timestamp>on the flash drive - Verified with checksums
- Downloaded to
-
Monitor progress:
- Transfer speed (MB/s)
- Files transferred
- Time remaining
- Status messages
-
When complete:
- You'll see a success message
- Files are on the flash drive
- Press Esc to return to main menu
What happens behind the scenes:
- Pi connects to PC FTP server
- Downloads all files from PC's
/downloadsfolder - USB watcher automatically detects new files
- Copies files to flash drive
- Generates checksums for verification
Purpose: Copy files from the USB flash drive to your PC via the Raspberry Pi.
Steps:
-
On the main menu, select
2 - Flash → Computer -
Browse flash drive contents:
- Use arrow keys to navigate
- Press Space to select files/folders
- Press Enter to confirm selection
-
Select destination on PC:
- Choose from configured PC endpoints
- Or specify a custom path
-
The system will:
- Copy selected files to staging area
- Upload to PC via FTP
- Verify transfer with checksums
-
Monitor progress:
- Upload speed
- Files uploaded
- Progress bar
-
When complete:
- Success message appears
- Files are on your PC
- Press Esc to return to main menu
What happens behind the scenes:
- Pi reads selected files from flash drive
- Copies to
/data/flash_outbox/<timestamp> - Connects to PC FTP server
- Uploads files to PC's
/uploadsfolder - Verifies transfer integrity
Solution:
# Check service status
sudo systemctl status pilink-ui.service
# Check if service is enabled
sudo systemctl is-enabled pilink-ui.service
# Enable and start manually
sudo systemctl enable pilink-ui.service
sudo systemctl start pilink-ui.service
# Check logs
sudo journalctl -u pilink-ui -n 50Checklist:
- Verify Ethernet cable is connected
- Check IP addresses:
# On Pi ip addr show eth0 # Should show 192.168.50.2 # On PC ipconfig # Should show 192.168.50.1
- Test connectivity:
ping 192.168.50.1
- Verify FileZilla Server is running on PC
- Test FTP connection:
lftp -u pilink,password -e "ls; quit" 192.168.50.1
Solution:
# Check if USB device is recognized
lsblk
# Check mount status
mount | grep flash
# Check udev rules
ls -la /etc/udev/rules.d/99-pilink-flash.rules
# Manually mount (if needed)
sudo mount /dev/sda1 /mnt/flashSolution:
-
Check available space:
df -h /data df -h /mnt/flash
-
Check logs:
sudo tail -f /var/log/pilink.log
-
Verify FTP credentials in
/etc/pilink.yaml -
Restart services:
sudo systemctl restart pilink-ui.service sudo systemctl restart pilink-usb-watcher.service
Solution:
-
Check USB watcher service:
sudo systemctl status pilink-usb-watcher.service
-
Check if flash drive is mounted:
mount | grep /mnt/flash -
Check permissions:
ls -la /mnt/flash sudo chmod 755 /mnt/flash
-
Manually trigger copy (for testing):
sudo systemctl restart pilink-usb-watcher.service
Solution:
- Connect via HDMI/monitor and keyboard
- Or connect via WiFi (if configured)
- Or use router to find new IP address
- Verify static IP configuration:
cat /etc/dhcpcd.conf
System logs:
# PiLink application logs
sudo tail -f /var/log/pilink.log
# Service logs
sudo journalctl -u pilink-ui -f
sudo journalctl -u pilink-usb-watcher -f
# Combined logs
sudo journalctl -u pilink-ui -u pilink-usb-watcher -fAutomatic cleanup:
- Old staging files are automatically deleted after the retention period (default: 7 days)
- Configure in
/etc/pilink.yaml:paths: retention_days: 7
Manual cleanup:
- From UI: Press P on main menu
- Or from command line:
python3 -m pilink.transfer_manager --prune
cd /opt/pilink
sudo git pull
sudo pip3 install -r requirements.txt --upgrade
sudo systemctl restart pilink-ui.service
sudo systemctl restart pilink-usb-watcher.service- From UI: Press E on main menu (if available)
- Or from command line:
sudo umount /mnt/flash
# Backup config
sudo cp /etc/pilink.yaml /etc/pilink.yaml.backup
# Restore config
sudo cp /etc/pilink.yaml.backup /etc/pilink.yaml# Restore default config
sudo cp /opt/pilink/config/pilink.example.yaml /etc/pilink.yaml
sudo nano /etc/pilink.yaml # Edit with your settings
# Restart services
sudo systemctl restart pilink-ui.service
sudo systemctl restart pilink-usb-watcher.service# Service management
sudo systemctl start pilink-ui.service
sudo systemctl stop pilink-ui.service
sudo systemctl restart pilink-ui.service
sudo systemctl status pilink-ui.service
# View logs
sudo journalctl -u pilink-ui -f
sudo tail -f /var/log/pilink.log
# Test FTP connection
lftp -u username,password -e "ls; quit" 192.168.50.1
# Check disk space
df -h
# Check USB devices
lsblk
# Manual mount (if needed)
sudo mount /dev/sda1 /mnt/flash- Configuration:
/etc/pilink.yaml - Application logs:
/var/log/pilink.log - Staging area:
/data/pc_inbox,/data/flash_outbox - Flash drive mount:
/mnt/flash - Application code:
/opt/pilink
- PC:
192.168.50.1 - Raspberry Pi:
192.168.50.2
If you encounter issues not covered in this guide:
- Check the logs (see Viewing Logs)
- Review the troubleshooting section
- Check the architecture documentation:
docs/architecture.md - Review networking setup:
docs/networking.md - Check operations guide:
docs/operations.md
When configuring FileZilla Server, the paths you set in the user's "Shared folders" section should match:
- Downloads folder (PC → Flash): This is where you place files on your PC that you want to transfer to the flash drive
- Uploads folder (Flash → PC): This is where files from the flash drive will be saved on your PC
In /etc/pilink.yaml, these correspond to:
download_root: Path relative to FileZilla user's root (e.g.,/downloads)upload_root: Path relative to FileZilla user's root (e.g.,/uploads)
Example FileZilla Setup:
- User root:
C:\PiLinkShare - Downloads:
C:\PiLinkShare\downloads→ Use/downloadsin config - Uploads:
C:\PiLinkShare\uploads→ Use/uploadsin config
End of User Guide