diff --git a/docs/ble-bridge-wiring.md b/docs/ble-bridge-wiring.md index d25f0c8..fa1971b 100644 --- a/docs/ble-bridge-wiring.md +++ b/docs/ble-bridge-wiring.md @@ -1,15 +1,21 @@ # BLE Bridge Wiring — ESP32-S3 + 2× MAX485 -Transparent BLE-to-RS422 bridge for the Winegard Carryout G2 satellite dish. +Transparent BLE-to-RS422 bridge for the Winegard Carryout G2 satellite dish, +with optional IMU and barometric sensors for orientation and refraction correction. ## Parts +**Bridge (required):** - 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 +**Sensors (optional):** +- 1× GY-9250 (MPU-9250) — 9-axis IMU (accelerometer + gyroscope + magnetometer) +- 1× BMP388 — barometric pressure + temperature + ## Schematic ``` @@ -113,6 +119,103 @@ 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. +## Sensors — I2C Bus + +The MPU-9250 and BMP388 share a single I2C bus on GPIO8 (SDA) / GPIO9 (SCL). +Both run at 3.3V directly from the ESP32, no level shifting needed. + +``` + I2C Bus (3.3V, 400kHz) + ───────────────────── + +ESP32 3V3 ──┬──────────────────┬─── MPU-9250 VCC + │ └─── BMP388 VCC + │ + ├── 4.7KΩ ── SDA bus ──┬── MPU-9250 SDA + │ └── BMP388 SDI + │ + └── 4.7KΩ ── SCL bus ──┬── MPU-9250 SCL + └── BMP388 SCK + +ESP32 GPIO8 (SDA) ──── SDA bus +ESP32 GPIO9 (SCL) ──── SCL bus + +ESP32 GND ──┬── MPU-9250 GND + └── BMP388 GND (SDO to GND = addr 0x76) + +MPU-9250 AD0 ── GND (I2C address = 0x68) +BMP388 SDO ── GND (I2C address = 0x76) +``` + +The 4.7KΩ pull-ups are shared — one pair for the whole bus. Many breakout +boards include onboard pull-ups already; if both the GY-9250 and BMP388 +boards have them, the combined parallel resistance (~2.3KΩ) is still fine +for 400kHz I2C at 3.3V. Only add external pull-ups if neither board has them. + +### MPU-9250 (GY-9250) — 9-Axis IMU + +| I2C Address | 0x68 (AD0 → GND) | +|-------------|-------------------| +| VCC | 3-5V (onboard LDO) | +| Interface | I2C (up to 400kHz) or SPI | + +**What it provides for satellite tracking:** + +- **Magnetometer (AK8963):** Compass heading for automatic north alignment. + Eliminates manual alignment of dish base "BACK" marking to true north. + Apply local magnetic declination to convert magnetic north → true north. +- **Accelerometer:** Gravity vector → tilt angle = elevation. Independent + verification of the dish firmware's reported EL position. +- **Gyroscope:** Angular rate during slews. Detect oscillation, overshoot, + and vibration for tuning the leapfrog overshoot compensation algorithm. + +**Mounting considerations:** The magnetometer is extremely sensitive to nearby +ferrous metals and electromagnetic interference from motors. Mount on the +fixed base plate, away from motor housings, with a known axis aligned to the +dish's reference direction. Rigid mounting — any flex between sensor and dish +structure introduces measurement error. + +### BMP388 — Barometric Pressure + Temperature + +| I2C Address | 0x76 (SDO → GND) | +|-------------|-------------------| +| VCC | 3.3V | +| Pressure range | 300-1250 hPa | +| Pressure resolution | ±0.01 hPa (±8 cm altitude) | +| Temperature accuracy | ±0.5°C | +| Interface | I2C (up to 3.4MHz) or SPI | + +**What it provides for satellite tracking:** + +- **Atmospheric refraction correction.** Radio signals bend as they pass + through the atmosphere, especially at low elevation angles. The amount of + bending depends on air pressure and temperature. At 15° elevation (the + Trav'ler's minimum), refraction shifts apparent position by ~0.2°. + Standard refraction models (Bennett, Saemundsson) take pressure and + temperature as inputs — the BMP388 provides both in real time. +- **Temperature monitoring.** Ambient temperature at the dish for thermal + drift awareness and electronics health monitoring. + +**Refraction formula (simplified Bennett):** +``` +R = 1/tan(el + 7.31/(el + 4.4)) × (P/1010) × (283/(273 + T)) +``` +Where R is refraction in arcminutes, el is apparent elevation in degrees, +P is pressure in hPa, T is temperature in °C. At el=15°, P=1013, T=20°C: +R ≈ 3.4 arcmin ≈ 0.057°. Small but meaningful for narrow-beam antennas. + +## Full GPIO Map + +| GPIO | Function | Interface | Notes | +|------|----------|-----------|-------| +| 17 | RS-422 TX | UART1 TX | → Level shifter → MAX485₁ DI | +| 18 | RS-422 RX | UART1 RX | ← Level shifter ← MAX485₂ RO | +| 8 | I2C SDA | I2C | MPU-9250 + BMP388 (shared bus) | +| 9 | I2C SCL | I2C | MPU-9250 + BMP388 (shared bus) | +| 38 | RGB LED | WS2812 | Onboard NeoPixel (DevKitC V1.1) | +| 43 | USB Console TX | UART0 | CH343 USB-serial (untouched) | +| 44 | USB Console RX | UART0 | CH343 USB-serial (untouched) | + ## Loopback Test (no dish) Before connecting to the G2, verify the bridge by shorting MAX485₁ A to