Skip to content

Latest commit

Β 

History

13 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Tab5 Terminal Demo

A hacker-style terminal UI for the M5Stack Tab5

Plug in a keyboard. Type commands. Feel like you own the system.


ESP-IDF LVGL Platform License



🎬 Preview



🏠 Home β€” select connection method

🏠 Home β€” UART card selected

πŸ” Scan β€” discovering nearby BLE devices

πŸ’» Terminal β€” neofetch system info

✨ What is this?

A terminal emulator UI built with LVGL v9 running on the M5Stack Tab5 β€” a 5-inch 1280Γ—720 IPS touchscreen device powered by the ESP32-P4 (RISC-V dual-core @ 360MHz) and an ESP32-C6 wireless coprocessor.

Connect a CardKB2 keyboard over UART and you get a fully interactive retro-terminal: colored output, line numbers, scrollable history, command autocomplete β€” all on a palm-sized device.

Tab5@terminal : ~ $ neofetch

  ######## ######## ######    tab5@terminal
  ##    ## ##    ## ##   ##   ─────────────────────────
     ##    #######  ######    OS      CardKB-Linux 1.0
     ##    ##       ##        Host    ESP32-P4 + C6
     ##    ##       ##        Kernel  5.15.0-esp32p4
     ##    ##       ##        Shell   bash 5.1.16
                              BLE     CardKB2 [CONNECTED]
                              ESPNOW  [ACTIVE] ch.6
                              RAM     16MB Flash / 32MB PSRAM
                              Display 1280Γ—720 IPS

πŸ› οΈ Hardware


M5Stack Tab5 β€” ESP32-P4, 5" 1280Γ—720 IPS
Component Spec
Main SoC ESP32-P4 Β· RISC-V dual-core 360 MHz + LP core 40 MHz
Wireless ESP32-C6-MINI-1U Β· Wi-Fi 6 / BLE 5 / Thread / Zigbee
Flash 16 MB
PSRAM 32 MB
Display 5-inch IPS TFT Β· 1280Γ—720 (720p) Β· ST7123 TDDI
Touch Capacitive Β· built-in to ST7123
Keyboard M5Stack CardKB2 Β· connected via UART
UART pins TX β†’ GPIO 53 / RX β†’ GPIO 54 Β· 115200 baud Β· HY2.0-4P port

⚠️ Current Status

Mode Status
UART (CardKB2 via HY2.0-4P) βœ… Works
Bluetooth HID (CardKB2 via BLE) 🚧 UI Present β€” Not Functional Yet

πŸš€ Getting Started

Prerequisites

Build & Flash

git clone <this-repo>
cd TerminalDemo

idf.py set-target esp32p4

idf.py -D SDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.bsp.m5stack_tab5" build

idf.py -p /dev/ttyUSB0 flash monitor

Wire the CardKB2

Connect the CardKB2 to Tab5's HY2.0-4P (PORT.A) socket:

CardKB2          HY2.0-4P (PORT.A)
  GND   ───────────── GND
  3.3V  ───────────── 5V
  TX    ───────────── G54  (UART RX)
  RX    ───────────── G53  (UART TX)

πŸ’‘ On the home screen, tap the UART card once to select it, then tap again to enter the terminal directly.


πŸ“± UI Flow

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚               🏠  Home Screen                β”‚
β”‚                                              β”‚
β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”       β”‚
β”‚   β”‚     UART     β”‚    β”‚ BLUETOOTH HIDβ”‚       β”‚
β”‚   β”‚  βœ… Working  β”‚    β”‚  🚧 WIP      β”‚       β”‚
β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚ tap UART card twice
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚               πŸ’»  Terminal                   β”‚
β”‚   Blinking cursor Β· colored output           β”‚
β”‚   Line numbers Β· scrollable Β· autocomplete   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

         (BLE path, WIP)
         β”‚ tap BLUETOOTH HID β†’ SCAN DEVICES
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚               πŸ”  Scan Screen                 β”‚
β”‚   Live BLE discovery Β· RSSI Β· device name    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚ tap CONNECT
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚          ⚑  Connecting...                   β”‚
β”‚          12-dot spinner animation            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

⌨️ Terminal Commands

Once in the terminal, the CardKB2 input appears in the bottom bar with a blinking cursor. Press Enter to run.

πŸ–₯ System

Command Returns
help All commands grouped by category
clear Clear the screen
neofetch Stylized system info banner
uname -a Linux tab5 5.15.0-esp32p4 #1 SMP PREEMPT
uptime Live uptime since boot
date Current date/time
pwd /home/tab5
whoami tab5

πŸ“ Files

Command Returns
ls bin etc home proc tmp usr
ls -la Detailed listing with permissions
cat /etc/motd Message of the day

🌐 Network

Command Returns
ifconfig wlan0 interface with IP/MAC
ping / ping 8.8.8.8 Animated 5-packet ping with RTT
ble status BLE connection state
espnow scan Simulated ESP-NOW node discovery

βš™οΈ Process

Command Returns
top Live FreeRTOS task table β€” CPU %, stack, name
ps Process snapshot

πŸŽ‰ Fun

Command Returns
fortune "Any sufficiently advanced bug is indistinguishable from a feature."
sudo Sorry, try again. Γ— 3
sudo rm -rf / Permission denied, phew.
reboot Fake reboot β†’ neofetch splash

⌨️ Keyboard Shortcuts

Key Action
Enter Execute command
Backspace Delete character
↑ / ↓ Command history (last 20)
Tab Autocomplete from catalog

πŸ“ Project Structure

TerminalDemo/
β”œβ”€β”€ main/
β”‚   β”œβ”€β”€ main.c                  # Entry: BSP init β†’ wireless β†’ UI
β”‚   β”œβ”€β”€ CMakeLists.txt
β”‚   β”œβ”€β”€ wireless/
β”‚   β”‚   β”œβ”€β”€ wireless_mgr.c/h    # Shared node list, WiFi/BLE init
β”‚   β”‚   β”œβ”€β”€ ble_mgr.c           # NimBLE HID central (CardKB2 BLE)
β”‚   β”‚   β”œβ”€β”€ espnow_mgr.c        # ESP-NOW scan & receive
β”‚   β”‚   └── uart_mgr.c/h        # UART driver (CardKB2, GPIO53/54)
β”‚   β”œβ”€β”€ ui/
β”‚   β”‚   β”œβ”€β”€ ui_common.h         # Colors, fonts, layout constants
β”‚   β”‚   β”œβ”€β”€ ui_home.c           # Home: UART / BT HID selection
β”‚   β”‚   β”œβ”€β”€ ui_scan.c           # BLE scan list
β”‚   β”‚   β”œβ”€β”€ ui_connect.c        # Connection spinner animation
β”‚   β”‚   β”œβ”€β”€ ui_connected.c      # Connected status page
β”‚   β”‚   └── ui_terminal.c       # Interactive terminal (500-line scrollback)
β”‚   └── assets/
β”‚       β”œβ”€β”€ fonts/              # Inter typeface β€” 14 weight/size variants
β”‚       └── images/             # Icons: arrows, BT logo, ESP-NOW, etc.
β”œβ”€β”€ readme/                     # Screenshots & demo GIF
β”œβ”€β”€ sdkconfig.defaults
β”œβ”€β”€ sdkconfig.bsp.m5stack_tab5
└── partitions.csv

🎨 Color Palette

Swatch Hex Role
🟧 #E07B39 Prompt Tab5@terminal : ~ $
🟨 #F0C27F User input
🟦 #60A5FA Info / headings
🟩 #4ADE80 Success
πŸŸ₯ #F87171 Error
🟑 #FBBF24 Warning
🟣 #E879F9 Highlight
⬛ #0E0E11 Background

πŸ”§ Customization

Add a command β€” in main/ui/ui_terminal.c:

} else if (strcmp(start, "hello") == 0) {
    term_append_line(T_SUCCESS, "Hello, world!");
}

Add it to the autocomplete catalog at the top of the same file:

static const char *s_cmd_catalog[] = {
    "help", "clear", ...,
    "hello",            // ← add here
};

Change UART pins β€” in main/wireless/uart_mgr.h:

#define UART_KB_TX_PIN      53
#define UART_KB_RX_PIN      54
#define UART_KB_BAUD_RATE   115200

πŸ“„ License

CC0-1.0 β€” public domain. Do whatever you like.


About

This is a project demo for Tab5, featuring a variety of interesting screen designs.

Resources

Stars

25 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages