Files
ESP32-S3-Touch-LCD-5B/wiki/pages/patrol-instrument-cluster.md
T

5.8 KiB
Raw Blame History

type, tags, updated
type tags updated
entity
hardware
gauges
nissan-patrol
controller-b
electronics
2026-09-22

Patrol instrument cluster — signal expectations

What the target vehicle's cluster (nissan-patrol-swap) needs on its tach and temp inputs, from the first day of driving it with Inst. Cluster's outputs through the low-side FET stage (canny-5-3-pico-gauge-drive). Patrol generation still unidentified — Y60/GQ vs Y61/GU matters for gauge internals → open-questions.

Tachometer

  • Empirical calibration (verified 2026-09-22): 2 pulses per revolution. With the firmware's original tach_ppr=4 the cluster read double; cfg ppr set to 2 makes it track the BMW's CAN rpm. Signal: 50 % square wave, low-side switched (2SK3069), i.e. 3000 rpm → 100 Hz.
  • Background on what these clusters normally get (source: patrol4x4.com / nissanpatrol.com.au threads):
    • TD42 diesels had no factory tach signal; aftermarket/factory tachs run from the alternator W terminal (a phase tap — frequency scales with pulley ratio × pole pairs, far more than 2/rev, usually via an adapter box).
    • A clean 2 ppr expectation matches an ECU-driven 4-cylinder-style tach input (e.g. ZD30-era Y61) (unverified) — a hint the cluster may be from that generation, worth checking against the actual vehicle.
  • Practical consequence: the doubled reading at ppr=4 was calibration, not a signal-quality problem. The FET stage works.
  • Scale calibration (verified 2026-09-23, override ramps): with ppr=2 the cluster over-reads by a factor that shrinks with rpm — ×1.20 at 1000–2000, ×1.15 at 6000 (commanded 6000 with trim −20 read exactly 5500). The response is mildly nonlinear, so a linear trim cannot be exact everywhere; tach_trim = −13 % chosen as the realistic compromise (user-tuned on the dial). Saved on A, pushed in CONFIG.

The steppy-needle saga (2026-09-22/23) — resolved

Observed on the road: needle holds then jumps 200–500 rpm. Diagnosis took four firmware iterations on B, each eliminating one layer (repo, verified by override ramp tests with ignition on / engine off):

  1. 5 Hz staircase: B refreshed the tach frequency once per 200 ms packet. Added a slew limiter (glide 25 %/20 ms). Result: worse — because of layer 2.
  2. LEDC restarts: Arduino 2.x ledcChangeFrequency() re-inits the timer and truncates the waveform mid-period; calling it 50×/s corrupted the counting window constantly. Replaced LEDC with an esp_timer toggling IO7. Result: better, not smooth — because of layer 3.
  3. Task-dispatch jitter: esp_timer callbacks run in a task; WiFi/ESP-NOW bursts on core 0 delay edges by ms and bunch them. Replaced with a hardware-timer ISR (1 MHz, auto-reload): phase-continuous, immune to scheduling. Result: rock-steady at fixed rpm, but ramps still stepped — because of layer 4, which is the cluster itself.
  4. Cluster count quantization — the floor: on a clean 25 rpm/40 ms synthetic ramp the needle jumped alternately +100/+200 → the cluster counts pulses in ~150 rpm quanta on a dial that rounds to 100. A perfectly stable synthetic frequency parks on a quantum and snaps to the next; a real engine's pulse jitter straddles the boundary so the damped needle averages in between — factory setups are smooth because their signal is dirty. Emulated with random dither ±45 rpm (±1.2 Hz) per 20 ms tick, with an adaptive envelope (full while the target moves, fades to zero within ~1.2 s at rest) so steady rpm stays flicker-free.

Final state (2026-09-23): sweep and hold "fairly good" per user; possible future refinement of dither constants (DITHER_HZ, envelope times in B's gauge_outputs.cpp). Also explains the CANNY's high-rpm jumpiness (canny-5-3-pico-gauge-drive): a PLC toggling on a ms-resolution timer gets coarse at ≥100 Hz output (unverified).

Temperature gauge

  • The stock sender is an NTC thermistor to ground (source: patrol4x4.com forum, sensorgal.com):

    Coolant Sender resistance
    20 °C 2.1–2.9 kΩ
    50 °C 0.68–1 kΩ
    90 °C 236–260 Ω

    The gauge is a current-measuring device; its useful span is roughly the "tens of Ω to a few kΩ" region. Duty-cycle PWM through a low-side switch emulates an average conductance in this range (repo).

  • Needle flutter at temp_pwm_hz = 1 kHz — RESOLVED at 20 kHz (verified 2026-09-22). At 1 kHz the needle fluttered at any duty between the endpoints (steady at 0 and 255 — i.e. it was following the chopping itself); raising temp_hz to 20000 (the current firmware clamp) removed the fluctuation completely. Matches community experience that PWM-driven automotive gauges need tens-of-kHz (source: allaboutcircuits.com, pjrc forum).

  • Lesson from the same session: a missing chassis/board common ground makes the gauge read nothing at all — check grounds before debugging frequencies.

  • Still open as optional hardening: a series resistor in the FET drain (~100–240 Ω) to bound the current swing to the sender's real range (full-on duty = dead short, i.e. "hotter than the sender can ever read").

  • After the flutter is fixed, re-derive temp_slope/temp_offset against the sender table above (the FET inverts duty sense vs the direct-drive law used before).

Open items

  • Identify the Patrol generation / cluster origin (2 ppr hint above; ask the user / photograph the cluster).
  • Temp law recalibration table (duty ↔ needle position ↔ implied °C) — gauge works and is stable at 20 kHz; the slope/offset mapping to real °C has not been re-derived since the FET stage inverted the duty sense.
  • Tach dither constants may deserve another tuning pass ("maybe in the future we will get back to RPMs" — user, 2026-09-23).

canny-5-3-pico-gauge-drive · nissan-patrol-swap · dual-controller-architecture · open-questions