Close
0%
0%

PrinterPi: Raspberry Pi Automatic Receipt Printer

A Raspberry Pi-powered eBay and PayPal packing list printing system using a thermal receipt printer

Similar projects worth following
PrinterPi is an automatic web parser (through a Chrome Extension) and packing list printer using a Raspberry Pi and a thermal printer.

This project was designed to make order fulfillment for small businesses easier by providing an automatic receipt and packaging material creation. It was designed and built with a network-accessible Raspberry Pi, a thermal receipt printer, and a Chrome Extension to parse eBay and PayPal pages. Also uses a custom 3D printed case and supplemental electronics.

See the build guide below for a complete description of how to build this project yourself. The same guide and latest code is available on GitHub here: https://github.com/alex-mous/PrinterPi. Below is a usage guide for using the final printer.

Usage

Printing

Click on the extension on Google Chrome, navigate to either the eBay Print a shipping label page or the PayPal Activity page (make sure to open at least one transaction; the data gathered will appear if successful), ensure that the printer is up and running, press the "Parse Data" button to read the data off of the webpage, and finally press the "Print Receipt" button. If all is well, a message "Successfully sent data to the printer" will appear, the printer's light will start flashing and the paper will print. If not, please see Troubleshooting below. Also, there is a "Save Data" button to save the data into the extension, so that when it is reopened, the same settings will show. Finally, you can generate and print #10 size envelopes with the buyer's address, your address, and an optional custom logo by pressing the "Print Envelope" button. Note: before using the printer for the first time, you will need to set up the options. Navigate to this page by using the button at the very bottom of the Chrome Extension and fill in the fields as directed (including the IP address from earlier [written in the form of IP_ADDRESS:9321, where 9321 is the custom printer network port])

Booting Up and Shutting Down

On boot, the printer will flash its LED slowly to indicate that the printer is ready for use. When you want to shut it down, press and hold the power button until the LED turns off. Then disconnect the power supply.

Note: Due to the multiple different types of data displayed on PayPal (and lack of data on eBay in the current version), the values may not be parsed correctly, so they need to be checked before printing.

Troubleshooting

LED not flashing after boot

  • The SD card might be corrupted, or something may have happened to the code. Please SSH into the Raspberry Pi or re-install the software.

Printer not printing

  • If the LED light is flashing, that means that there is an issue with the printer. The most likely cause is that it is out of paper.
  • Otherwise, the host is probably not connecting properly to the Raspberry Pi.

Power button not shutting down the Raspberry Pi

  • Check the wiring of the power button and note that you need to hold the power button down until the LED turns off. At this point, it is safe to remove power.

Chrome Extension errors

  • Try checking the Options, reinstalling the extension (and looking at the JavaScript console) or running the PrinterPiServer code on the Raspberry Pi in a console and watching the output.

PrinterPiExtensionV5.1.zip

Latest working Chrome Extension code

x-zip-compressed - 923.36 kB - 10/08/2020 at 21:35

Download

PrinterPiServer.zip

Latest working PrinterPi server code (code for Raspberry Pi)

x-zip-compressed - 12.56 kB - 10/08/2020 at 21:35

Download

Adobe Portable Document Format - 15.79 kB - 10/08/2020 at 21:35

Preview
Download

JPEG Image - 1.81 MB - 10/08/2020 at 21:35

Preview
Download

JPEG Image - 1.40 MB - 10/08/2020 at 21:35

Preview
Download

View all 7 files

  • 1 × Capacitor, 10uF (C1)
  • 1 × Capacitor, 0.1uF (C2)
  • 1 × LED, 5mm, 2V Red (D1)
  • 2 × Diode, 1N4148 (D2, D3)
  • 1 × 2.1mm Barrel jack (J3)

View all 18 components

  • 1
    Parts and Materials

    The following parts and materials are required (as detailed in the Components section)

    • Raspberry Pi Zero W with Raspbian Jessie Lite installed (this version is important if you want to make the file system read-only; see the optional last step)
    • 3D prints of the files in the "3D Files" directory
    • Soldering equipment
    • A thermal printer and required paper (DP-58C)
    • DC power supply (12V 5A) with a corresponding plug for the barrel jack
    • Wire
    • Some stripboard
    • Electronic components as shown in the PrinterPi BOM.csv and pin headers and sockets (1-pin width)
    • M2.5x12 and M2x6 machine screws
    • A sacrificial pencil for the roll holder
  • 2
    Software Setup

    You will need access to the Raspberry Pi (through either SSH or console) to install the software.

    After booting up the Raspberry Pi, we need to setup the WiFi; open the WiFi configuration file:

    sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
    

    And then add the following to the bottom:

    network={    ssid="YOUR_SSID_HERE"    psk="YOUR_PSK_HERE"
    }
    

    Next, get the IP address of the Raspberry Pi (and write it down; we will be using the IP address later to communicate with the extension):

    sudo ifconfig
    

    After this, run raspi-config to setup some further settings as shown in the table below

    OptionDescription
    Change User PasswordChange to something more secure as the Raspberry Pi will be available the network
    HostnameName your Pi so that it can be addressed without an IP address
    Interfacing Options -> SSHEnable (for maintenance)
    Interfacing Options -> SerialDisable console, enable serial
    Boot Options -> Desktop/CLI -> Console AutologinEnable this so that the script will run automatically

    To compile the code, we need to install Java on the Raspberry Pi. Run the following commands to do this:

    Now, you can either use the precompiled code from the Releases page. (You may need to install the Java Runtime Environment with sudo apt-get install default-jre), or compile the code yourself using the method below:

    sudo apt-get update
    sudo apt-get install openjdk-8-jdk -y
    

    Finally, download a copy of the code in the "PrinterPiServer" directory in this repository and place the files in the home directory of the Raspberry Pi.

    You will need to compile the code before it can run; this can be done with the following command:

    javac *.java
    

    (continue here if using precompiled code) Additionally, we need to make the power button management script executable with the following command:

    sudo chmod +x power_button.sh
    

    To make the Raspberry Pi run the code automatically on boot, add a couple of lines of code to the .bashrc file, which runs when the user logs in (done automatically on boot up with the console autologin selection in raspi-config). Open up the file with:

    sudo nano ~/.bashrc
    

    And add the following lines to the end:

    /bin/bash /home/pi/power_button.sh&
    stty -F /dev/serial0 115200
    java -cp /home/pi Main&
    

    Finally, we need a logo for the receipt to print. Generate this from any size and color picture with the Python code in the Logo directory with the following steps:

    • Take a copy of your logo and place it into the Logo directory (rename it to Logo_in.png)
    • Next, open and run the Python program "Image Processing.py"
    • This will create a binary file, Logo.bin. You need to copy this file and place it into the directory with the other code on the Raspberry Pi for it to run

    If you do not have a logo, just create an empty file called Logo.bin on the Raspberry Pi in the same folder as the PrinterPiServer code.

    Optional additional steps

  • 3
    Wiring

    First, solder together the circuit board as shown below (reference the pictures with the Wiring diagram file (Note: you will need to cut some of the traces, so please look carefully.)

    Drawing of the wiring of the ciruit boardClose-up of the components on top of the circuit board

    Next, solder up the power jack and thermal printer cables (power and data; these will need to be spliced) to the wires from the circuit board. The LED and power button also need to be soldered, but in this case to pin headers instead of directly to the circuit board.

    Wiring connections to the thermal printerClose-up of the LED and power button installation

    Finally, connect all corresponding cables and sockets and check that the Raspberry Pi boots and runs successfully.

View all 5 instructions

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates