Shop Billing System Using A Thermal Printer

efy tested

This shop billing system is a comprehensive solution aimed at streamlining transaction management within a retail environment. Combining Python for graphical user interface (GUI) functionality and Arduino for controlling a thermal printer (RP203), this innovative system enables users to input customer details, select items from an inventory, manage a cart, and seamlessly print bills. Key features include customer information input for personalised billing, inventory management with options for selecting items, specifying quantities, and choosing units of measurement.

The system facilitates cart management by displaying added items, enabling easy item deletion, and instant total amount calculation. It also handles unknown items, allowing for their addition with automatic amount calculation. The system architecture consists of a Python GUI developed using Tkinter for user interaction and Arduino interfacing with the thermal printer for bill printing, creating a robust and efficient transaction management solution for retail settings. To set it up, you will need the components shown in Bill of Materials table.

Bill of materials
Components Description Quantity
Arduino Uno (MOD1) Development board 1
USB Type C Adaptor 1
RP203 (MOD 2) Thermal printer 1
12V, 1A power adaptor Power source for thermal printer 1
Jumper wires Male to female 6
Note: Most thermal printers come with a printer page, but if it does not, you need to add that to the shopping cart as well.

Setup and installation

First, install the ‘Adafruit_Thermal.h’ library for Arduino IDE using the library manager. Then, upload the thermal printer code provided here to the Arduino Uno by selecting the correct port and board.

Next, prepare the Python code for the shop billing system by following these steps:

1. Install required libraries. Install Python and required libraries using the following commands:

pip install tk
pip install pyserial

If you are using Python 3 IDE, use pip3 instead of pip for library installation. If you are using a Linux system, you also need to add ‘sudo’ before ‘pip’:

sudo pip3 install tk
sudo pip install pyserial

Here, tk is used to create the GUI, and pyserial is used to communicate with the Arduino, which acts as the motherboard to drive the thermal printer module.

2. For the Python code, import both libraries, create the GUI for the shop billing system, and then create and code the function for billing. You can modify the areas, billing options, and details as per your requirements in the code. The GUI code snippet is shown in Fig. 1.

Fig. 1: GUI code snippet

Circuit diagram

The circuit diagram of the project, shown in Fig. 2, comprises the Arduino Uno (MOD1), thermal printer RP203 (MOD2), a 12V, 1A power adaptor, and a few jumper wires.

Fig. 2: Circuit diagram

Testing

After uploading the source code, connect the Arduino Uno and power the thermal printer using the 12V adaptor.

Execute the Python script to launch the GUI. When you run the Python code, a GUI will appear as shown in Fig. 3.

Fig. 3: GUI of the grocery system

Enter customer details. Input customer details, including name and phone number.

Manage inventory. Select items from the inventory, input quantity, and choose the unit for each.

Cart management. Utilise the ‘Delete Item’ button to manage items in the cart.

Total amount calculation. Review the total amount after clicking on the ‘Total Amount’ button.

Print bill. Use the ‘Send’ button to send data to the Arduino Uno for bill printing.

Unknown items. For unknown items, use the inventory option to add them, providing the name and price.

Fig. 4: Author’s prototype printing a bill

The bill will print with the provided billing details set in the GUI. Fig. 4 shows the author’s prototype printing the bill.

Congratulations, your own designed billing machine is ready!

Troubleshooting

If the thermal printer is unresponsive, check the Arduino connection and code. Also, ensure that the Python environment is correctly set up with the required libraries.


Rohan Barnwal is an Electronics Enthusiast

The post Shop Billing System Using A Thermal Printer appeared first on Electronics For You.



View more at https://www.electronicsforu.com/electronics-projects/shop-billing-system.

Credit- EFY. Distributed by Department of EEE, ADBU: https://tinyurl.com/eee-adbu
Curated by Jesif Ahmed