Skip to main content
emobility.academy
B.Tech / BEDashboard & HMIIntermediate About 5 weeksKit only

Bilingual (English / Hindi) HMI Menu Framework with Custom LCD Characters

Build a menu framework for the 16×2 LCD that switches between English and Hindi, using custom characters for Devanagari glyphs within the display's eight-character limit. Strings live in language tables so new screens and languages can be added without touching the menu logic.

Uses: GPIO

The problem

Many EV riders and technicians in India are more comfortable in Hindi or another regional language, but low-cost vehicle displays are often character LCDs designed for Latin text. Supporting another script on such a display needs careful glyph design, a framework that separates text from logic and an honest view of what can and cannot be shown.

Objectives

  • Design a menu framework with screens, items and actions defined in tables
  • Store all user-facing text in language tables with an English and a Hindi set
  • Design Devanagari glyphs as 5×8 custom characters and load them per screen within the eight-slot limit
  • Let the user switch language from the keypad and remember the choice

What you need

From the EV Embedded Development Kit

  • STM32F103C8T6 microcontroller unit (main controller)
  • 16×2 LCD with contrast control
  • 4×3 matrix keypad
  • RGB LEDs and a buzzer

Software

  • STM32CubeIDE with HAL drivers
  • Embedded C
  • Python (optional, a glyph editor that outputs C arrays)

Extra parts

None. Everything this project needs is on the kit.

Key concepts

CGRAM limit
The character LCD controller holds only eight custom 5×8 characters at once, so a Hindi screen can use at most eight distinct custom glyphs.
Glyph design for Devanagari
Devanagari letters join with a top line and combine with vowel signs, so short words are drawn as a few custom cells, often spanning two cells per letter.
String tables
Arrays of text indexed by a string ID and language, so menu code refers to IDs and never contains text directly.
Per-screen glyph sets
Each screen lists the glyphs it needs; the framework loads that set into CGRAM when the screen opens.

Step-by-step guide

  1. 1

    Choose screens and vocabulary

    Choose a small but real menu: main screen, drive mode, battery, settings and language. List every word and short phrase needed. For Hindi, pick short words that fit the screen and keep within eight custom glyphs per screen; where a word cannot fit, use a common short form agreed with native speakers and document it. Use Latin digits if Devanagari digits would exceed the glyph budget, and state this choice.

    Checkpoint: A vocabulary table in English and Hindi with the glyph count per screen, all within eight.

  2. 2

    Board setup

    Enable the DIP switches for the LCD, keypad, LEDs and buzzer. In CubeMX set SYSCLK to 72 MHz, configure the LCD data and control GPIOs, keypad rows and columns and a 10 ms timer. Write or reuse an LCD driver with 4-bit initialisation, cursor positioning and CGRAM loading, and adjust the contrast. Keep the driver independent of the menu code.

    Checkpoint: An English test string displays clearly and a single custom character can be loaded and shown.

  3. 3

    Glyph design

    Design each Devanagari glyph on a 5×8 grid, using a simple Python tool or graph paper. Keep the top line consistent across glyphs so letters join visually. Test readability with native readers at normal viewing distance and redraw unclear glyphs. Export the glyphs as C arrays of eight bytes each. Keep a sheet with every glyph's slot, bytes and meaning, so glyphs can be reused across screens and changes are tracked.

    Checkpoint: Native readers identify every word on a test screen correctly.

  4. 4

    String and glyph tables

    Define string IDs as an enum. For English, store plain text. For Hindi, store each string as a sequence of codes where values 0–7 refer to custom glyph slots and others are standard characters. Give each screen a glyph-set table listing which glyphs go into which slots. Keep all tables in flash as const data. Keep the tables in one source file per language.

    Checkpoint: The tables compile and a test routine prints every string in both languages over UART as codes.

  5. 5

    Menu engine

    Define the menu as a table of screens, each with a title string ID, a list of items and an action for each item. Implement navigation with keypad keys: 2 and 8 to move, '#' to select, '*' to go back. The engine draws screens from string IDs and never contains text. Add a simple way to show values such as numbers inside strings, using a placeholder in the table, so the same engine handles labels and live readings in both languages.

    Checkpoint: The whole menu navigates correctly in English.

  6. 6

    Language switching

    When a screen opens, load its glyph set into CGRAM if the language is Hindi, then draw the strings. Add a language item in settings and a shortcut key. Store the language choice in a flash page with a checksum so it persists after power-off. Measure the time taken to switch screens in Hindi, including CGRAM loading, and confirm it feels instant. Test switching language while inside a sub-menu as well as from the main screen.

    Checkpoint: Switching to Hindi redraws every screen with correct glyphs, and the choice survives a power cycle.

  7. 7

    Handling the glyph limit

    Add a build-time or start-up check that each screen's glyph set has at most eight entries, and fail clearly if not. Avoid flicker when changing glyph sets by clearing the display before loading new glyphs. Test fast navigation between screens with different glyph sets. Where two screens share glyphs, keep them in the same slots to avoid reloading, and document the slot plan so future screens can follow it without breaking existing ones.

    Checkpoint: Rapid navigation shows no wrong glyphs or garbage characters.

  8. 8

    Feedback and alerts

    Add an alert screen that appears over any screen, such as low battery, in the active language, with a red LED and buzzer. Make sure the alert's glyphs are loaded with it and the previous screen's glyphs are restored after acknowledgement. Reserve one or two glyph slots for alert symbols across all screens if the budget allows, so an alert can appear without reloading the whole set, and test alerts arriving during a screen change.

    Checkpoint: An alert shows correctly in both languages and the previous screen returns intact.

  9. 9

    Usability test and report

    Ask native Hindi readers and English readers to complete set tasks, such as changing drive mode, and note errors and time taken. Document the framework, the glyph designs, the limits of a character LCD for Devanagari and how a graphic display would remove them. Record whether users preferred any English words left untranslated, such as technical terms, and use their feedback to refine the vocabulary.

    Checkpoint: A usability table and the documented framework are in the report.

Testing & validation

  • Every screen renders correctly in both languages
  • No screen exceeds the eight-glyph limit, checked automatically
  • Language choice persists across power cycles
  • Native readers complete tasks in Hindi without help

Expected results

A table-driven bilingual menu framework for the 16×2 LCD with a Devanagari glyph set, per-screen glyph loading and a persistent language setting, plus usability findings.

Take it further

  • Add a third language such as Marathi, which shares the Devanagari script, or Tamil with a new glyph set
  • Port the framework to the BMS OLED for richer Devanagari rendering with a pixel font
  • Generate glyphs and tables automatically from a text file
  • Add voice prompts with an audio module add-on

Viva and review questions

Why can't the LCD show any Hindi word?

Its character ROM has no Devanagari and only eight custom glyphs fit at once, so each screen must be designed within that budget.

Why keep text out of the menu code?

With string IDs and tables, adding a language or fixing a word means editing data only, and the menu logic stays the same.

How do you stop the wrong glyphs showing during a screen change?

We clear the display, load the new glyph set into CGRAM, then draw the new screen, so old characters never show with new glyph shapes.

Related EV projects

All 100 EV projects