---
# System prepended metadata

title: How to control phone screen with microcontroller?
tags: [Microcontroller]

---

“Control the phone screen” can mean two very different things. Pick the path that matches your goal:

![FJQO0EVJHKTOHP8](https://hackmd.io/_uploads/ry1TMidyZx.jpg)

**A) Use the phone as your display (recommended)**

You don’t drive the phone’s LCD directly; instead the [microcontroller](https://www.ampheo.com/c/microcontrollers) sends data and the phone app renders the UI.

**Best options**

**1. Bluetooth Low Energy (BLE UART / custom GATT)**

* MCU: ESP32 / [nRF52](https://www.onzuu.com/search/nRF52) / [STM32WB](https://www.ampheo.com/search/STM32WB) / any BLE adapter.
* Phone: small app (or generic “BLE UART/serial” app) subscribes and draws gauges/graphs.
* Steps:
  * Expose a GATT service (e.g., TX/RX characteristics).
  * Phone connects → subscribes to notifications → MCU notify() [sensor](https://www.ampheo.com/c/sensors) values at 5–50 Hz.
  * Phone draws charts/tiles and handles touch UI.

**2. Wi-Fi + Web UI**

* MCU runs a tiny HTTP/WebSocket server or publishes to MQTT.
* Phone opens a web page (no install) that shows live data and controls.

**3. USB (Serial)**

* MCU appears as CDC/ACM.
* Android with OTG reads serial and an app renders the UI.

**Control the phone UI (buttons, navigation)**

* Present the MCU as a HID keyboard/mouse:
  * BLE HID works with Android and iOS (keyboard always; mouse/pointer on iOS needs Accessibility).
  * USB HID works on Android via OTG; limited on iOS.
* Send key events (volume, arrows, Enter) or pointer moves/clicks to “control” the screen.

**B) Drive a phone’s raw screen from an MCU (usually not practical)**

Phone panels are almost always MIPI-DSI + MIPI D-PHY at hundreds of Mb/s per lane. Typical microcontrollers cannot output DSI.

To do it anyway you need:

* An RGB/SPI-to-MIPI bridge (e.g., SSD2828 class) or an [FPGA](https://www.ampheo.com/c/fpgas-field-programmable-gate-array) with D-PHY/DSI IP.
* Panel power rails (1.8 V/2.8 V), LED backlight driver, reset/enable sequencing.
* The panel’s DSI init sequence (often NDA).

This is advanced/fragile; far easier to pick an MCU-friendly display (SPI TFT like ST7789/ILI9341, or parallel RGB) or use a module with a built-in bridge.

**Quick recipes**
**1) BLE “phone as dashboard” (ESP32 example pseudocode)**
```
// Create BLE UART (NUS-like) service; notify sensor JSON lines
startBLE("MyMCU");
createService("UART");
addCharacteristic("TX", NOTIFY);
loop {
  String msg = String("{\"temp\":") + temp + ",\"rpm\":" + rpm + "}";
  notify("TX", msg);
  delay(100);
}
```


Phone app subscribes and renders gauges.

**2) HID keyboard over BLE (simulate button presses)**

* MCU library: BLE HID profile.
* Map your buttons → HID keycodes (e.g., Volume Up/Down, Arrow keys).
* Phone receives them like a Bluetooth keyboard.

**3) USB-Serial to Android**

* Cable: USB-C OTG (phone must support host mode).
* MCU shows up as CDC; Android app reads at 115200+ baud and plots.

**Choose based on your target**

* Fastest to prototype UI: BLE UART → phone app/web page.
* Need to remote-control the phone: BLE/USB HID (keyboard/mouse).
* Absolute lowest latency graphics from MCU: Don’t use a phone; use an MCU-friendly SPI/RGB TFT.
* Must reuse a phone panel: Budget for bridge/[FPGA](https://www.ampheoelec.de/c/fpgas-field-programmable-gate-array) + power/DSI bring-up (complex).