How hackershackofficial/smart-bartender works
Main Components
• Hardware Layer:
• Raspberry Pi 3: Acts as the central controller.
• OLED Display and optional keyboard/screen (or VNC connection).
• Electronic pumps (up to 6, configurable) connected via GPIO pins.
• Relay circuitry controlling the pumps.
• Software/Application Layer:
• bartender.py: The main entry point that orchestrates the operation.
• drinks.py: Holds the drink recipes and filtering logic based on pump configuration.
• menu.py: Manages the OLED menu interface and user interactions.
• pump_config.json: Contains pump setup details (name, GPIO pin, assigned beverage).
Relationships and Interactions
• Startup/Initialization:
• The system starts by executing bartender.py.
• bartender.py loads the pump configuration from pump_config.json.
• It then imports drink options from drinks.py and setups the interactive menu (menu.py).
• User Interaction Flow:
• A user selects a drink from the OLED menu on the Raspberry Pi.
• The menu logic (menu.py) matches the drink selection with available recipes (from drinks.py) and present pump options.
• Once a drink is selected, bartender.py activates the relays (based on information from pump_config.json) that control the pumps.
• Maintenance and Cleaning:
• The menu provides a cleaning option that activates all pumps for flushing.
Architectural Patterns and Design Principles
• Modular Design: The system is split into clear modules (main controller, drink recipes, user interface, configuration) which makes it easy to update or expand functionality.
• Separation of Concerns: Each file has a distinct responsibility (logic, UI, configuration) which enhances maintainability.
• Configuration-Driven: The pump behavior is data-driven via pump_config.json, allowing simple updates without code modifications.
• Hardware-Software Interaction: Clear mapping from software commands (in Python) to hardware outputs (GPIO operations controlling the pumps).
Relevant Technologies and Frameworks
• Python 2.7 is used, along with pip for dependency management.
• Raspberry Pi’s native GPIO libraries (or similar) for hardware communication.
• The OLED and I2C/SPI libraries/drivers required for the screen’s operation.
• VNC for remote desktop access, as suggested in the README.