birdcage/docs/ble-bridge-wiring.md
Ryan Malloy 068f38d7eb Add ESP32-S3 BLE-to-RS422 bridge firmware for Carryout G2
NimBLE-based Nordic UART Service (NUS) bridge on ESP32-S3-DevKitC-1.
Transparent passthrough: BLE client writes → UART1 TX → RS-422 → G2,
and G2 → RS-422 → UART1 RX → BLE notifications. USB serial serves as
debug monitor and fallback input.

Uses two MAX485 modules (one locked TX, one locked RX) with a SparkFun
BSS138 level converter for 3.3V/5V translation. Wiring schematic and
RJ-12 pinout documented in docs/ble-bridge-wiring.md.
2026-02-11 14:33:10 -07:00

121 lines
6.4 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.

# BLE Bridge Wiring — ESP32-S3 + 2× MAX485
Transparent BLE-to-RS422 bridge for the Winegard Carryout G2 satellite dish.
## Parts
- ESP32-S3-DevKitC-1-N16R8
- 2× MAX485 TTL-to-RS485 module
- 1× SparkFun Bidirectional Logic Level Converter (BOB-12009, BSS138-based)
- RJ-12 6P6C straight-wired cable with breakout
- Hookup wire / jumpers
## Schematic
```
SparkFun Level Converter (BOB-12009)
┌──────────────────────────────────────┐
│ │
ESP32 3V3 ──────────────►│ LV HV │◄── ESP32 5V
ESP32 GND ──────────────►│ GND GND │◄── (shared)
│ │
ESP32 GPIO17 (TX) ──────►│ LV1 HV1 │──────► MAX485₁ DI
ESP32 GPIO18 (RX) ◄──────│ LV2 HV2 │◄────── MAX485₂ RO
│ │
│ LV3 (spare) HV3 (spare) │
│ LV4 (spare) HV4 (spare) │
└──────────────────────────────────────┘
MAX485 Board 1 (TX only) MAX485 Board 2 (RX only)
┌────────────────────────┐ ┌────────────────────────┐
│ VCC ◄── 5V │ │ VCC ◄── 5V │
│ GND ◄── GND │ │ GND ◄── GND │
│ │ │ │
│ DI ◄── HV1 │ │ RO ──► HV2 │
│ RO (unused) │ │ DI (unused) │
│ │ │ │
│ DE ◄── 5V ┐ locked │ │ DE ◄── GND ┐ locked │
│ RE ◄── 5V ┘ TX mode │ │ RE ◄── GND ┘ RX mode │
│ │ │ │
│ A ───────────────────┼──► pin 2 │ A ◄──────────────────┼── pin 4
│ B ───────────────────┼──► pin 3 │ B ◄──────────────────┼── pin 5
└────────────────────────┘ └────────────────────────┘
RJ-12 to Carryout G2
┌───────────────────────────┐
│ Pin 1 (White) ── GND │◄── ESP32 GND
│ Pin 2 (Red) ── TX+/TA │◄── A₁
│ Pin 3 (Black) ── TX-/TB │◄── B₁
│ Pin 4 (Yellow) ── RX+/RA │──► A₂
│ Pin 5 (Green) ── RX-/RB │──► B₂
│ Pin 6 (Blue) ── N/C │
└───────────────────────────┘
```
## Power Rails
```
ESP32 5V ──┬── Level Converter HV
├── MAX485₁ VCC
├── MAX485₁ DE + RE (tied high = TX mode)
└── MAX485₂ VCC
ESP32 3V3 ─── Level Converter LV
ESP32 GND ─┬── Level Converter GND
├── MAX485₁ GND
├── MAX485₂ GND
├── MAX485₂ DE + RE (tied low = RX mode)
└── RJ-12 Pin 1
```
## RJ-12 Cable Notes
Straight-wired 6P6C. Pin 1 is leftmost when looking at the jack with the clip
facing away from you (tab down). Wire colors per the standard flat cable:
| Pin | Color | Function | Connects to |
|-----|--------|------------------|--------------------|
| 1 | White | GND | Common ground |
| 2 | Red | TX+ (TA) | MAX485₁ A |
| 3 | Black | TX- (TB) | MAX485₁ B |
| 4 | Yellow | RX+ (RA) | MAX485₂ A |
| 5 | Green | RX- (RB) | MAX485₂ B |
| 6 | Blue | N/C | — |
If crimping your own cable, verify pin-to-color with a multimeter before
connecting to the dish. RJ-12 crimps are easy to get reversed (pins mirror
if the connector is flipped). A wrong connection won't damage anything
(differential signals are current-limited) but communication won't work.
## How It Works
The Carryout G2 uses RS-422 full-duplex: two separate differential pairs,
one for each direction. The MAX485 is a half-duplex RS-485 transceiver with
a shared A/B pair and direction control pins (DE/RE). By hardwiring DE/RE,
each board is locked into a single direction:
- **Board 1 (TX):** DE=HIGH, RE=HIGH → driver always enabled, receiver disabled.
ESP32 UART1 TX → level shifter → DI → differential A/B → G2 serial RX.
- **Board 2 (RX):** DE=LOW, RE=LOW → driver disabled, receiver always enabled.
G2 serial TX → differential A/B → RO → level shifter → ESP32 UART1 RX.
The SparkFun level converter translates between 3.3V (ESP32) and 5V (MAX485)
on both data lines. The two spare channels (LV3/HV3, LV4/HV4) are available
if DE/RE ever need GPIO control for a half-duplex variant.
## Firmware
See `firmware/ble-bridge/` — transparent BLE Nordic UART Service (NUS) bridge.
The firmware is the same regardless of whether the RS-422 transceiver is a
MAX490 (single full-duplex chip) or two MAX485s (locked half-duplex pair).
It only sees UART TX/RX on GPIO17/18.
## Loopback Test (no dish)
Before connecting to the G2, verify the bridge by shorting MAX485₁ A to
MAX485₂ A, and MAX485₁ B to MAX485₂ B (loop TX back into RX). Anything
sent via BLE or USB serial should echo back.