diff --git a/README.md b/README.md index a5e0160..b49e829 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,146 @@ [](https://git.lurenaud.com/lurenaud/VolvoRTI) -# VolvoRTI +# VolvoRTI — Android Auto Retrofit for Volvo RTI -Android-Auto retrofit for Volvo RTI using a Raspberry pi and crankshaft +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). - - +
+ Volvo RTI Retrofit Focused Screen + Volvo Screen installation in progress +
-## Satus: -Not working because of the too low resolution of the original screen. - \ No newline at end of file +> [!WARNING] +> **Status:** This setup faces display quality limitations when driving the original Volvo LCD screen directly due to its low resolution (typically 400x234). Replacing the internal screen panel with a high-resolution LCD while retaining the retractable motor housing is highly recommended. + +--- + +## 🛠️ 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)**. + +```mermaid +graph TD + %% Vehicles Inputs + SWM[Steering Wheel Module - LIN Bus] -- "LIN Frame ID 0x20" --> ATtiny[ATtiny84 Steering Controller] + CEM[Central Electronic Module - LIN] -- "LIN Keep-Alive Ping" --> ATtiny + + %% ATtiny Processing + ATtiny -- "RC-6 MCE IR Protocol (Bit-banged)" --> Pi_IR[Raspberry Pi GPIO 24 / IR Input] + + %% Pi Processing + subgraph Raspberry Pi 4 [Raspberry Pi 4 - LineageOS] + Pi_IR --> KM[KeyMapper / Input Dispatcher] + KM -- "Volume Up Trigger > 5s LIN Idle" --> SD[OS Shutdown Command] + 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 + + 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 KM,SD,Hotspot,AP software; +``` + +--- + +## 📁 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. + * `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. +* 📁 **`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. + +--- + +## ⚙️ 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. + +#### 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 | +| :--- | :--- | :--- | :--- | :--- | +| **UP** | `d0 & 0x01` | `1` | `0x800f041e` | Navigate Up | +| **DOWN** | `d0 & 0x02` | `2` | `0x800f041f` | Navigate Down | +| **LEFT** | `d0 & 0x04` | `3` | `0x800f0420` | Navigate Left | +| **RIGHT** | `d0 & 0x08` | `4` | `0x800f0421` | Navigate Right | +| **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`). + +--- + +### 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. + +* **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. + +--- + +### 3. Raspberry Pi Customization (`Raspberry`) + +#### Key Event Remapping +To receive the direct-wired IR signal from the ATtiny, the Pi utilizes `ir-keytable` with a custom mapping profile: +* **Configuration File**: [`Raspberry/rc-rc6-mce.toml`](Raspberry/rc-rc6-mce.toml) +* **Command KeyMapper Setup**: + ```bash + # Enable accessibility service for KeyMapper + adb shell settings put secure accessibility_enabled 1 + adb shell settings put secure enabled_accessibility_services io.github.sds100.keymapper/.system.accessibility.MyAccessibilityService + + # Map the Volume Up trigger to execute: + reboot -p + ``` + +#### Wi-Fi Hotspot Auto-start at Boot +To establish wireless Android Auto on boot, a custom init script starts the Wi-Fi hotspot automatically on startup: +* **Boot script** (`/system/bin/start_hotspot.sh`): + ```sh + #!/system/bin/sh + while [ "$(getprop sys.boot_completed)" != "1" ]; do + sleep 1 + done + sleep 5 + cmd wifi start-softap VolvoC70_AndroidAuto wpa2 123456789 + ``` +* **Init configuration** (`/system/etc/init/start_hotspot.rc`): + ```rc + service start_hotspot /system/bin/sh /system/bin/start_hotspot.sh + class main + user root + group root system wifi + oneshot + disabled + + on property:sys.boot_completed=1 + start start_hotspot + ``` + +--- + +## 📷 Gallery & Renderings + +### System Overview Diagram +![System Diagram](Photos/system_diagram.png) + +### Prototype Hardware +
+ PCB Front-side Build + Pi Shield Assembled +
\ No newline at end of file