Add wiki second brain and root CLAUDE.md; retire .docs
- New wiki/ (Obsidian vault) following the LLM Wiki pattern: schema, index, log, entity page for the board, concept pages for the A->B link, wired+wireless redundancy, and Patrol gauge outputs, open questions, two sources - New CLAUDE.md distilled from the surviving .docs content: verified pins, brightness/receiver/debug APIs, SquareLine rules, CH343 serial notes, gear-enum drift warning, Waveshare demo and schematic URLs - Delete .docs/ (14 files): stale pin-hunting and troubleshooting guides, wrong header table, finished phase roadmap, duplicate UART spec (now in the 5B repo at docs/UART_PROTOCOL.md) - README.md repointed to CLAUDE.md and wiki/ Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
---
|
||||
type: concept
|
||||
tags: [link, uart, protocol, architecture]
|
||||
updated: 2026-09-21
|
||||
---
|
||||
|
||||
# Controller Link (A → B)
|
||||
|
||||
The system is two ESP32-S3 boards. Controller A (Waveshare ESP32-S3-Touch-LCD-5B, sibling repo) reads the BMW PT-CAN bus and owns all decoding; Controller B ([[esp32-s3-lcd-1-3]], this repo) is a **slave / extension**: it consumes a compact packet, displays it, and will drive the Patrol gauges from it ([[patrol-gauge-outputs]]).
|
||||
|
||||
```
|
||||
BMW PT-CAN ──▶ Controller A (5B) ──UART 5 Hz──▶ Controller B (1.3)
|
||||
╰── BLE (planned, redundant) ──╯ → [[link-redundancy]]
|
||||
```
|
||||
|
||||
Architecture rule: **B never touches CAN.** Anything B needs must be put into the packet by A. See `(sibling: 5B wiki → dual-controller-architecture)` for A's view of the same link.
|
||||
|
||||
## Wire-level contract (repo, both repos' `include/protocol/automotive_data.h` and `docs/UART_PROTOCOL.md` (5B repo))
|
||||
|
||||
- 115200 8N1, 3.3 V TTL, one direction A → B, 5 Hz (every 200 ms)
|
||||
- Frame: `0xAA` · version `0x01` · length `0x12` · 18-byte payload · XOR checksum · `0x55` = **23 bytes**
|
||||
- Payload (little-endian): `packet_id` u8 · `timestamp_ms` u32 · `gear_position` u8 · `gearbox_oil_temp` i16 (0.1 °C) · `engine_oil_temp` i16 (0.1 °C) · `coolant_temp` i16 (0.1 °C) · `battery_voltage` u16 (0.01 V) · `fault_codes` u16 bitmap · `valid_flags` u8 · `debug_enabled` u8
|
||||
- B declares the link **lost after 1000 ms** without a valid packet and shows a no-data state `(repo)`; A only transmits while its CAN task is running (CAN toggle ON → UART auto-starts) `(repo)`
|
||||
|
||||
### What each field actually carries today (sibling: 5B wiki → can-id-candidates)
|
||||
|
||||
| Field | Source on A | Status |
|
||||
|---|---|---|
|
||||
| `coolant_temp` | CAN 0x1D0 byte 0, raw − 48 | verified live |
|
||||
| `gearbox_oil_temp` | CAN 0x0B5 byte 7, raw − 40 | verified live |
|
||||
| `engine_oil_temp` | CAN 0x1D0 byte 1 | **dead — sensor not fitted on this M57N, reads 0xFF**; B will never get a real value |
|
||||
| `gear_position` | CAN 0x1D2 lever/mode + 0x0BA target gear | verified live |
|
||||
| `battery_voltage` | CAN 0x3B4, 12-bit × 0.015 V | verified live |
|
||||
| `fault_codes` | A's own derived faults (bit 0 = lever vs gearbox mismatch), **not** DDE DTCs | `(repo)` |
|
||||
| RPM | **not in the packet** — A has it verified from CAN 0x0AA but the protocol has no field | needed by [[patrol-gauge-outputs]] |
|
||||
|
||||
## Pins
|
||||
|
||||
- A transmits on **GPIO 44** (`uart_manager.cpp`, `UART_TX_PIN 44`) `(repo)`; RX 43 unused
|
||||
- B receives on **IO1** (left header, pin 4), TX IO2 unused `(repo)`
|
||||
|
||||
> [!warning] Two docs said A transmits on GPIO 43 (both fixed or deleted 2026-09-21)
|
||||
> The 5B repo's root `CLAUDE.md` (corrected 2026-09-21) and this repo's former `.docs/UART_WIRING_GUIDE.md` (deleted 2026-09-21) both said "GPIO 43 TX". The 5B firmware and `docs/UART_PROTOCOL.md` (5B repo) say **44**. The code wins `(repo)`.
|
||||
|
||||
> [!warning] GPIO 44 on the 5B is not a bare pin — it feeds an RS485 transceiver
|
||||
> On the 5B schematic, IO44 is the `RS485_TXD` net into an SP3485 with automatic direction control, and only the differential **A/B pair** reaches the terminal block `(sibling: 5B wiki → esp32-s3-touch-lcd-5b)`. Both wiring guides describe a direct "GPIO 44 → IO1 + GND" TTL wire, which the 5B does not physically expose. So either (a) the RS485 A line is being fed straight into B's TTL input and happens to work, (b) there is an RS485→TTL module on the B side that the docs don't mention, or (c) the wire is soldered to the module pin. **Which one is true is unknown** `(unverified)` and it decides how robust the wired link is in the car → [[open-questions]] #1, [[link-redundancy]].
|
||||
|
||||
## Protocol drift between the two repos
|
||||
|
||||
> [!warning] The `gear_position_t` enums differ `(repo, 2026-09-21)`
|
||||
> - **B's header** (matches `docs/UART_PROTOCOL.md` (5B repo)): 0 P · 1 R · 2 N · 3 D · **4 Sport · 5 Manual** · 6–13 M1–M8 · 14 Error
|
||||
> - **A's header** (rewritten during CAN decoding): 0 P · 1 R · 2 N · 3 D · **4–9 M1–M6** · 0xFF Unknown
|
||||
>
|
||||
> Same byte on the wire, different meanings: a value of 4 is "Sport" to B and "1st gear" to A. One side must be changed and `PACKET_VERSION` bumped. Which side is correct depends on what A's CAN parser actually emits now — check its `can_driver.cpp` before touching B.
|
||||
|
||||
Also note A's protocol header now says all CAN IDs are 11-bit and the old placeholder map is dead; B's copy of the header still carries the placeholder CAN section. Harmless (B never parses CAN) but confusing — strip it when the enums are reconciled.
|
||||
|
||||
## Change discipline
|
||||
|
||||
Any new signal (RPM first) means, in order: add the field and a `valid_flags` bit on A → bump `PACKET_VERSION` → copy the header to B → B rejects packets with an unexpected version → B's UI/gauge code consumes the field. The version byte exists precisely so a stale B fails loudly instead of misreading bytes.
|
||||
|
||||
## Related
|
||||
|
||||
[[esp32-s3-lcd-1-3]] · [[link-redundancy]] · [[patrol-gauge-outputs]] · [[open-questions]]
|
||||
@@ -0,0 +1,76 @@
|
||||
---
|
||||
type: entity
|
||||
tags: [hardware, waveshare, display, gpio]
|
||||
updated: 2026-09-21
|
||||
---
|
||||
|
||||
# Waveshare ESP32-S3-LCD-1.3
|
||||
|
||||
Controller B of the [[controller-link]] — the compact secondary unit. Receives the sensor stream from Controller A, shows it on a 1.3" round-masked display, and is the board chosen to drive the Patrol cluster gauges ([[patrol-gauge-outputs]]) because it is the only one of the two with free hardware-PWM pins on a header.
|
||||
|
||||
## Specs (source: waveshare-wiki-esp32-s3-lcd-1-3)
|
||||
|
||||
- ESP32-S3R8: Xtensa LX7 dual-core @ 240 MHz, 512 KB SRAM, 384 KB ROM
|
||||
- 16 MB external flash, 8 MB PSRAM (firmware builds with `qio_opi` memory type `(repo)`)
|
||||
- 1.3" IPS LCD, 240×240, 262K colour, ST7789VW over SPI; the "round" look is a software circular mask `(repo)`
|
||||
- QMI8658 six-axis IMU (accelerometer + gyro) on I2C — pins not stated by the wiki; unused by firmware `(repo)`
|
||||
- TF card slot — pins not stated by the wiki; unused by firmware `(repo)`
|
||||
- 2.4 GHz Wi-Fi 802.11 b/g/n + **Bluetooth 5 (BLE)**, onboard ceramic patch antenna — the basis of the BLE half of [[link-redundancy]]
|
||||
- USB Type-C with a **CH343 USB-serial bridge** (WCH-CH343DS1), not native USB-CDC. Debug `Serial` therefore rides UART0 `(repo)`
|
||||
- Power: 5 V over USB-C; MX1.25 single-cell LiPo connector with PL4054 charger and charge LED; ME6217C33M5G 3.3 V LDO rated 800 mA max
|
||||
- "16PIN GPIO lead-out" = the two 8-pin headers below
|
||||
- Operating temperature, power draw, dimensions and weight: **not stated** on the product wiki `(source: waveshare-wiki-esp32-s3-lcd-1-3)` → [[open-questions]]
|
||||
|
||||
## Header pinout (verified from the Waveshare pinout photo, [[pinout-photo-details-7]])
|
||||
|
||||
Two 8-pin 2.54 mm headers, one per side, viewed with the USB-C at the top:
|
||||
|
||||
| Left header (top→bottom) | Right header (top→bottom) |
|
||||
|---|---|
|
||||
| 5V | IO14 |
|
||||
| GND | IO13 |
|
||||
| 3V3 (OUT) | IO12 |
|
||||
| IO1 | IO11 |
|
||||
| IO2 | IO10 |
|
||||
| IO3 | IO9 |
|
||||
| IO4 | IO8 |
|
||||
| IO5 | IO7 |
|
||||
|
||||
Waveshare marks every one of the 13 GPIOs as UART / PWM / I2S / ADC / I2C / SPI capable — i.e. plain ESP32-S3 pins routed through the GPIO matrix, no fixed function.
|
||||
|
||||
> [!warning] The former `.docs/UART_WIRING_GUIDE.md` (deleted 2026-09-21) listed a 13-pin header carrying IO35–IO42 `(repo)`. That is wrong: IO38–IO42 are the display's SPI lines and never reach a header, and IO35–37 are the OPI PSRAM bus. The photo is the authoritative pinout.
|
||||
|
||||
## GPIO budget
|
||||
|
||||
Internally committed `(repo)`:
|
||||
|
||||
| GPIO | Function |
|
||||
|---|---|
|
||||
| 40 / 41 | LCD SCLK / MOSI |
|
||||
| 38 / 39 / 42 | LCD DC / CS / RST |
|
||||
| 20 | LCD backlight, LEDC PWM 0–255 (default 128) |
|
||||
| 43 / 44 | UART0 to the CH343 USB bridge = debug console `(unverified — inferred from the CH343 being on UART0)` |
|
||||
| 35–37 | OPI PSRAM `(unverified — standard for R8 modules)` |
|
||||
|
||||
Header GPIOs and their current use `(repo)`:
|
||||
|
||||
| GPIO | Use today | Note |
|
||||
|---|---|---|
|
||||
| IO1 | UART1 RX from Controller A | keep |
|
||||
| IO2 | UART1 TX (link is receive-only, so idle) | effectively free |
|
||||
| IO3 | free | S3 strapping pin (JTAG select) — avoid |
|
||||
| IO4, IO5 | free | |
|
||||
| IO7–IO14 | free | proposed home of the gauge outputs → [[patrol-gauge-outputs]] |
|
||||
|
||||
Net: **10 clean, unconstrained GPIOs** (IO4, IO5, IO7–IO14) plus IO2 and IO3 with caveats.
|
||||
|
||||
## Firmware-side facts worth knowing (repo)
|
||||
|
||||
- Display driven by LovyanGFX 1.1 + LVGL 8.4.0, 80 MHz SPI write; LVGL task on Core 1, UART receiver on Core 0
|
||||
- Warning thresholds baked in: coolant 110 °C, engine oil 130 °C, gearbox oil 130 °C, battery below 11.0 V
|
||||
- Link considered lost after 1000 ms without a valid packet → [[controller-link]]
|
||||
- Original implementation guide proposed the link on GPIO 43/44, which would have collided with the CH343 console; the shipped firmware moved it to IO1 `(repo)`
|
||||
|
||||
## Related
|
||||
|
||||
[[controller-link]] · [[link-redundancy]] · [[patrol-gauge-outputs]] · [[waveshare-wiki-esp32-s3-lcd-1-3]] · [[pinout-photo-details-7]] · [[open-questions]]
|
||||
@@ -0,0 +1,42 @@
|
||||
---
|
||||
type: concept
|
||||
tags: [link, ble, redundancy, design, esp-now]
|
||||
updated: 2026-09-21
|
||||
---
|
||||
|
||||
# Link Redundancy: wired + wireless
|
||||
|
||||
Stated goal (user, 2026-09-21): connect B to A "through some serial or BLE, or maybe a combination of both as redundant in case the wired connection is lost." This page is the design space. **Nothing here is decided or verified** — every item is `(unverified)` unless labelled otherwise.
|
||||
|
||||
## Why redundancy matters more once B drives gauges
|
||||
|
||||
Today a lost link only blanks a secondary display. Once B drives the cluster's tachometer and coolant gauge ([[patrol-gauge-outputs]]), a lost link means the driver's primary instruments go dead or, worse, freeze at the last value. The failover policy on B must therefore also define what the gauges do during an outage (drop to zero, hold with a warning, or sweep to a "no data" position).
|
||||
|
||||
## Transport options
|
||||
|
||||
| Transport | Pros | Cons | Notes |
|
||||
|---|---|---|---|
|
||||
| **UART TTL, direct wire** (today) | trivial, 23 bytes @ 5 Hz is nothing | 3.3 V single-ended over a car harness is noise-prone and has no ground-offset tolerance | Fine on the bench; questionable in a vehicle over more than a few cm |
|
||||
| **RS485 pair** | differential, automotive-grade noise immunity, tens of metres; **A already has an SP3485 on its terminal block** | B has no transceiver — needs a 3.3 V MAX3485/SP3485 module on IO1 (+ a free GPIO if the module lacks auto-direction) | This may already be what is wired — see the physical-layer question in [[controller-link]] |
|
||||
| **BLE 5 GATT** (A = peripheral notifying, B = central) | both boards have BLE 5 `(source: waveshare-wiki-esp32-s3-lcd-1-3)`; connection-oriented, so B gets an explicit disconnect event; notify payload of 23 bytes fits one packet | connection setup/reconnect takes hundreds of ms to seconds; BLE stack costs RAM on both ends (NimBLE is the lighter choice on Arduino-ESP32); A's Core 0 already runs Wi-Fi scanning + CAN + UART, and Wi-Fi/BLE coexistence on one radio can add jitter | The user's stated candidate |
|
||||
| **ESP-NOW** | connectionless, ~ms latency, no pairing state, trivially broadcast the same 23-byte frame; both are ESP32-S3 so it is a one-call API | Wi-Fi-based, so it shares the radio with A's Wi-Fi scanning; no link-layer "disconnected" event — liveness must come from the existing 1 s timeout | Worth benchmarking against BLE before committing; simpler failover semantics |
|
||||
|
||||
## Failover design sketch
|
||||
|
||||
1. B keeps **one** packet consumer. Every transport (UART, BLE/ESP-NOW) feeds validated `automotive_data_t` frames into the same queue, tagged with a source id.
|
||||
2. Deduplicate on `packet_id` + `timestamp_ms` (both already in the payload) so a frame arriving on both paths is applied once.
|
||||
3. **Prefer wired** when both are alive; fall to wireless when the wired path has been silent > N ms (N smaller than the display's 1000 ms lost-link threshold, e.g. 400 ms = two missed frames).
|
||||
4. Show the active source on the display (small glyph) so a silently degraded wire is noticed on the bench, not in traffic.
|
||||
5. Gauge behaviour during a total outage is a separate decision → [[open-questions]].
|
||||
|
||||
A-side implication: A must transmit on both paths simultaneously, always — not "switch to BLE when UART fails", because A cannot tell that B stopped hearing it (the link is one-way). Simultaneous transmit is cheap at 5 Hz.
|
||||
|
||||
## Open decisions
|
||||
|
||||
- BLE vs ESP-NOW for the wireless leg (latency, reconnect behaviour, RAM on A).
|
||||
- Whether the wired leg becomes RS485 end-to-end (probably yes if the run is longer than a dash-panel jumper).
|
||||
- Whether B should ever talk back (ACK/heartbeat) — would let A alarm on a dead B, at the cost of the current one-way simplicity.
|
||||
|
||||
## Related
|
||||
|
||||
[[controller-link]] · [[patrol-gauge-outputs]] · [[esp32-s3-lcd-1-3]] · [[open-questions]]
|
||||
@@ -0,0 +1,45 @@
|
||||
---
|
||||
type: synthesis
|
||||
tags: [meta, todo]
|
||||
updated: 2026-09-21
|
||||
---
|
||||
|
||||
# Open Questions
|
||||
|
||||
The research frontier for Controller B. Answering any of these should trigger updates across the wiki. Ordered roughly by how much they block progress.
|
||||
|
||||
## Blocking
|
||||
|
||||
1. **How is the wired link physically connected today?** The 5B's GPIO 44 only leaves the board as an RS485 A/B pair through an SP3485, yet both wiring guides describe a direct TTL wire into IO1. Is the RS485 A line going straight into IO1, is there an RS485→TTL module on B, or is it soldered to the module? Decides whether the wired leg is trustworthy in the car and what [[link-redundancy]] has to cover. → [[controller-link]]
|
||||
2. **Which `gear_position_t` enum is correct?** A's and B's protocol headers disagree on values 4–13 (Sport/Manual vs M1–M6). Check what A's CAN parser emits, fix the other side, bump `PACKET_VERSION`. → [[controller-link]]
|
||||
3. **Which Nissan Patrol cluster, and what does its tach input expect** (signal source, pulses per rev, pull-up voltage)? Fixes the frequency range for the tachometer output. → [[patrol-gauge-outputs]]
|
||||
|
||||
## Active
|
||||
|
||||
4. **Add `engine_rpm` to the packet.** A has RPM verified from CAN 0x0AA `(sibling: 5B wiki → can-id-candidates)` but the protocol carries no RPM field. Needed before the tachometer can be driven. → [[controller-link]]
|
||||
5. **BLE GATT or ESP-NOW for the wireless leg?** Benchmark reconnect time, latency and RAM cost on A (whose Core 0 already runs Wi-Fi + CAN + UART). → [[link-redundancy]]
|
||||
6. **Gauge behaviour on link loss** — zero, hold + warn, or sweep to a "no data" mark? A safety/UX decision the user must make. → [[link-redundancy]]
|
||||
7. **Temp sender resistance curve** as seen by the gauge, for the °C → duty lookup. → [[patrol-gauge-outputs]]
|
||||
8. **Does `engine_oil_temp` stay in the packet?** Its CAN source reads 0xFF on this engine (sensor not fitted). B currently reserves screen space and a warning threshold for it `(repo)`. Drop it, or repurpose the slot.
|
||||
|
||||
## Hardware
|
||||
|
||||
9. **Operating temperature and power draw are not on Waveshare's product wiki** for this board `(source: waveshare-wiki-esp32-s3-lcd-1-3)`. The 5B's spec is 0–65 °C; assume similar until a datasheet says otherwise. Dashboard mounting in a Patrol will see both extremes.
|
||||
10. **Vehicle power for B.** The board takes 5 V USB or a LiPo — no wide-input regulator like the 5B has. Needs an automotive 12 V → 5 V buck with transient protection, or a 5 V feed from A `(unverified)`.
|
||||
11. **IMU and TF-card GPIOs** are not stated on the product wiki. Irrelevant unless a future feature wants them, but they might share pins with the header (unlikely — the header GPIOs are IO1–5, IO7–14).
|
||||
12. **Is IO3 safe to use as an output?** It is a strapping pin on the S3; avoided for now.
|
||||
|
||||
## Answered
|
||||
|
||||
- ~~Does the 1.3 have free PWM-capable GPIO?~~ → **Yes, 13 on the headers** (IO1–5, IO7–14), 10 fully free today. (verified from pinout photo, 2026-09-21) → [[esp32-s3-lcd-1-3]]
|
||||
- ~~Could the 5B drive the gauges itself?~~ → **No.** All native GPIO consumed; its DO terminals go through an I2C expander + optocoupler and cannot carry hardware PWM. (schematic reviewed 2026-09-21) → [[patrol-gauge-outputs]]
|
||||
- ~~Which GPIO does A transmit on?~~ → **GPIO 44** per A's firmware; the "43" in two docs is stale. `(repo)` → [[controller-link]]
|
||||
- ~~Is the header IO35–IO42 as the wiring guide says?~~ → **No**, that table is wrong; see the photo. (verified, 2026-09-21)
|
||||
|
||||
## Sourcing wishlist
|
||||
|
||||
- Waveshare **schematic PDF** for ESP32-S3-LCD-1.3 (`https://files.waveshare.com/wiki/ESP32-S3-LCD-1.3/ESP32S3_1.3inch.pdf`; demo code zip `https://files.waveshare.com/wiki/ESP32-S3-LCD-1.3/ESP32-S3-LCD-1.3-Demo.zip`) — would settle the IMU/TF pins, confirm the CH343 on UART0, and show the backlight and battery circuits
|
||||
- A **verbatim Obsidian web clip** of the Waveshare product wiki into `raw/` (the current source page is from a condensed fetch, not a full clip)
|
||||
- Nissan Patrol **cluster wiring diagram** for the target generation — tach input and temp sender pins
|
||||
- Scope capture of the original Patrol tach signal at idle and a known RPM, if the original engine's cluster wiring still exists
|
||||
- Datasheet or Waveshare note on the board's operating temperature range
|
||||
@@ -0,0 +1,49 @@
|
||||
---
|
||||
type: concept
|
||||
tags: [gauges, pwm, ledc, nissan-patrol, hardware, design]
|
||||
updated: 2026-09-21
|
||||
---
|
||||
|
||||
# Driving the Patrol Cluster Gauges
|
||||
|
||||
Goal (user, 2026-09-21): generate signals from Controller B to drive the Nissan Patrol instrument cluster's **RPM (tachometer)** and **engine coolant temperature** gauges, fed by the BMW data that arrives over the [[controller-link]].
|
||||
|
||||
## Why B and not A
|
||||
|
||||
Controller A (5B) has no free native GPIO on any header: the RGB LCD, I2C, CAN, RS485, USB and PSRAM consume every pin, and its two "DO" terminals are optocoupled outputs driven through a CH422G I2C expander — no hardware timer can reach them `(sibling: 5B wiki → esp32-s3-touch-lcd-5b; schematic reviewed 2026-09-21)`. B exposes 13 free GPIOs on headers ([[esp32-s3-lcd-1-3]]), all usable by the ESP32-S3 LEDC peripheral.
|
||||
|
||||
## Two very different signals
|
||||
|
||||
| Gauge | What the cluster expects | What B must generate | Status |
|
||||
|---|---|---|---|
|
||||
| Tachometer | a pulse train whose **frequency** tracks engine speed; the source and pulses-per-revolution depend on the cluster variant | variable-frequency square wave at ~50 % duty, on one LEDC channel with its **own timer** | source data (RPM from CAN 0x0AA) verified on A `(sibling: 5B wiki → can-id-candidates)`; **not yet in the packet** |
|
||||
| Coolant temp | a moving-coil/bimetal gauge that reads the **resistance to ground** of the sender | fixed-frequency PWM with variable **duty** into a low-side switch, so the gauge integrates it as an average resistance | coolant already in the packet as 0.1 °C |
|
||||
|
||||
The two need separate LEDC timers because one varies frequency and the other varies duty. ESP32-S3 LEDC has 8 channels on 4 timers `(unverified — datasheet figure from memory, confirm)`.
|
||||
|
||||
## Proposed pin assignment (unverified — proposal only)
|
||||
|
||||
- **IO7** → tachometer pulse output
|
||||
- **IO8** → coolant gauge PWM output
|
||||
|
||||
Both on the right header, adjacent to GND-free pins, so add a ground wire from the left header. IO3 deliberately avoided (strapping pin). IO1 stays the UART RX.
|
||||
|
||||
## Electrical interface — mandatory external stage (unverified)
|
||||
|
||||
3.3 V logic drives neither gauge directly.
|
||||
|
||||
- **Tach input**: Patrol clusters expect roughly 12 V-level pulses (ignition-coil negative or ECU tach output, open-collector with the cluster's internal pull-up). Use an NPN or logic-level N-MOSFET as an open-collector pulling the tach wire to ground; if the cluster has no internal pull-up, add one to +12 V (a few kΩ). Never feed 12 V back into IO7.
|
||||
- **Temp gauge**: sender wire goes to ground through the sender's thermistor. Emulate it with a logic-level N-MOSFET (or NPN) pulling the sender wire to ground under PWM, plus a series resistor sized so 100 % duty corresponds to the hottest resistance you want to show. The gauge's thermal/mechanical lag averages the PWM; use a few hundred Hz to 1 kHz so nothing flickers. Calibration is a lookup table from °C → duty, built empirically against the needle.
|
||||
- Optocouplers between B and the 12 V cluster side are cheap insurance; the 5B's own DO stage (PC817 → transistor) is a reasonable pattern to copy.
|
||||
|
||||
## What must be established before any of this is wired
|
||||
|
||||
1. **Which Patrol cluster** (Y60/Y61, petrol vs diesel). Diesel clusters were fed from the alternator W-terminal at a much higher frequency and often have a calibration trimmer; petrol clusters expect ~3 pulses/rev for a 6-cylinder from the ignition system `(unverified)`. This fixes the frequency range and therefore the LEDC resolution/prescaler. → [[open-questions]]
|
||||
2. Whether the cluster's tach input has an internal pull-up, and to what voltage (meter it).
|
||||
3. The temp sender's resistance-vs-temperature curve as the gauge sees it (meter the original sender at cold/hot, or sweep a pot until the needle sits at known marks).
|
||||
4. Protocol change: add `engine_rpm` (u16, 1/min) and a `valid_flags` bit to the packet; bump the version on both repos → [[controller-link]].
|
||||
5. The outage policy: what the needles do when the link is lost → [[link-redundancy]].
|
||||
|
||||
## Related
|
||||
|
||||
[[esp32-s3-lcd-1-3]] · [[controller-link]] · [[link-redundancy]] · [[open-questions]]
|
||||
Reference in New Issue
Block a user