Skip to content

Digital Inputs

The XREG-010 has two different styles of digital input architectures, depending on the pin in question. They are all exposed in the Ethernet Connectors (see Data Cables & Pinout).

  1. Optocoupler Style — Activated by a positive voltage input (rated 5–28 V applied to the input pin; survives to 54 V)
  2. Ground Style — Activated by shorting the input pin to ground

The two styles serve different installation scenarios: opto-style inputs are right for signals coming from elsewhere in the boat's 12/24/36/48 V system (ignition, BMS contacts, mode-switch outputs), because the channel accepts anything from 5 to 28 V without a divider and the series resistor, LED drop and reverse clamp keep that wire's transients away from the ESP32 pin. Ground-style inputs are right for local switches mounted near the regulator that simply close to its own GND — they consume less idle power, eliminate the optocoupler aging concern, and are appropriate when the signal source is electrically local.

Optocoupler Channel Map (5 channels)

Function Opto IC Clamp Diode ESP32 GPIO
IGNITION (engine wake) U5 D19 GPIO1
HIGH/LOW (charging mode) U10 D25 GPIO39
BMSLogic (BMS enable) U16 D27 GPIO42
FORCEFLOAT (force float mode) U17 D28 GPIO40
EXTRA_OPTICAL_GPIO1 (spare) U26 D34 GPIO8

All five channels are identical optically and electrically — only the destination GPIO differs. The V9 schematic below shows one real channel (U26, the spare EXTRA_OPTICAL_GPIO1 input); substitute the relevant designators from the table above for any other channel.


Optocoupler Style Digital Inputs

Optocoupler channel schematic — U26, EXTRA_OPTICAL_GPIO1: R87 6.8k series resistor, D34 1N4148W reverse clamp, VO615A-9X017T, R60 10k pull-up to 3V3

The input side (left) takes the external 5–28 V signal through the 6.8 kΩ series resistor and back through the LED; the output side (right) is the phototransistor pulling the ESP32 GPIO low against the 10 kΩ pull-up to 3.3 V.

Design Requirements

  • Input voltage range: the published user-facing rating is 5–28 V (this keeps LED current in the 10+ year lifetime zone — see the table below). The circuit itself survives to 54 V with reduced LED lifetime.
  • Temperature range: -40°F to 180°F (-40°C to 82°C) — well inside the VO615A's -55 °C to +110 °C rating
  • Lifetime target: 10+ years at typical voltages (~12V), 3-6 years at the 54V survival limit

How an Optocoupler Works

The VO615A carries the signal from the input circuit to the ESP32 GPIO as light rather than as a direct electrical path:

Input Side (LED)

  1. Input voltage applied across current limiting resistor and IR LED
  2. Forward current flows through LED, producing infrared light
  3. Light intensity proportional to forward current

Output (ESP32 GPIO) Side (Phototransistor)

  1. IR light strikes phototransistor base region
  2. Light creates electron-hole pairs, acting as base current
  3. Transistor turns on, allowing collector current to flow
  4. Collector current = LED current × CTR (Current Transfer Ratio)
  5. When sufficient collector current flows, voltage at collector drops low enough to register as logic LOW on ESP32
  6. Voltage otherwise pulled high (3.3V) by pull up resistor to 3.3V Supply

Protection and Range

  • Protection: a transient on the input wire drives LED current and returns through the LED loop — the only path onward to the GPIO node is optical, so the spike never reaches the pin
  • Range: accepts input signals from 5 V to 54 V with no divider (lower LED life at higher voltages)

Component Selection

Optocoupler: VO615A-9X017T (LCSC C145478)

Decoding the part number against the datasheet's ordering-information table:

  • -9 — CTR bin 9: 200–400 %, specified at IF = 5 mA, VCE = 5 V. (The unbinned base VO615A spans 50–600 % at the same test point.)
  • X017T — SMD-4, package option 7, from the VDE-approved block (the "1" = option 1, DIN EN 60747-5-5 / VDE 0884-5); T = tape and reel.
  • Agency approvals: UL 1577 / cUL, BSI, FIMKO, CQC, plus VDE with option 1.

Reason for the high-CTR bin: reliable switching at the 5 V low end, minimal extra cost.

CTR is specified at 5 mA — not at our low-end operating point

The 200–400 % bin is measured at IF = 5 mA. CTR falls off at lower LED current, so at the 5 V input level (IF ≈ 0.53 mA) the effective CTR is well below 200 %. The low-end analysis below therefore checks against the pull-up threshold current, not against the headline CTR number.

Current Limiting Resistor: 6.8kΩ, 1W, 2512 SMD

  • Calculation basis:
  • At 5V: IF = (5V - 1.43V) / 6.8kΩ = 0.53 mA
  • At 54V: IF = (54V - 1.43V) / 6.8kΩ = 7.7 mA
  • Power rating: 404mW at 54V requires 1W resistor for safety margin

Pull-up Resistor: 10kΩ, 0603 SMD (R60 shown for the U26 channel)

  • Logic HIGH: When LED is OFF, phototransistor is OFF, collector pulled to 3.3V through 10kΩ
  • Logic LOW: When LED is ON, phototransistor conducts, pulling collector toward ground
  • Threshold current: the phototransistor must sink 3.3 V / 10 kΩ = 0.33 mA to pull the collector fully low
  • Switching threshold: ESP32 typically switches at ~1.65V (50% of 3.3V), so even ~0.17 mA of collector current crosses the logic threshold

Performance Analysis

Input Voltage LED Current vs Min (1mA) Lifetime Power (Watts) Power (mA@12V)
5V 0.53 mA 53% of min 20+ years 1.9 mW 0.16 mA
12V 1.57 mA 157% of min 20+ years 17 mW 1.4 mA
28V 3.91 mA 391% of min 10+ years 104 mW 8.7 mA
54V 7.7 mA 770% of min 3-6 years 404 mW 33.7 mA

Power consumption notes: - Power is consumed only when Input Signal is active (ie external switch is ON) - No power consumption when Input Signal = 0V (ie external switch OFF) - LED power = Forward current × 1.43V (LED forward voltage) - Resistor power = Forward current² × 6.8kΩ

Protection Diode: 1N4148W (SOD-123)

Function: Reverse Voltage Protection

The 1N4148W diode (SOD-123 package, LCSC C81598 — V9 BOM lists one per opto channel at D19, D25, D27, D28, D34) provides critical protection for the optocoupler LED:

  • Normal operation: Diode is reverse biased across LED, no current flows
  • Reverse voltage protection: If Input Signal goes negative, diode conducts and clamps reverse voltage to ~0.7V
  • Prevents LED damage: VO615A LED can only handle 6V reverse voltage maximum

Why Critical

  • Load dump transients: Long wires / disconnection can create voltage spikes
  • Electrical noise: Marine electrical systems are electrically noisy environments

Specifications & Failure Limits

  • Forward voltage: 0.7V typical, 1.25V maximum at 10mA
  • Reverse voltage rating: 75V maximum
  • Forward current rating: 300mA continuous, 2A peak (1µs pulse)
  • Power dissipation: 350mW at 25°C

Failure Analysis

The diode will fail if: - Forward current > 300mA continuous: At maximum negative transient - Reverse voltage > 75V: If positive Input Signal exceeds 75V (well above our 54 V max) - Power dissipation > 350mW: P = If × 0.7V, so fails at If > 500mA

The 1N4148W provides robust protection for all expected marine transient conditions.

System Power Consumption

Condition LED Side ESP32 Side Total Power Total (mA@12V)
Input OFF 0 mW ~0 mW ~0 mW ~0 mA
Input ON (12V) 17 mW 1.09 mW 18 mW 1.5 mA
Input ON (54V) 404 mW 1.09 mW 405 mW 33.8 mA

The ESP32-side 1.09 mW is the 10 kΩ pull-up conducting to ground through the phototransistor (3.3 V² / 10 kΩ) — it flows only while the input is active. With the input off, the phototransistor is off and the collector node is high-impedance, so the pull-up sources nothing: an idle opto channel consumes zero power on both sides.

LED Current Guidelines

  • 1-3mA: Conservative operation (20+ year lifetime)
  • 3-8mA: Moderate operation (5-10 year lifetime)
  • 8-15mA: Aggressive operation (1-5 year lifetime)

Design Validation

  • 5V switching: at 5 V the LED runs ≈ 0.53 mA. Even with CTR derated well below the 5 mA-spec 200 % floor, the phototransistor only has to sink 0.33 mA (the 10 kΩ pull-up's full-swing current) — and only ~0.17 mA to cross the ESP32 logic threshold — so switching remains reliable at the bottom of the range
  • 54V survival: 7.7mA current provides marginal 3-6 year life if 100% duty cycle
  • Temperature performance: VO615A-9's high CTR provides margin for temperature derating across -40°F to 180°F range

Bill of Materials (Optocoupler Style — per channel)

Reference (per channel) Part Number Description Package LCSC
U5 / U10 / U16 / U17 / U26 VO615A-9X017T Optocoupler, CTR 200–400 % SMDIP-4 C145478
R67 / R74 / R75 / R76 / R87 (one per channel, same order as the channel map) 25121WJ0682T4E Current-limit resistor, 6.8 kΩ, 1 W 2512 C26073
R46 / R47 / R51 / R52 / R60 (one per channel, same order as the channel map) — Pull-up resistor, 10 kΩ, to 3V3 0603 C25804
D19 / D25 / D27 / D28 / D34 1N4148W Reverse-bias protection diode SOD-123 C81598

The 6.8 kΩ 2512 part is shared by the five opto LED-drive series resistors and the buzzer-circuit gate pull-up (R65). The output pull-ups (R60 shown for the U26 channel) come from the board-wide shared 10 kΩ pool.


Ground Style Digital Inputs

Schematic

3.3V ──[R57:10kΩ]──┬──[C51:1µF]──GND
                   │
                   ├──[D32: PESD5V0S1BA TVS]──GND
                   │
                   ├── Input Signal (RJ45 pin)
                   │
                   └──[R104:330Ω]── ESP32 GPIO41

The pull-up, debounce capacitor, and TVS all sit on the connector node; the 330 Ω series resistor is between that node and the ESP32 pin. Designators above are the FactoryReset channel; the four switch inputs are identical:

Function Cable 4 pin Pull-up Capacitor TVS Series resistor ESP32 GPIO
FactoryReset 9 R57 C51 D32 R104 GPIO41
WakeFromSleep 10 R82 C52 D38 R58 GPIO5
WifiReset 11 R83 C53 D39 R105 GPIO45
AP/ClientMode 12 R84 C59 D40 R56 GPIO46

The GPIO0 boot strap (Cable 3 pin 8: R43, C30, D4, R71) and the RESET line (Cable 4 pin 13: R33, C60, D35, R98 into the module's EN pin) use the same circuit.

Design Requirements

  • Input method: Short to ground activation
  • Temperature range: -40°F to 180°F (-40°C to 82°C)
  • Debouncing: Hardware RC filter for switch bounce elimination
  • Protection: series resistance and a PESD5V0S1BA TVS on each exposed input

How Ground Style Inputs Work

This design uses RC debounce filtering:

Normal Operation (Switch Open)

  1. Input Signal is not connected (floating or open)
  2. No current flows to Ground
  3. Pull-up resistor R57 (10kΩ) pulls GPIO pin to 3.3V
  4. ESP32 GPIO reads logic HIGH (3.3V)

Activated Operation (Switch Closed to Ground)

  1. Input Signal is shorted to ground by external switch/contact
  2. Current flows from 3.3V through R57 (10kΩ) to ground via the switch
  3. Junction voltage: V_out = 0V (direct connection to ground)
  4. ESP32 GPIO reads logic LOW (0V << 0.8V threshold)

Component Analysis

Pull-up Resistor: R57 (10kΩ)

  • Function: Pulls Output Signal HIGH when Input Signal is not grounded
  • Power when input open: ~0 mW — the switch is open and the GPIO input is high-impedance, so the pull-up has no current path
  • Power when input grounded: P = 3.3V²/10kΩ = 1.089 mW (continuous while held closed)

Debounce Capacitor: C51 (1µF)

  • Function: Filters switch bounce and electrical noise
  • Time constant: τ = R57 × C51 = 10kΩ × 1µF = 10ms
  • Settling time: ~3τ = 30ms for clean switching
  • Noise immunity: Filters high-frequency electrical noise

TVS: D32 (PESD5V0S1BA, SOD-323)

  • Function: bidirectional 5 V-standoff TVS from the connector node to ground; it clamps ESD and wiring transients before they reach the RC network and the ESP32
  • Rating: 5 V reverse standoff, 12 A peak pulse current (8/20 µs)

Series Resistor: R104 (330 Ω, 0402)

  • Function: sits between the connector node and the ESP32 pin, limiting the current the pin's internal clamps have to carry during a transient; it is not in the switch path, so it does not affect the logic levels

Performance Analysis

Switching Characteristics

  • Rise time: Limited by RC time constant = 10ms
  • Fall time: Much faster, limited by the 330 Ω series resistor (R104) and ESP32 input capacitance
  • Debounce time: ~30ms eliminates typical switch bounce

Power Consumption

Condition Current Power Power (mA@12V)
Input Open ~0 mA ~0 mW ~0 mA
Input Grounded 0.33 mA 1.089 mW 0.09 mA

Power consumption notes: - Power flows only while the switch is held closed — an open input draws nothing (high-impedance GPIO leaves the pull-up with no current path) - Very low power consumption suitable for battery applications - Worst case (switch held closed continuously) is still only ~1.1 mW

Voltage Levels

  • Logic HIGH: 3.3V (input open/floating)
  • Logic LOW: 0 V (the switch shorts the connector node directly to ground; the 330 Ω series resistor is between that node and the GPIO, not in the switch path)
  • Switching threshold: ESP32 switches at ~0.8V, providing excellent noise margin
  • Noise margin HIGH: 3.3V - 0.8V = 2.5V
  • Noise margin LOW: 0.8V - 0V = 0.8V

ESP32-S3 Internal ESD Protection and Real ESD Event Analysis

ESP32-S3 Internal Protection Specifications

From the ESP32-S3 datasheet: - Human Body Model (HBM) ESD tolerance: ±2000V - Charged Device Model (CDM) ESD tolerance: ±1000V
- Absolute maximum input voltage: 3.6V (VDD + 0.3V) - Internal protection: Snapback devices on all GPIO pins

What Happens During an ESD Event

Scenario: 8kV HBM discharge to Input Signal wire

  1. Initial ESD pulse: 8000V spike from a 100 pF source through ~1.5kΩ (HBM model)
  2. TVS (D32) and debounce capacitor (C51) take the hit: the discharge lands on the connector node, where D32 clamps the voltage and the 1 µF capacitor is 10,000 times the HBM source capacitance. 100 pF at 8 kV is 0.8 µC, which raises 1 µF by about 0.8 V
  3. Series resistor (R104): the 330 Ω between the connector node and the GPIO limits the current the pin has to carry
  4. ESP32 internal protection response:
  5. Internal snapback devices activate at ~7-10V
  6. Snapback devices clamp GPIO voltage to ~5-7V
  7. Current flows through internal protection to chip ground
  8. Current path: ESD energy → D32 clamps the connector node while C51 absorbs the charge → R104 → ESP32 internal snapback → chip ground
  9. Result: GPIO survives due to the TVS, the capacitor, the series resistor, and the internal clamps

Role of the ESP32's Internal Protection

The key insight: The ESP32's internal ESD protection is designed to handle exactly this scenario. The internal snapback devices are specifically designed for ESD events where voltage exceeds normal operating range.

Espressif's official position (from ESP32 forum): "The ESP32 has internal snapback devices in order to handle ESD on all pins. The external ESD protector is simply a belts-and-braces approach to make sure someone doesn't accidentally zap through the internal protections."

Design Validation for ESD Protection

IEC 61000-4-2 Contact Discharge (typical requirement): - Test voltage: ±8kV - The figures above are analysis, not a compliance test result - Reasoning: the 1 µF capacitor takes the charge, the 330 Ω resistor limits the current, and the internal clamps handle the residual

Real-world ESD sources: - Human walking on carpet: 2-15kV - Handling in dry environment: 5-25kV
- Protection margin: Adequate for typical applications

The design provides ESD protection through the combination of the 1 µF capacitor at the connector node, the 330 Ω series resistor and the ESP32's internal snapback protection. The 330 Ω value is small enough not to affect digital operation.

Design Validation

  • Noise immunity: 1µF capacitor filters electrical noise
  • ESD protection: a PESD5V0S1BA TVS and 1 µF at the connector node, plus a 330 Ω series resistor ahead of the ESP32's internal clamps
  • Current limiting: 330 Ω series resistor between the connector node and the GPIO
  • Low power: <1.1mW continuous power consumption
  • Switching margin: large noise margins on both logic levels

Bill of Materials (Ground Style — per channel)

Reference (representative) Part Number Description Package Notes
R57 / R82 / R83 / R84 10 kΩ 0603 (LCSC C25804) Pull-up to 3V3 0603 Shared 10 kΩ pool across the board
C51 / C52 / C53 / C59 1 µF 0603 (LCSC C15849) RC debounce cap 0603 Shared 1 µF pool
R104 / R58 / R105 / R56 330 Ω 0402 (LCSC C25104) Series resistor between the connector node and the GPIO 0402 Shared 330 Ω pool
D32 / D38 / D39 / D40 PESD5V0S1BA (LCSC C19224) 5 V bidirectional TVS to GND SOD-323 One per input node

Comparison: Optocoupler vs Ground Style

Feature Optocoupler Style Ground Style
Input Range 5V to 28V rated (54V survival) Ground short only
Power (Active) 1.5–33.8 mA @ 12V 0.09 mA @ 12V
Power (Inactive) ~0 mA ~0 mA
Component Count 4 components 4 components
Cost Higher (optocoupler) Lower (passive)
Complexity Medium Low
Noise Immunity Excellent Good
Applications 5–28 V signals from elsewhere on the boat Simple switches, low voltage