How to Install a 58mm Thermal Printer on Raspberry Pi 2, 3, 3B+, 4, and 5 for Recipe Printing
In this guide, I will explain how to install a 58mm thermal printer on a Raspberry Pi 2, 3, 3B+, or 4 to automatically print recipes. I run an online food ordering website using WordPress and WooCommerce and needed a solution to automatically send orders from customers directly to the kitchen for the chef, without wasting time checking emails. By using the Printnode cloud printer, I was able to eliminate delays and ensure a smooth workflow.
After over a year of searching for a solution, I discovered how to automatically print recipes using a thermal printer. Normally, thermal printers come with drivers, but most of them only support Windows. However, if you want to use a Raspberry Pi, you’ll need to install the drivers manually. Thanks to Adafruit for providing the necessary drivers. Now, let’s get started with the installation.
Step 1: Update Raspberry Pi
Before anything, update your Raspberry Pi by entering the following commands:
sudo apt-get update
sudo apt-get upgrade
sudo usermod -a -G lpadmin pi
sudo cupsctl --remote-any
sudo systemctl restart cups
Step 2: Install CUPS Package
Next, install the CUPS package, which is necessary for the printer server:
sudo apt-get install libcups2-dev libcupsimage2-dev git build-essential cups system-config-printer
Step 3: Install the Printer Driver
To install the printer driver on the Raspberry Pi, download it from GitHub using the following commands:
git clone https://github.com/adafruit/zj-58
cd zj-58
make
sudo ./install
Step 4: Install SAMBA for Pi Printer Server
Now, install SAMBA so you can manage your printer server:
sudo apt-get install samba
Step 5: Edit the SAMBA Configuration File
After installation, modify the configuration file:
sudo nano /etc/samba/smb.conf
[printers]
comment = All Printers
browseable = no
path = /var/spool/samba
printable = yes
guest ok = yes
read only = yes
create mask = 0700# Windows clients look for this share name as a source of downloadable
# printer drivers
[print$]
comment = Printer Drivers
path = /var/lib/samba/printers
browseable = yes
read only = no
guest ok = no
Step 6: Restart SAMBA
Restart SAMBA with this command to apply the changes:
sudo systemctl restart smbd
Step 7: Add the Printer to Raspberry Pi
Once the driver is installed, there are two methods to add the printer.
Method 1: Using Raspberry Pi IP Address
First, find your Raspberry Pi’s IP address by typing:
hostname -I
Then, go to your web browser and enter the following URL, replacing 192.168.1.245
with your IP address:
http://192.168.1.245:631
This will bring up the CUPS homepage. Click on “Administration,” log in with the Raspberry Pi’s username (default is pi
) and password, then click “Add Printer.”
When you click “Add Printer,” a list of available printers will appear. Select the zj-58
printer and press “Continue.” In the final step, you can configure the paper size to either A4 or thermal paper size (80mm or 52mm).
Method 2: Using Raspberry Pi GUI
Alternatively, you can add the printer through the Raspberry Pi GUI. Go to the Pi menu, select Preferences, and choose Print Settings. If the printer icon does not appear, make sure that the ZJ-58 CUPS installation was completed successfully. Once done, click the printer icon, and you’ll be able to add the ZJ-58
printer.
By following these steps, you should now be able to use a 58mm thermal printer on your Raspberry Pi to automatically print recipes from your website.