This project implements a bidirectional protocol gateway between LIN and CAN buses to integrate repurposed OEM heated/ventilated seat button modules into a 2020 Ram 1500. The gateway translates button presses from the LIN bus into CAN messages for the vehicle's Body Control Module (BCM), and translates heat/vent intensity and backlighting commands from the CAN bus into LIN commands for the button module LEDs and backlighting.
Final Product: src/gateway/gateway.ino | Documentation
- Button Functionality - Controlling heat and vent settings
- Backlighting Integration - Buttons working in concert with center stack
├── src/ # Source code
│ ├── gateway/ # Final LIN-CAN gateway (production)
│ ├── BusSniffer/ # Bus capture tool for reverse engineering
│ └── test/ # Test sketches for protocol validation
├── docs/ # Documentation and analysis
│ ├── CAN_analysis/ # Python scripts for CAN protocol analysis
│ ├── LIN_analysis/ # Python scripts for LIN protocol analysis
│ └── references/ # Datasheets and connector terminations
├── HARDWARE.md # Hardware specifications and components
├── WIRING.md # Wiring diagrams and connections
├── MOUNTING.md # Enclosure and mounting information
├── METHODOLOGY.md # Software development methodology and approach
└── README.md # This file
Install these libraries via Arduino Library Manager:
- LIN_master_portable_Arduino by Georg Icking
- ESP32-TWAI-CAN by sorek (handmade0octopus)
- LIN to CAN: Translates button presses to CAN events (ID 0x302)
- CAN to LIN (LEDs): Translates heat/vent intensity commands (ID 0x31E) to button LED states
- CAN to LIN (Backlight): Translates brightness commands (ID 0x2FA) to button backlighting
- Button Debounce: 300ms debounce prevents multiple triggers
- Diagnostic LED: RGB LED provides visual feedback for system state
- LIN Bus: 19,200 baud, LIN 2.0, 50Hz polling rate
- CAN Bus: 125 kbps, normal mode (TX + RX)
- Power Consumption: ~0.36W (0.03A @ 12V)
- Security: WiFi and Bluetooth disabled
- Connect the ESP32 board to the vehicle's CAN bus and 12V DC power via the center stack display screen connector C1
- Connect the LIN bus to the seat button modules (dedicated LIN bus with only ESP32 and button modules)
Select the following board settings:
- Board: ESP32S3 Dev Module
- USB CDC On Boot: Enabled
- PSRAM: OPI PSRAM
- Upload Mode: USB-OTG CDC (TinyUSB)
- Open
src/gateway/gateway.ino - Upload to the board
- Open Serial Monitor at 115,200 baud to view diagnostic messages
| Function | Pin | Description |
|---|---|---|
| LIN TX | 10 | LIN transmit |
| LIN RX | 3 | LIN receive |
| LIN CS | 46 | LIN chip select (active high) |
| LIN FAULT | 9 | LIN fault detection |
| CAN TX | 11 | CAN transmit |
| CAN RX | 12 | CAN receive |
| LED R | 39 | Onboard red LED |
| LED G | 38 | Onboard green LED |
| LED B | 40 | Onboard blue LED |
| LIN Event | LIN ID | LIN Data | → | CAN ID | CAN Data |
|---|---|---|---|---|---|
| Driver Heat Press | 0xC4 | 0x41, 0xFF | → | 0x302 | [0, 2, 16, 0, 8, 0, 0, 0] |
| Driver Vent Press | 0xC4 | 0x11, 0xFF | → | 0x302 | [0, 2, 64, 0, 8, 0, 0, 0] |
| Passenger Heat Press | 0x80 | 0x88, 0xFF | → | 0x302 | [0, 2, 0, 4, 8, 0, 0, 0] |
| Passenger Vent Press | 0x80 | 0xA0, 0xFF | → | 0x302 | [0, 2, 0, 16, 8, 0, 0, 0] |
CAN ID 0x31E carries both driver (D0) and passenger (D1) states simultaneously:
Driver States (D0):
- 0 = Off → LIN 0xB1: [0x0C, brightness]
- 1-3 = Heat Low/Med/High → LIN 0xB1: [0x1C/0x2C/0x3C, brightness]
- 4/8/12 = Vent Low/Med/High → LIN 0xB1: [0x4C/0x8C/0xCC, brightness]
Passenger States (D1):
- 64 = Off → LIN 0x32: [0x09, brightness]
- 65-67 = Heat Low/Med/High → LIN 0x32: [0x49/0x89/0xC9, brightness]
- 68/72/76 = Vent Low/Med/High → LIN 0x32: [0x19/0x29/0x39, brightness]
CAN ID 0x2FA byte 2 (range: 0-200 decimal) is passed directly to LIN messages as the second byte.
| Color | Meaning |
|---|---|
| Green | Normal operation (idle) |
| Cyan flash | CAN message received |
| Magenta flash | Button press detected |
| Yellow | Initialization in progress |
| Red | Error state |
- Verify LIN connections and CS pin (should be HIGH)
- Check Serial Monitor for LIN polling activity
- Verify CAN bus connection and termination
- Check Serial Monitor for CAN RX messages on IDs 0x31E and 0x2FA
- Check CAN bus initialization status
- Verify CAN TX/RX pins and bus speed (125 kbps)
This project is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
You are free to:
- Share — copy and redistribute the material in any medium or format
- Adapt — remix, transform, and build upon the material
Under the following terms:
- Attribution — You must give appropriate credit
- NonCommercial — You may not use the material for commercial purposes
- ShareAlike — Derivatives must use the same license
See the LICENSE file for the full license text.
- Georg Icking for the LIN_master_portable_Arduino library
- sorek (handmade0octopus) for the ESP32-TWAI-CAN library
- SK Pang Electronics for the ESP32-S3 CAN & LIN Bus Board
- Claude Code (Anthropic) for development assistance
Projects In Motion, 2025