Files
ps4-lego-bridge/docs/WIRING.md
jessikitty c21f804812 Lead with the separate-ground LED build
Keeps the shared-rail version documented as the alternative, since that is
what the current loom attempts, and links the new pinout reference.
2026-09-25 01:29:00 +10:00

89 lines
3.2 KiB
Markdown

# Wiring
![Wiring pinout](wiring.svg)
Pin availability and limits: [ESP32-PINOUT.md](ESP32-PINOUT.md).
## Board to board
| Board A (esp32_bluepad32) | | Board B (esp32 2.0.17) |
| --- | --- | --- |
| GPIO17 TX | → | GPIO16 RX |
| GPIO16 RX | ← | GPIO17 TX |
| GND | — | GND |
| 5V | — | 5V (model setup only, see README) |
TX goes to RX, not TX to TX. The ground is a shared voltage reference so the
two boards agree on what a logic 1 is — without it you get garbage or silence.
It is not a return path for anything else, so do not hang LED current off it.
## LED circuits — recommended build
Each LED gets its own wire out and its own wire back to its own GND pin. Four
wires, no shared junction anywhere.
![LED wiring with separate grounds](wiring-leds-separate.svg)
```
GPIO25 ──[220Ω]──▶|── RED pair ──── GND (a)
GPIO26 ──[100Ω]──▶|── GREEN pair ── GND (b)
```
GND (a) and GND (b) are different physical pins but the same net inside the
board. That is fine, and it is exactly what makes this safe: there is no shared
connection point to wire incorrectly.
Both circuits live entirely on **board B**. LED long leg (anode) faces the
resistor and GPIO side. A reversed LED simply stays dark, so it looks like a
dead circuit rather than a wiring error.
Resistor values are a starting point: roughly 220Ω for red, 100Ω for blue or
white. A pin is comfortable at about 12mA and hard-limited near 40mA. If a pair
draws more than ~20mA — which pre-wired "3V" LEDs sized for a coin cell often
do — drive it through a small NPN transistor or MOSFET instead of off the pin.
## Shared ground rail — the other way
Also valid, one wire fewer, but it has a junction that can be wired wrong:
```
GPIO25 ──[220Ω]──▶|── RED pair ────┐
├── ground rail ── board B GND
GPIO26 ──[100Ω]──▶|── GREEN pair ──┘
```
The two returns must meet **only at the ground rail**, and the rail goes
straight to a GND pin. See the failure mode below for what happens when that
junction lands in the wrong place.
## Known failure mode: LEDs wired in series
Symptom seen on this build — green only lights when red is already on, and
green never lights alone:
| Software state | Observed |
| --- | --- |
| red on, green off | red on ✓ |
| red off, green on | **both off** ✗ |
| red on, green on | both on ✓ |
| red off, green off | both off ✓ |
Cause: the green return lands on the *anode* side of the red LED rather than on
the ground rail, putting the two LEDs in series. Green alone then has to push
through both — roughly 2.1V plus 1.9V — and a 3.3V pin cannot do it, so neither
lights. With GPIO25 also high, the junction is lifted and both conduct.
Two rows of that table are impossible from a software fault, which is what
identifies it as wiring.
**Test:** with both LEDs off, meter from the shared return wire to a GND pin.
It must read 0V. Press Circle and measure again — if it rises above 0V, that
wire is not ground.
**Fix:** switch to the separate-ground build above. It removes the junction
entirely, so this cannot recur.
---
Created by: Jess Rogerson (yelling commands at Claude.AI)