How foxriver-2005/smartcafe works
Based on your project file tree and README, SmartCafe is a Raspberry Pi–based food ordering and payment system designed to run on a Raspberry Pi 3B+. Its primary function is to allow users to interact with the system via a physical keypad and view information on a 16×2 LCD display. The system interacts with a local SQLite database for user verification, menu retrieval, and payment processing.
Main Components
• Hardware Interfaces:
• Keypad (handled in Keypad.py): Captures user inputs such as access codes and food item selection.
• LCD Display (handled in lcd.py): Displays menus, messages, and payment confirmations.
• Raspberry Pi 3B+: The central processing unit running the software, interfacing with the keypad, LCD via I2C, and the database.
• Software Core:
• Main Orchestration Module (main.py): Coordinates the overall workflow, including user verification, interacting with input/output modules, and database operations.
• Database (SQLite): Embedded in the Raspberry Pi and used for storing valid user codes, food menus, prices, account details, etc.
Relationships and Interactions
• The system begins with the user entering a code on the keypad.
• main.py listens to keypad input via Keypad.py and, upon completion (triggered by the '#' key), validates the input against the SQLite database.
• After successful authentication, main.py triggers the LCD display routines in lcd.py to present the menu.
• When a user selects food items using the keypad, main.py calculates the order total, performs payment processing, and updates the SQLite database (deducting funds) accordingly.
• All hardware-related interactions (display and keypad) are directly managed on the Raspberry Pi, which acts as the controlling unit.
Architectural Patterns and Design Principles
• Modular Programming: The project is split into distinct modules (Keypad.py, lcd.py, main.py) which encapsulate specific functionalities.
• Hardware Abstraction: Separate modules abstract hardware interactions (e.g., LCD and Keypad) from the main business logic.
• Database Integration: The design cleanly separates database interaction logic from user interface handling.
• IoT/Embedded System Considerations: Given the limited resources of the Raspberry Pi 3B+ and the use of direct GPIO/I2C communications, efficient hardware interfacing is emphasized.
Relevant Technologies and Frameworks
• Raspberry Pi 3B+ running Raspbian OS.
• Python 3 for scripting, with smbus for I2C communication with the LCD.
• SQLite for lightweight, local data storage.
• Standard GPIO and possibly serial communication libraries for keypad and UART-based peripherals.