ESP32-S3 and Firebase-Based IoT Platform for Autonomous Table-to-Kitchen Coordination

Adequate Infosoft has created AutoDine, innovative restaurant technology based on ESP32-S3 technology with built-in intelligence.

This system incorporates the use of touch screen HMIs, LVGL interface creation, automated order processing, digital payment processing, and kitchen dashboards.

This project showcases Adequate Infosoft's competence in custom IoT hardware creation, embedded firmware dedicated to this concept, cloud applications, and automation technology.

1. Project Overview and Problem Statement

AutoDine is an IoT-based ecosystem aimed at automating restaurant operations by substituting paper menus with cloud-connected interactive table units.

The system delivers automated order routing to the kitchen, digital payments at the tables, and real-time analytics for restaurant owners.

In contrast to typical QR-code ordering system, AutoDine utilizes specialized 7-inch ESP32-S3 Human-Machine Interface (HMI) that runs LVGL graphical interface for each table.

The system automatically manages all steps of order delivery – from selection and payment to cooking and robotic order delivery – through Python Flask back-end, Firebase Firestore and SSE dashboards.

AutoDine ESP32 restaurant ordering interface

2. System Architecture and Data Flow

The architecture of the system follows the hub-and-spokes model, with at the center of it a Python Flask Server. The table units comprising the ESP32-S3 makes use of HTTP/JSON requests through the Flask server.

The Flask Server acts as the orchestration server through authentication with Firebase Firestore by using the Admin SDK for keeping menu records and managing the status of various orders, implementation of calls to the Razorpay API for making payment transactions, and sending real-time status notifications through the server-sent event mechanism to Chef Dashboard and Owner Analytics.

The Arduino Uno waiter robot accepts the delivery commands over Bluetooth from Chef Dashboard.

This architecture is designed in a way that no device ever makes requests directly to the database, thus providing more security (Firebase credentials are not stored in the ESP32) and easy updates of the firmware.

3. Hardware Design: The ESP32-S3 Table Unit

The tablet unit is constructed around an ESP32-S3 module paired with a 7.0-inch CrowPanel HMI display. The README serves as a pin-to-pin hardware guide, which will enable one to make a production-ready wiring scheme. The LCD operates in 16-bit RGB mode, while the data lines D0 through D7 map to GPIO pins 15, 7, 6, 5, 4, 9, 46, and 3, with D8 through D15 assigned to GPIO 8, 16, 1, 14, 21, 47, 48, and 45.

Timing signals (DE, VS, HS, PCLK) are assigned to GPIO 41, 40, 39, and 0. The Backlight function BL_EN is given via GPIO 2 with PWM support. Touch input uses I²C on GPIOs 19 (SDA) and 20 (SCL), with a reset line running to GPIO 38. The power is supplied via USB-C at 5V/2A.

A key firmware setup is the activation of OPI PSRAM. LVGL rendering on a 7-inch screen calls for lots of memory for frame buffers, with the PSRAM of ESP32-S3 being important for smooth animations and user interface. The board is programmed as "ESP32S3 Dev Module" in USB mode "Hardware CDC and JTAG."

4. Firmware Development: LVGL, Touch Stability, and Deferred Networking

The firmware code is found in the AutoDine_Table_Ino folder, is implemented in Arduino/C++ programming language and encompasses LVGL for the menu. The LVGL is known for its advanced, quick user interface with glassmorphism design and animation features, as showcased by V3.5 UI upgrade.

One of the essential features is the 400 ms Touch Stability Guard, which prevents unnecessary transitions. The restaurant environment is capable of being affected by different infractions like accidental touch happenings which cause the device to fail during HTTP communication. To solve this problem, the firmware introduces the deferred networking approach which allows quick functioning of the device.

For the communication between table firmware and the backend, the HTTP/JSON protocol is used. The server IP is specified in the app_config.h file, and the ESP32 sends order information including table id, items chosen by the customer, their quantity, and the preferred payment method. The cash payment verification processes are also managed by the firmware.

5. Backend Development: Flask, Firebase Firestore, and Razorpay Integration

The /server folder contains a Python Flask app that acts as the coordination node. The dependencies used by the Flask app include flask, flask_cors (for cross-origin requests from the dashboards), firebase-admin (for accessing Firestore), razorpay (for transaction processing), python-dotenv (for environment variable handling), and qrcode (for UPI QR generation).

Firebase Firestore is enabled in Native Mode. Authentication to Firestore is achieved via the use of a firebase_credentials.json file that is located in the /server directory. The Firestore database is used for storing the menu and the orders in real-time. When an order is placed from a table, the Flask server creates a new order document with status PLACED. The Chef Dashboard will then set the status to PREPARING and READY.

Razorpay integration provides functionality for UPI QR and cash transaction verification. The server generates the QR code for the amount of order via Razorpay API. This code is shown in the table unit for the user to make the payment either via UPI or through cash payment. In case of cash payment, there is a verification step after which the order is sent to the kitchen. The sensitive keys (RAZORPAY_KEY_ID and RAZORPAY_KEY_SECRET) are stored in a .env file.

6. Real-Time Dashboards: SSE for Kitchen and Owner Analytics

Rather than utilizing WebSockets or polling, AutoDine employs Server-Sent Events (SSE), which enables live data to be pushed to the Chef Dashboard and Owner Analytics dashboard. SSEs are an unidirectional HTTP streaming technique used when it comes to notifications from servers to clients. Flask server continuously creates persistent SSE connections to dashboard clients, broadcasting events on any order placed, confirmation of payments, or status updates from the kitchen.

Chef Dashboard shows incoming orders and lets kitchen staff tag an item as either "preparing" or "ready." Once the order is tagged "ready," dashboard will send out a Bluetooth command to Arduino Uno waiter robot to deliver the order to the appropriate table. The Owner Analytics dashboard also listens to the SSE channel but gathers business intelligence data – volume of orders, most popular dishes, breakdown by payment methods, and table turnover rate.

AutoDine kitchen dashboard and order workflow

This SSE-based architecture reduces server load compared to WebSocket solutions, as SSE connections are simpler to maintain and automatically reconnect on network interruptions. It also aligns with the lightweight nature of the Flask backend, which does not require an additional message broker.

AutoDine restaurant owner analytics dashboard

7. Waiter Robot: Arduino Uno and Bluetooth Coordination

The /AutoDine_Waiter module consists of the programming necessary to operate a delivery robot based on Arduino Uno. The system does not work autonomously, as it simply receives the commands from the Chef Dashboard.

As the README states, the robot has an ability to autonomously travel along a preset route or respond to Chef's dashboard instructions, although the Bluetooth protocol is thus employed instead of the Wi-Fi one.

Usually, such robots operate using HC-05 or HC-06 Bluetooth module and L298N or L293D motor driver, DC motors, and chassis. The Chef Dashboard works in a browser and does not have the ability to create Bluetooth connection directly.

Hence, the architecture is likely to be that of a local bridge (for example, a Python script or a small helper app on the kitchen computer) that receives the SSE 'order ready' event and then makes the table ID available to the Arduino via Bluetooth serial. Thus, real time flow is preserved while working within some restrictions of browser Bluetooth.

AutoDine UPI payment and delivery robot

8. Development Phases and Iterative Evolution

AutoDine was created through four different versions, each fulfilling a particular technical target:

V1.0, Prototype:

Understanding the inner workings of the menu system performed on the ESP32-S3 without connecting to the network.

V2.0, Online Connection:

Establishing communication between the UI in the table unit and the server.

V3.0, Razorpay Implementation:

Conducting real payment testing via UPI and generation of QR codes.

V3.5, UI Changes made to the application:

Updating to a new visual style, implementing animations, and using the 400ms Touch Stability Guard to enhance user experience.

V4.0, Final Stage of Development:

Tightening security of the application and cleaning the code of unnecessary elements while improving stream processing.

Such an incremental approach minimized integration issues. The GitHub repository contains video records of the demos for each version.

9. Challenges and Technical Solutions

Challenge 1: UI Responsiveness with Network Delays

By using synchronous HTTP requests with the ESP32, the ÏVLGL event loop was delayed and the UI was not able to refresh. To resolve this issue, we used a method called deferred networking whereby touch events are collected for 400 ms while the network requests are sent asynchronously using non-blocking state callbacks, making the rendering of graphics independent of network I/O.

Challenge 2: Limitations in ESP32-S3 Memory

LVGL needs a frame buffer for the 7-inch screen. It was mandatory to enable OPI PSRAM; without it the firmware can either not work or crash under heavy load of animations. The pin mapping and board configuration in the README states that PSRAM is important.

Challenge 3: Real-Time Kitchen Updates Without Using WebSockets

Using WebSockets would necessitate a complicated server setup alongside extra client libraries. In contrast, Server-Sent Events offer a simpler solution that is already part of HTTP and works well with both Flask and the browser EventSource application programming interfaces, and ensures that the latency of switching order statuses is less than one second.

Challenge 4: Secure Payment Processing on Resource-Constrained Devices

Razorpay cannot be installed directly on ESP32 as it would be a security risk, given the need to protect the API keys and maintain PCI compliance. By running the operations through Flask, ESP32 is only processing the QR code or payment confirmation token, thus preventing exposure of any merchant credentials.

10. Outcomes and Technical Significance

AutoDine demonstrates how an inexpensive device such as ESP32-S3 HMI, Arduino Uno robot, Python Flask server, and Firebase Firestore can provide a fully-working restaurant IoT platform.

The platform performs sophisticated functions that include order management through interactive dashboards, and mobile payments made at the table with UPI. As well as the function of delivering through robots, without incorporating a mobile application or advanced messaging components.

In terms of technical innovation, one has replaced CrowPanel 7.0 HMI's hardware pin assignment with reproducible hardware pin-mapping; also, utilized deferred-networked firmware to provide reliable operation; made an SSE dashboard that is much simpler to implement that traditional WebSocket solutions.

11. Conclusion

The AutoDine project serves as a wonderful case study in the world of embedded system integration and cloud-based real-time communication, as well as edge payment processing. The architecture acknowledges the limitations set by microcontroller memory and display generation capabilities, connectivity, and payment security and offers a platform that performs technical miracles while also being commercially viable. The detailed hardware manual, installation guidelines, and change log included in the repository will be very useful for those who make similar IoT systems that connect kitchens and restaurants.

Project Repository: github.com/Jathin021/AutoDine-Smart-Restaurant-Table-to-Kitchen-Coordination-Platform-using-IoT

Abhinav Akula
DevOps Engineer and 3× Microsoft Azure Certified professional specializing in Azure cloud solutions, migration, deployment automation, and multi-cloud environments. He holds Microsoft certifications as an Azure Developer Associate and Azure Solutions Architect Expert, with expertise in building scalable, secure, and reliable cloud infrastructure.

What Our Clients Say About Us

Client satisfaction is our ultimate goal. Here are some kind words of our precious clients they have used to express their satisfaction with our service.

Leadership That Leads Worldwide

With a physical presence in over 15 countries and a global footprint spanning 25+ countries, we are ready to serve you anywhere. Location, language, or culture is never a barrier, because our global team can work with you in your language. Our strong international team ensures seamless collaboration across borders We have a strong tech team, highly recognized in their domains, with extensive technical expertise.