IR Bridge
Ericsson MC218 ↔ Flipper Zero ↔ LLM
Overview · Architecture · Protocol · Hardware · Building · Usage · Limitations · Repository  |  Radio Bargain

A working bridge that allows an Ericsson MC218 — a 1999 palmtop running EPOC Release 5 — to converse with a large language model via its built-in infrared port. The user types a question on the Psion keyboard; the message travels by IR to a Flipper Zero, which relays it over UART to an ESP32; the ESP32 queries an LLM over WiFi; and the response returns along the same path to appear on the palmtop's screen.

The MC218 uses a proprietary serial connector that has been out of production for twenty-five years. This project eliminates the need for any cable by using IrDA for bidirectional communication with modern infrastructure. No additional IR hardware is required: the Psion's built-in IrDA transceiver and the Flipper's TSOP receiver and IR LED are used directly, pointed at one another at a distance of ten to thirty centimetres.

Architecture

The signal chain is as follows:

Ericsson MC218
  |  IR (5-bit PWM, IrDA connect bursts)
  v
Flipper Zero  (IR Bridge FAP)
  |  UART 115200 baud
  v
ESP32-S2 WiFi Devboard
  |  HTTPS / OpenRouter API
  v
LLM (OpenRouter)
  |
  v  response returns same path
Ericsson MC218

The Psion transmits using a 5-bit pulse-width modulation scheme built on top of IrDA connection attempt bursts. The Flipper decodes these pulses, assembles the message, and forwards it to the ESP32 as a simple newline-terminated ASCII frame. The ESP32 queries the LLM and returns the response over the same UART link. The Flipper then re-encodes the text as pulse-width IR at 36 kHz carrier and transmits it back; the Psion reads this on its IrDA serial port (TTY:B) at 4800 baud.

Protocol

Psion → Flipper (5-bit PWM).  Each character is encoded as seven IrDA connection attempt bursts. The inter-burst gap encodes the data: a start space of approximately 1955 ms, followed by five data bits (A=0 through Z=25, space=26, MSB first) where a short gap (~1205 ms) represents 0 and a longer gap (~1505 ms) represents 1, and a sixth parity bit (even). End of message is signalled by an extra flash followed by a two-second silence.

Why IrDA connect attempts rather than ordinary serial data? The Psion's TSOP-like receiver cannot decode SIR protocol from non-EPOC devices, but it can detect IrDA connection attempt bursts as IR activity. Each call to IrDAConnectToSend&: in OPL produces a detectable flash. This is, in effect, an abuse of the IrDA handshake mechanism as a low-bandwidth data channel.


 Component OPL PAUSE Actual gap
Start space PAUSE 20 (1000 ms) ~1955 ms
Bit = 0 PAUSE 5 (250 ms) ~1205 ms
Bit = 1 PAUSE 11 (550 ms) ~1505 ms
Parity space PAUSE 5 or 11 ~1205 or ~1505 ms

Flipper-side thresholds: bit 1 ≥ 1350 ms, start ≥ 1730 ms, timeout = 4000 ms.

Flipper → Psion (pulse-width IR + EOT).  Each ASCII byte is encoded as eight mark/space pairs at 36 kHz carrier. A start mark of 50 ms, data marks of 10 ms (for 0) or 26 ms (for 1), and an end mark of 75 ms, with 5 ms spaces between all marks. The Psion's SIR decoder on TTY:B at 4800 baud interprets the resulting byte values: ≥ $E0 = bit 1, ≤ $90 = bit 0. End of message is byte 0x04 (ASCII EOT). Data is sent in chunks of 63 bytes. Maximum response length: 200 characters.


 Symbol Mark duration
Start 50 ms
Bit 0 10 ms
Bit 1 26 ms
End 75 ms
Space between marks 5 ms

Flipper ↔ ESP32 (UART).  115200 baud, newline-terminated ASCII. The Flipper sends Q:<text>\n for queries and PING\n for heartbeats. The ESP32 replies with R:<text>\n for responses, S:<status>\n for status, and E:<reason>\n for errors. The advanced bridge sketch supports an RPC opcode table via OP:HH:params\n frames.

Hardware

 Component Notes
Ericsson MC218 EPOC Release 5, OPL. Built-in IrDA port.
Flipper Zero Stock firmware with IR subsystem.
Flipper WiFi Devboard Official ESP32-S2-WROVER. Plugs into Flipper header.

No additional IR hardware is needed. Point the Psion's IrDA window at the Flipper's IR transceiver, ten to thirty centimetres apart.

Building

Flipper application.

cd flipper/ir_bridge
ufbt
# copy dist/ir_bridge.fap to
# SD: /ext/apps/Infrared/

ESP32 sketch.  Edit esp32/simple_bridge/simple_bridge.ino and set WiFi credentials and OpenRouter API key. Then:

arduino-cli compile \
  --fqbn "esp32:esp32:esp32s2:CDCOnBoot=cdc" \
  esp32/simple_bridge/ \
  --output-dir build

Flash: hold BOOT on devboard, press RESET, flash with esptool, power-cycle.

Psion OPL programme.  Requires the EPOC SDK with OPLTRAN.EXE (runs under Wine on macOS and Linux):

unix2dos psion/irchat.opl
wine path/to/OPLTRAN.EXE "C:\\irchat.opl"
# copy irchat.opo to Psion via
# IR, cable, or CF card

The OPL source uses INCLUDE "SYSTEM.OXH" for IrDA functions.

Usage

Flash the IR Bridge FAP to the Flipper and launch it from the Infrared category. Power the ESP32 devboard; it will connect to WiFi and report S:WIFI_OK. On the Psion, run irchat.opo, type a message (A–Z and spaces), and press Enter. The Psion transmits via IR — the Flipper's screen shows a callback counter — then enters listening mode. The Flipper dispatches the query to the ESP32, which queries the LLM; the response arrives back on the Psion's screen. The programme then prompts for the next message.


 Button Action
OK Send received message to LLM
Left Clear display / reset state
Right Ping ESP32
Back Exit application

Known Limitations

The Psion transmit alphabet is restricted to A–Z and space; there are no numerals or punctuation. IrDA connect overhead of approximately 955 ms per burst results in a throughput of roughly 3.5 seconds per character. LLM responses are capped at 200 characters by the IR transmit buffer constraint (MAX_TIMINGS_AMOUNT=1024). The Psion receives only the first burst of a multi-burst response owing to blocking I/O in OPL with no asynchronous timeout. The infrared_send_raw_ext timing is approximate; long transmissions may drift. TTY:B may be busy after IrDA TX; the Psion retries up to fifteen times over seventy-five seconds.

Repository

Source code and documentation are at
github.com/R2BPW/psion-flipper-bridge.

psion/
  irchat.opl            OPL chat programme

flipper/ir_bridge/
  ir_bridge.c           Flipper Zero FAP source
  application.fam       app manifest

esp32/
  llm_bridge/           advanced bridge (RPC)
  simple_bridge/        minimal bridge

docs/
  PROTOCOL.md           protocol specification
  HARDWARE.md           wiring notes
  OPL_NOTES.md          EPOC OPL compilation

github.com/R2BPW/psion-flipper-bridge