diff options
| -rw-r--r-- | docs/pmim-1-assembly.md | 276 |
1 files changed, 276 insertions, 0 deletions
diff --git a/docs/pmim-1-assembly.md b/docs/pmim-1-assembly.md new file mode 100644 index 0000000..95449ee --- /dev/null +++ b/docs/pmim-1-assembly.md @@ -0,0 +1,276 @@ +# PMIM-1 Assembly Guide +## Portable Marine Instrument Multiplexer + +The PMIM-1 is a self-contained sensor box that attaches to a stanchion or companionway and streams NMEA 0183 sentences to the Nav app over Wi-Fi UDP broadcast. It provides GPS, AIS, heading, attitude (heel/pitch), and barometric pressure/temperature. + +--- + +## Parts list + +| Part | Notes | Est. Cost | +|---|---|---| +| ESP32 DevKit V1 (30-pin) | Must be 30-pin, not 38-pin | $9 | +| dAISy Mini (UART variant) | TTL UART version, not USB | $85 | +| BN-880 module | Circular PCB ~28mm, integrated ceramic patch antenna | $24 | +| GY-521 (MPU-6050) | Small blue board ~21×16mm | $8 | +| BMP280 breakout | Verify BMP280, not BMP180 | $3 | +| IP67 enclosure, white body / clear lid | ~120×80×40mm interior | $15 | +| Anker PowerCore 10000mAh | No auto-shutoff at light load | $20 | +| IP67 SMA female bulkhead | Panel-mount style with O-ring | $5 | +| BNC-F to PL-259 adapter | For VHF antenna connection | $7 | +| IPEX (U.FL) to SMA pigtail, ~100mm | Connects dAISy to bulkhead | incl. | +| GoPro adhesive base + handlebar clamp | Standard Hero mount ecosystem | $15 | +| 28 AWG silicone wire | ~1m each: red, black, yellow, green, blue, white, orange | $5 | +| M2×6 standoffs + screws | 8× for ESP32 and dAISy | $2 | +| Perfboard, ~50×70mm | Single-sided, wiring substrate | $1 | +| PG7 cable gland | Sized for USB-C cable OD (~4–5mm) | $2 | +| 4.7kΩ resistors | 2× for I2C pull-ups if BMP280 board lacks them | — | +| 47Ω 0.5W resistor | Power bank keepalive load (optional, see notes) | — | +| Gore-Tex speaker mesh tape | Breathable waterproof vent cover | $3 | +| Silicone O-ring grease | Thin smear on lid O-ring at close-up | — | +| **Total** | | **~$204** | + +--- + +## Tools + +- Soldering iron, fine tip, 320–350°C +- Solder, 0.5mm rosin-core, and flux pen +- Multimeter (continuity + DC voltage) +- Step drill or 15.5mm bit (SMA bulkhead hole) +- 4mm drill bit (BMP280 vent) +- PG7 cable gland hole size per gland datasheet (~12mm) +- Rotary tool or hand drill +- Hot glue gun (strain relief) +- Tweezers and helping hands + +--- + +## Enclosure orientation + +Orient the enclosure so the **clear lid faces up toward the sky**. This gives the BN-880's ceramic patch antenna a direct sky view. The GoPro mount adheres to the solid bottom face. + +``` + Clear lid (faces sky) + ┌─────────────────────────┐ + │ GPS antenna view │ + └─────────────────────────┘ + Front face (toward bow preferred) + ┌──────────┐ + │ [SMA] │ ← AIS antenna exits here + └──────────┘ + Back face + ┌──────────────────────────┐ + │ [4mm vent, Gore-Tex] │ ← BMP280 pressure equalization + └──────────────────────────┘ + Bottom face (GoPro mount) + ┌──────────────────────────┐ + │ [PG7 cable gland] │ ← USB-C power from power bank + └──────────────────────────┘ +``` + +--- + +## Step 1 — Drill the enclosure + +1. **SMA bulkhead hole:** Center on the front face, ~15mm from one edge. Step-drill to 15.5mm. Install the SMA bulkhead connector with O-ring and nut — finger-tight plus ¼ turn. + +2. **BMP280 vent:** 4mm hole on the back face, as high as possible to avoid splash. Leave uncovered until components are mounted (Step 5). + +3. **Power cable gland:** Bottom face. Drill to PG7 spec (~12mm). Thread the USB-C cable through before soldering its end — you can't pull a USB-C plug through a gland. + +--- + +## Step 2 — Perfboard layout + +Cut perfboard to fit the enclosure floor with ~5mm clearance each side. Lay out components before soldering anything: + +``` +┌────────────────────────────────────────────┐ +│ │ +│ [BN-880] [ESP32 DevKit V1] │ +│ compass far corner ┌────────────────┐ │ +│ ≥35mm from ESP32 │ │ │ +│ ○ (28mm circle) │ 30-pin │ │ +│ │ DevKit │ │ +│ [BMP280] │ │ │ +│ near back vent └────────────────┘ │ +│ │ +│ [GY-521] [dAISy Mini] │ +│ center right side, near SMA wall │ +│ │ +└────────────────────────────────────────────┘ +``` + +> **Critical:** Keep BN-880 (HMC5883L compass) at least 35mm from the ESP32. The 2.4 GHz Wi-Fi radio causes magnetic interference at close range. + +Mount ESP32 and dAISy on M2×6 standoffs. Mount BN-880, GY-521, and BMP280 with double-sided foam tape, BN-880 ceramic antenna facing up toward the clear lid. + +--- + +## Step 3 — Power wiring + +``` +Power bank → USB-C cable → PG7 cable gland + → ESP32 VIN (5V) [red wire] + → ESP32 GND [black wire] + +ESP32 3.3V pin → 3.3V bus rail along perfboard edge +ESP32 GND → GND bus rail + +3.3V rail → dAISy VCC, BN-880 VCC, GY-521 VCC, BMP280 VCC +GND rail → all module GNDs +``` + +> **Before powering:** Measure 3.3V rail to GND resistance cold (power off). Should be several kΩ. A short here will kill the ESP32's onboard regulator. + +**Power bank keepalive:** If the power bank cuts out at light load, solder a 47Ω 0.5W resistor between the 5V and GND rails on the perfboard. This draws ~100mA continuously and keeps the bank alive. Try without it first — Anker PowerCore units usually don't need it. + +--- + +## Step 4 — UART wiring + +| Signal | ESP32 pin | Module pin | Wire color | +|---|---|---|---| +| UART1 RX | GPIO16 | dAISy TX | Yellow | +| UART1 TX | GPIO17 | dAISy RX | Orange | +| UART2 RX | GPIO4 | BN-880 TX | Green | +| UART2 TX | GPIO2 | BN-880 RX | White | + +> dAISy RX and BN-880 RX are only needed for sending config commands. Leave them unconnected for basic operation if you want to keep it simple. + +**Baud rates:** +- dAISy Mini UART: 38400 8N1 +- BN-880 GPS: 9600 8N1 (default) + +--- + +## Step 5 — I2C bus wiring + +Single shared bus to all three sensors: + +| Signal | ESP32 pin | Wire color | +|---|---|---| +| SDA | GPIO21 | Blue | +| SCL | GPIO22 | Purple | + +Daisy-chain both SDA and SCL to each sensor: GY-521 → BN-880 → BMP280. + +**Pull-up resistors:** GY-521 and BN-880 breakouts have 4.7kΩ pull-ups onboard. Check your BMP280 board — if it lacks them, add 4.7kΩ from SDA→3.3V and SCL→3.3V on the perfboard. + +**I2C addresses:** + +| Device | Address | How to set | +|---|---|---| +| MPU-6050 (GY-521) | 0x68 | Leave AD0 floating or tie to GND | +| HMC5883L (BN-880) | 0x1E | Fixed | +| BMP280 | 0x76 | SDO pulled LOW (0x77 if HIGH) | + +--- + +## Step 6 — RF chain + +``` +dAISy Mini IPEX/U.FL port + → IPEX-to-SMA pigtail (route flat inside enclosure) + → SMA bulkhead (in enclosure wall, O-ring sealed) + → [outside] BNC-F to PL-259 adapter + → VHF antenna coax +``` + +Keep the IPEX pigtail as short as possible and route it away from I2C and UART wires. Seat the IPEX connector firmly — it should click. + +--- + +## Step 7 — Calibration button + +Add a normally-open tactile button for IMU zero-offset calibration: + +- One terminal → GPIO0 +- Other terminal → GND +- 10kΩ pull-up from GPIO0 → 3.3V (or use ESP32 internal pull-up in firmware) + +For field access without opening the box, thread an IP67 panel-mount push-button through the enclosure wall. Otherwise, accept that calibration requires opening the lid — acceptable for initial dock setup. + +--- + +## Step 8 — BMP280 pressure vent + +Cut a 15mm circle of Gore-Tex speaker mesh tape. Apply it over the 4mm vent hole from the **inside** of the enclosure, pressing firmly around all edges. This lets atmospheric pressure equalize for accurate barometer readings while blocking water. + +Position the BMP280 within 20mm of this hole with its sensor port facing toward it. + +--- + +## Step 9 — Pre-close checklist + +Run through this before sealing the enclosure: + +- [ ] Continuity: all GND connections ring out to common ground +- [ ] No shorts: 3.3V rail to GND ≥ 5kΩ cold +- [ ] IPEX connector fully seated (it clicks) +- [ ] SMA bulkhead O-ring seated, nut snug +- [ ] PG7 cable gland compression ring tight around USB-C cable +- [ ] BN-880 ceramic antenna facing up toward clear lid +- [ ] All wires lie flat — none above the tallest component +- [ ] I2C scan (with firmware running) shows 0x1E, 0x68, 0x76 +- [ ] NMEA sentences confirmed arriving on phone before sealing + +--- + +## Step 10 — Seal and mount + +1. Confirm lid O-ring is clean and seated in its groove. Apply a thin smear of silicone grease. +2. Close lid. Tighten all screws evenly in a cross-pattern. +3. **IP test:** Hold under running tap water for 10 seconds. Dry, open, check for moisture. Do this before attaching the GoPro mount. +4. Attach GoPro adhesive base to the bottom face (or use the handlebar clamp on a stanchion). + +**Companionway:** Peel adhesive, press to clean dry surface, weight for 24h cure. +**Stanchion:** Handlebar clamp around 25mm tube. Use a rubber shim if your stanchion diameter differs. Orient clear lid skyward and inboard for best GPS view. + +--- + +## First power-on + +1. Leave box open for initial test. +2. Connect power bank. ESP32 LED should illuminate. +3. On your phone, join the PMIM-1 Wi-Fi AP (SSID set in firmware). +4. Open Nav app → enable NMEA Instruments in hardware settings. +5. Confirm data: GPS fix within ~60s cold start; AIS targets if vessels nearby; attitude immediately; baro after a few seconds. +6. Tilt the box ~15° and confirm the inclinometer in the app responds. +7. Close box, re-test over Wi-Fi. + +--- + +## Troubleshooting + +| Symptom | Likely cause | Fix | +|---|---|---| +| Power bank cuts out after ~30s | Auto-shutoff at light load | Add 47Ω keepalive resistor | +| Compass heading drifts or spins | BN-880 too close to ESP32 | Increase separation, add mu-metal shim | +| No AIS targets (even near traffic) | IPEX not seated / bad antenna connection | Re-seat IPEX, check SMA continuity | +| dAISy takes ~30s to start | Normal warm-up | Wait — not a fault | +| GPS cold start >5 min | Poor sky view | Orient clear lid more skyward | +| 0x76 missing from I2C scan | BMP280 SDO high (→ 0x77) or bad connection | Check SDO pin, rescan at 0x77 | +| Baro reads but lags weather changes | Vent hole blocked or Gore-Tex not breathable | Check mesh tape seal | + +--- + +## Pin summary + +``` +ESP32 DevKit V1 — complete pin assignment + +GPIO1 → UART0 TX (debug/flash — do not use for peripherals) +GPIO3 → UART0 RX (debug/flash — do not use for peripherals) +GPIO2 → UART2 TX → BN-880 RX +GPIO4 → UART2 RX → BN-880 TX +GPIO16 → UART1 RX → dAISy TX +GPIO17 → UART1 TX → dAISy RX +GPIO21 → I2C SDA → MPU-6050, HMC5883L, BMP280 +GPIO22 → I2C SCL → MPU-6050, HMC5883L, BMP280 +GPIO0 → Calibration button (pull-up, active LOW) +VIN → 5V from power bank +3.3V → 3.3V supply rail +GND → Common ground +``` |
