Integrate RTI screen control and button combinations into LIN_to_IR firmware

This commit is contained in:
2026-05-31 13:37:19 +02:00
parent 925096a698
commit 4f264e1cda
2 changed files with 153 additions and 48 deletions
+29 -24
View File
@@ -2,7 +2,7 @@
# VolvoRTI — Android Auto Retrofit for Volvo RTI
An integrated Android Auto retrofit system for the retracting Volvo Road and Traffic Information (RTI) navigation screen. Using a Raspberry Pi 4, custom microcontrollers, custom PCB routing, and 3D-printed mechanical enclosures, this project aims to replace the legacy navigation unit with a modern infotainment hub running LineageOS (Android).
An integrated Android Auto retrofit system for the retracting Volvo Road and Traffic Information (RTI) navigation screen. Using a Raspberry Pi 4, custom microcontrollers, custom PCB routing, and 3D-printed mechanical enclosures, this project replaces the legacy navigation unit with a modern infotainment hub running LineageOS (Android).
<div align="center">
<img src="Photos/focused.png" height="300" alt="Volvo RTI Retrofit Focused Screen">
@@ -16,16 +16,17 @@ An integrated Android Auto retrofit system for the retracting Volvo Road and Tra
## 🛠️ System Architecture
The retrofit consists of three key layers working in unison: **vehicle bus integration (LIN)**, **screen power/command control (RTI Serial)**, and the **core computer (Raspberry Pi 4)**.
The retrofit consists of two key layers working in unison: the **ATtiny84 Controller** (vehicle bus decoding + screen motor control) and the **core computer** (Raspberry Pi 4 running Android).
```mermaid
graph TD
%% Vehicles Inputs
SWM[Steering Wheel Module - LIN Bus] -- "LIN Frame ID 0x20" --> ATtiny[ATtiny84 Steering Controller]
SWM[Steering Wheel Module - LIN Bus] -- "LIN Frame ID 0x20" --> ATtiny[ATtiny84 Controller]
CEM[Central Electronic Module - LIN] -- "LIN Keep-Alive Ping" --> ATtiny
%% ATtiny Processing
%% ATtiny Processing & Control
ATtiny -- "RC-6 MCE IR Protocol (Bit-banged)" --> Pi_IR[Raspberry Pi GPIO 24 / IR Input]
ATtiny -- "2400 Baud Serial Control" --> Screen[Volvo RTI Retractable Screen]
%% Pi Processing
subgraph Raspberry Pi 4 [Raspberry Pi 4 - LineageOS]
@@ -34,13 +35,12 @@ graph TD
Hotspot[Init Services] -- "Auto-start on Boot" --> AP[Wi-Fi AP: VolvoC70_AndroidAuto]
end
%% Screen Control
ATmega[Arduino Screen Controller] -- "2400 Baud Serial Control" --> Screen[Volvo RTI Retractable Screen]
Pi_Video[Raspberry Pi HDMI] -- "VGA / RGBS Video Signal" --> VideoMux[Video Mux] --> Screen
%% Video Routing
Pi_Video[Raspberry Pi HDMI] -- "HDMI Video Signal" --> Screen
classDef hardware fill:#f9f,stroke:#333,stroke-width:2px;
classDef software fill:#bbf,stroke:#333,stroke-width:2px;
class SWM,CEM,ATtiny,ATmega,Screen,VideoMux hardware;
class SWM,CEM,ATtiny,Screen hardware;
class KM,SD,Hotspot,AP software;
```
@@ -49,10 +49,10 @@ graph TD
## 📁 Repository Structure
* 📁 **`Arduino/`**: Microcontroller firmware written for the Arduino ecosystem.
* `LIN_to_IR/`: Decodes Steering Wheel Module (SWM) buttons from the LIN bus and outputs RC-6 Mode 6A IR commands to control Android. Monitors LIN inactivity to signal shutdown.
* `RTI_Control/`: Drives the serial protocol of the Volvo retractable screen, sending commands to raise the screen, set brightness, and keep it active.
* `LIN_to_IR/`: The unified controller firmware. Decodes Steering Wheel Module (SWM) buttons from the LIN bus, outputs RC-6 Mode 6A IR commands to control Android, and drives the Volvo screen motor serial interface (automatic opening/closing, toggle, and car power state detection).
* `RTI_Control/`: Legacy screen-only driver firmware (retains original standalone serial protocol testing logic).
* `IR_remote_test/`: Test firmware for verifying RC-6 IR signal generation.
* 📁 **`Kicad/`**: Schematic, PCB layout, footprints, and Gerber files for a custom Raspberry Pi shield designed to host the MCP2004 LIN transceiver, video muxing, and power routing.
* 📁 **`Kicad/`**: Schematic, PCB layout, footprints, and Gerber files for a custom Raspberry Pi shield hosting the MCP2004 LIN transceiver, video routing, and power control.
* 📁 **`CAD/`**: SolidWorks 3D CAD design files (`.SLDASM`, `.SLDPRT`) and 3D-printable `.STL` files for the custom mechanical Pi enclosure (`case_top` & `case_bottom`).
* 📁 **`Raspberry/`**: Configuration scripts and mapping files for LineageOS/Android, including custom `ir-keytable` mappings and key event hooks.
* 📁 **`Photos/`**: High-quality hardware builds, installation logs, and system diagrams.
@@ -61,13 +61,20 @@ graph TD
## ⚙️ Detailed Module Breakdown
### 1. Steering Wheel Integration (`Arduino/LIN_to_IR`)
The **ATtiny84** intercepts steering wheel buttons from the Steering Wheel Module (SWM) on LIN frame `0x20`. These button actions are translated into bit-banged RC-6 Mode 6A (MCE Remote) signals and fed directly to the Raspberry Pi.
### 1. Steering & Screen Integration (`Arduino/LIN_to_IR`)
The **ATtiny84** is the central hardware coordinator. It decodes steering wheel buttons from the LIN bus (`0x20`), controls the screen's extension motor via serial commands, and signals the Raspberry Pi using IR commands.
#### Core Behaviors & Logic
* **Startup Extension**: The screen automatically opens upon startup (ignition on).
* **Manual Screen Toggle**: Pressing **BACK + ENTER** at the same time toggles the screen between fully open and fully closed states.
* **Manual Sleep Command**: Pressing **RIGHT + ENTER** at the same time sends a Volume Down IR command to put the Raspberry Pi to sleep.
* **Smart Power-down (Car-Off Detection)**: The ATtiny monitors LIN traffic. If no LIN communication is detected for **5 seconds**, the system automatically retracts the screen and sends a Volume Up IR command 3 times to trigger a clean Raspberry Pi OS shutdown.
#### Button Map & Command Codes
When buttons are pressed, the ATtiny transmits the corresponding Microsoft MCE remote scancodes:
| Button | LIN Frame Trigger | Active Button Code | MCE Scancode | Action on LineageOS |
| Input / Combo | LIN Frame Trigger | Active Button Code | MCE Scancode | Action on LineageOS / Hardware |
| :--- | :--- | :--- | :--- | :--- |
| **UP** | `d0 & 0x01` | `1` | `0x800f041e` | Navigate Up |
| **DOWN** | `d0 & 0x02` | `2` | `0x800f041f` | Navigate Down |
@@ -76,20 +83,18 @@ When buttons are pressed, the ATtiny transmits the corresponding Microsoft MCE r
| **ENTER** | `d1 & 0x08` | `5` | `0x800f0422` | Select / OK |
| **BACK** | `d1 & 0x01` | `6` | `0x800f0423` | Back / Exit |
| **Volume Up (Shutdown)** | LIN Silent > 5s | `7` | `0x800f0410` | Trigger Soft Shutdown |
#### Smart Power-down (Car-Off Detection)
To avoid battery drain, the system implements automated shutdown:
* The ATtiny monitors LIN traffic. Since the car's Central Electronic Module (CEM) continuously polls the LIN bus when the ignition is on, active communication indicates the vehicle is running.
* If no LIN serial data is detected for **5 seconds**, the ATtiny assumes the car is off, changes state, and sends the MCE code `0x800f0410` (`KEY_VOLUMEUP`) 3 times to guarantee receipt.
* Android intercepts this key and shuts down cleanly via the command line (`reboot -p`).
| **BACK + ENTER** | Both buttons held | `8` | *None (Local)* | Toggles Screen Motor (Open/Close) |
| **RIGHT + ENTER** | Both buttons held | `9` | `0x800f0411` | Send Sleep / Volume Down |
---
### 2. Retractable Screen Serial Driver (`Arduino/RTI_Control`)
The Volvo RTI screen requires continuous serial commands at **2400 baud** over a single communication line to stay awake and raised. The screen controller script performs this keep-alive task.
### 2. Retractable Screen Serial Driver
* **Display Modes**: Configurable via display mode hex codes (RGB: `0x40`, PAL: `0x45`, NTSC: `0x4C`, Screen Off/Retract: `0x46`).
* **Brightness Control**: Employs a 16-level hex sequence (`0x20` to `0x2F` / `0x6E`) to adjust the backlighting dynamically.
The Volvo RTI screen housing requires continuous serial packets at **2400 baud** over a single communication line to stay awake and raised.
* **Display ON sequence**: `0x4C` (NTSC), `0x2F` (max brightness), `0x83` (execute).
* **Display OFF sequence**: `0x46` (OFF), `0x00` (min brightness), `0x83` (execute).
* **Keep-Alive Periodicity**: The ATtiny84 continuously writes these 3-byte command packets at a non-blocking 100ms interval (one byte every 100ms) to ensure smooth operation without blocking LIN bus reception.
---