Skip to content

About

Smart restaurant ordering system: STM32, two ESP32s and a Vega Aries V3 RISC-V board linked over Wi-Fi UDP, ESP-NOW, UART and I2C (IIT Gandhinagar ES 333).

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Smart Ordering System

1. Project Overview

This project implements a two-table smart ordering system with a table-side controller and a kitchen-side controller.

  • Table side: STM32 + ESP32 (espA) + two 16x2 LCDs
  • Kitchen side: ESP32 (espB) + Vega Aries V3 + one 16x4 LCD
  • Order source: Simulink app over WiFi (UDP)
  • Inter-board links: UART and ESP-NOW
flowchart LR
    SL["Simulink app"] -- "Wi-Fi UDP :1234" --> A
    subgraph Table side
        A["espA (ESP32)"] -- "UART 115200" --> S["STM32"]
        S --> L1["16x2 LCD<br/>Table 1"]
        S --> L2["16x2 LCD<br/>Table 2"]
        S --> D["Dispensers<br/>coffee / tea / biscuit"]
    end
    subgraph Kitchen side
        B["espB (ESP32)"] -- "UART 115200" --> V["Vega Aries V3"]
        V --> L3["16x4 LCD<br/>kitchen"]
        V --> Z["Buzzer"]
    end
    A -- "ESP-NOW: order" --> B
    B -- "ESP-NOW: status" --> A
Loading

Repository layout

Embedded-Systems-Project/
├── espA/espA.ino               # Table-side ESP32: Wi-Fi UDP in, UART to STM32, ESP-NOW to espB
├── espB/espB.ino               # Kitchen-side ESP32: ESP-NOW in, UART to Vega, status buttons
├── vega_aries/vega_aries.ino   # Vega Aries V3: 16x4 kitchen LCD, buzzer, clear buttons
└── STM32/stm32.c               # STM32 main.c: table LCDs and dispensing outputs

2. Functional Flow

  1. Simulink sends order to espA over WiFi UDP.
  2. espA forwards order to STM32 over UART.
  3. STM32 updates the corresponding table LCD and dispensing sequence.
  4. On confirmation button press (espA side in current code), espA sends order to espB via ESP-NOW.
  5. espB forwards order to Vega Aries via UART.
  6. Vega updates 16x4 kitchen display with both table orders.
  7. Kitchen buttons on espB send order status back to espA via ESP-NOW.
  8. espA forwards status to STM32 so table LCDs show processing or done state.

3. Data Formats

3.1 Simulink to espA (UDP payload)

  • Sent to espA's IP address on UDP port 1234 (the IP is printed on espA's serial monitor)
  • 4 bytes: [table, coffee, tea, biscuit]

3.2 espA to STM32 (UART frame)

  • 6 bytes: [0xFF, table, coffee, tea, biscuit, status]
  • status byte:
    • 0: no status update
    • 1/2: order sent signal
    • 3/4: processing signal
    • 5/6: done signal

3.3 espA to espB (ESP-NOW payload)

  • struct_message:
    • table
    • coffee
    • tea
    • biscuit

3.4 espB to Vega (UART text)

  • ASCII line: table,coffee,tea,biscuit\n

3.5 espB to espA (ESP-NOW status)

  • 1 byte status code: 3, 4, 5, or 6

4. Pin Mapping

4.1 espA Pin Map (Table-side ESP32)

Function Pin
UART2 RX from STM32 TX GPIO16
UART2 TX to STM32 RX GPIO17
Confirmation Button 1 GPIO18
Confirmation Button 2 GPIO19
WiFi + ESP-NOW radio Internal

4.2 espB Pin Map (Kitchen-side ESP32)

Function Pin
UART2 RX from Vega TX GPIO16
UART2 TX to Vega RX GPIO17
ButA (status button) GPIO18
ButB (status button) GPIO19
ButC (status button) GPIO4
ButD (status button) GPIO5
WiFi/ESP-NOW channel Channel 11

4.3 STM32 Pin Map

Function Pin
Coffee dispensing control output PB0
Tea dispensing control output PB7
Biscuit dispensing control output PB14
I2C1 SCL (LCD Table 1) PB8
I2C1 SDA (LCD Table 1) PB9
I2C2 SCL (LCD Table 2) PF0
I2C2 SDA (LCD Table 2) PF1
USART6 RX/TX to espA As configured in STM32CubeMX board setup

Note: USART6 GPIO pins are not explicitly set in this source file. Use your CubeMX IOC pinout for exact STM32 UART pins.

4.4 Vega Aries V3 Pin Map

Function Pin
UART RX from espB TX UART1 RX (board mapping)
UART TX to espB RX UART1 TX (board mapping)
Buzzer D10
Table 1 Clear Button D11
Table 2 Clear Button D12
I2C SDA/SCL for 16x4 LCD Default board I2C pins

5. Wiring Connections

5.1 Board-to-Board Wiring

From To Signal
espA GPIO17 (TX2) STM32 USART6 RX UART data
espA GPIO16 (RX2) STM32 USART6 TX UART data
espB GPIO17 (TX2) Vega UART RX UART data
espB GPIO16 (RX2) Vega UART TX UART data
espA and espB Wireless ESP-NOW

5.2 LCD Wiring

LCD Connected Board Bus
16x2 LCD for Table 1 STM32 I2C1 (PB8, PB9)
16x2 LCD for Table 2 STM32 I2C2 (PF0, PF1)
16x4 Kitchen LCD Vega I2C (addr 0x27 or 0x3F)

5.3 Common Power and Ground

  • Keep all logic on compatible voltage levels for each board.
  • Use a common GND reference between paired UART-connected devices:
    • STM32 and espA
    • espB and Vega
  • Verify module current capability for WiFi transmit peaks on both ESP32 boards.

6. Build and Upload

6.1 espA and espB (Arduino IDE)

  1. Install ESP32 board package.
  2. In espA/espA.ino, set your network (credentials are not stored in the repo):
    const char *ssid = "YOUR_WIFI_SSID";
    const char *password = "YOUR_WIFI_PASSWORD";
  3. Set the ESP-NOW peer MAC addresses: targetAddress[] in espA must be espB's MAC, and targetAddress[] in espB must be espA's MAC (print each board's MAC with WiFi.macAddress()).
  4. Select correct ESP32 board and COM port.
  5. Open and upload:
    • espA/espA.ino
    • espB/espB.ino

ESP-NOW channel. espB is fixed to Wi-Fi channel 11, while espA uses whatever channel its access point is on. Set the router or hotspot to channel 11 (or change the channel in espB to match), otherwise the two ESP32s will not hear each other.

6.2 Vega Aries (Arduino IDE)

  1. Select Vega Aries V3 board profile.
  2. Install required libraries:
    • LiquidCrystal_I2C
  3. Open and upload:
    • vega_aries/vega_aries.ino

6.3 STM32 (STM32CubeIDE)

  1. Create or import the STM32CubeIDE project for your board.
  2. Confirm USART6 and I2C pin assignments in IOC.
  3. Replace the generated Core/Src/main.c with STM32/stm32.c (it is a complete main.c and includes main.h), then build and flash.

7. Pre-Test Checklist

  • WiFi SSID and password in espA are correct.
  • ESP-NOW MAC target addresses are correct on both ESPs.
  • Both ESPs are on the same ESP-NOW channel.
  • UART baud is 115200 on all linked pairs.
  • LCD I2C addresses are correct (STM32 uses 0x4E write address, Vega probes 0x27 and 0x3F).
  • All button pins are wired to GND for active-low input_pullup logic.

8. Notes

  • Current codebase is structured and ready for integration testing.
  • If needed, next step is to standardize status code mapping and table-context handling across espA, espB, STM32, and Vega.

About

Smart restaurant ordering system: STM32, two ESP32s and a Vega Aries V3 RISC-V board linked over Wi-Fi UDP, ESP-NOW, UART and I2C (IIT Gandhinagar ES 333).

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages