Files
ESP32-S3-Touch-LCD-5B/wiki/pages/canny-5-3-pico-gauge-drive.md
T

61 lines
4.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
type: synthesis
tags: [hardware, gauges, nissan-patrol, controller-b, electronics]
updated: 2026-09-22
---
# CANNY 5.3 pico vs ESP32-S3: driving the Patrol cluster
Why the user's old CANNY-based setup moves the Patrol tach and our ESP32 (Inst. Cluster, IO7) does not. Researched 2026-09-22 after the first in-car test of the dual-controller rig: temp needle parked mid-scale, tach dead ([[dual-controller-architecture]]).
## The working reference setup `(verified)`
The user previously drove this same instrument cluster with a **CANNY 5.3 pico** (Russian visual-PLC automotive controller, cannylogic.com / canny.ru), using **"Default Negative Output" in DIO mode on IO channel 8** (contact 4 — the channel that also carries the high-resolution PWM function). The cluster's needles respond in that setup — this is our known-good electrical reference.
## What the CANNY output stage is (source: cannylogic.com/docs/c53pico, canny.ru)
- Channels are **12 V-domain**: "output operating voltage on the controller channels matches the supply voltage" (7–16 V, 18 V abs max).
- Each channel is a **configurable-polarity switch**: "positive" mode connects the line to +12 V (high-side source), **"negative" mode connects the line to GND (low-side sink)**. Two strengths: weak ~1 mA (pull) and strong 100 mA.
- Rated for inductive/resistive/capacitive loads, 100 mA per channel, 300 mA total, automatic shutoff on over-current.
- "Negative output" therefore produces the classic automotive sender signal: the line is **pulled to ground when active and floats up to the cluster's own internal pull-up (~battery) when released** — a 0 ↔ ~12 V swing without the controller ever sourcing voltage.
## What our ESP32-S3 GPIO is
- **3.3 V push-pull** logic pin, absolute max ~3.6 V, source/sink a few tens of mA, no protection `(unverified — standard ESP32-S3 datasheet values)`.
- LEDC PWM on B's IO7 (tach square wave) and IO8 (temp duty) drives the line **actively to 3.3 V and 0 V** `(repo)`.
## Why this explains the test-day symptoms `(verified 2026-09-22 for the tach — needle tracks rpm through the 2SK3069 low-side stage; see [[patrol-instrument-cluster]] for calibration)`
- The Patrol tach input expects negative-going pulses on a line it pulls up internally toward battery. With the ESP32 push-pull output attached, the "high" half of every cycle is **3.3 V instead of ~12 V** — likely below the input threshold, so the tach sees no edges at all → dead needle, exactly what the CANNY's negative output provides and we don't.
- The temp gauge input is a sender-resistance-to-ground circuit. A 3.3 V push-pull PWM can bias it to some fixed effective level — a needle that parks at one position and ignores duty changes is consistent with this (mid-scale at 89 °C may have been coincidence, not the duty law working). Re-test after the drive stage is fixed before trusting the temp calibration in [[dual-controller-architecture]].
- **It is not PWM polarity in firmware**: a 50 % square wave is its own inverse, and inverted temp duty would move the needle backwards, not freeze it.
## The fix (per channel): replicate "negative output"
Small low-side switch between the ESP32 pin and the gauge line:
```
gauge line ──────────────┬──── (cluster's internal pull-up to ~12 V)
│
D (drain/collector)
ESP32 IOx ──[R ~1k]── G/B N-MOSFET (logic-level, e.g. 2N7002/AO3400) or NPN (2N2222 + base R)
S (source/emitter)
│
GND (common with cluster!)
```
- ESP32 high → line pulled to GND; ESP32 low → line released to the cluster's pull-up. This **inverts the logic**: tach unaffected (50 % square), temp duty becomes 255 − duty at the gauge — recalibrate `temp_slope`/`temp_offset` ([[dual-controller-architecture]] tunables) or invert in B's firmware.
- If the cluster input turns out to have no internal pull-up, add an external ~4.7–10 kΩ to +12 V.
- On hand (2026-09-22): a **2SK3069** (N-ch, 60 V / 75 A, 4 V-drive class) — hugely oversized but suitable; planned for the tach channel with 220 Ω gate series + 10 kΩ gate pulldown `(source: alltransistors.com 2SK3069)`.
- **Never** connect the 12 V-pulled gauge line directly to an ESP32 pin, including in open-drain mode — the pin is not 12 V tolerant.
- Grounds must be common: cluster GND ↔ Inst. Cluster GND.
## Open items
- Scope or multimeter the tach line at rest: does it float high (~12 V) with nothing attached? Confirms the internal pull-up assumption.
- After the transistor stage: re-run the override test (Force tach rpm / Force coolant duty on A's tuning screen) and re-derive the temp duty law; promote this page's hypothesis to `(verified)`.
## Related
[[dual-controller-architecture]] · [[nissan-patrol-swap]] · [[open-questions]]