# 📋 Professional PCB, Schematic & 3D Enclosure Prompt

Copy the entire content below and use it as a prompt with your preferred AI image generation tool. For best results, include "--style photorealistic --ar 16:9" or similar parameters for your specific tool.

================================================================================
## BOARD OVERVIEW & SPECIFICATIONS
================================================================================

### Board Information
- **Project**: FirebaseOTA 3x6 carrier Rev A
- **Board size**: 130 × 70 mm × 1.6 mm FR-4, 2-layer PCB
- **Application**: IoT energy monitoring with 4-channel switching
- **Power**: 230V AC mains input, 5V DC output via HLK-PM01
- **ESystem**: ESP32 DevKit V1 (30-pin), optically isolated circuits

### Key Components Positioning
- **DevKit ESP32**: Left side (x=25-53), 30-pin header, antenna at top
- **HLK-PM01 power module**: Bottom-right (x=78-112, y=8-28)
- **MOV 275VAC**: x=57-68, y=31-40 (surge protection)
- **OLED SSD1306**: Top-right (x=108-118, y=4-8)
- **PZEM-004T**: Left-middle (x=10-30)
- **4× Relays/SSRs**: Right side, two rows (y=12 and y=54)
- **J9 terminal block**: Far right (x=118, y=8-23), 4-position switched loads
- **J8 terminal block**: Lower-middle (x=58-68, y=5-26), AC in/out
- **Cable glands**: 20mm @ (99,43), 12mm @ (80,55) at back can
- **LED indicator**: x=66, y=44 (5V power)

### Design Options

#### Option A: Certified Relay Design
- **4× Omron G5LE-1 DC5 relays** (4000 VAC reinforced insulation, DPDT)
- **Driver circuits**: S8050 transistor + 1 kΩ + 1N4007 per relay
- **GPIOs used**: GPIO25, GPIO26, GPIO27, GPIO32 (coil control)
- **Coil current**: ~70 mA per relay at 5 VDC
- **Contact rating**: 10 A at 250 VAC
- **Life expectancy**: 10⁵–10⁶ operations
- **Noise**: Audible click during switching
- **Creepage/clearance**: PCB must enforce ≥8 mm between ALL mains and SELV nets (no same-relay exemptions)
- **BOM**: Omron G5LE-1 part, transistor drivers, original prototype components preserved

#### Option B: Solid-State Relay Design
- **4× Crydom ODN2225** (or Panasonic AQ222S) SSRs (4000 VAC internal insulation)
- **Driver circuits**: 2 resistors per relay (4× 2.2 kΩ + 4× 1 kΩ), NO transistors needed
- **GPIOs used**: GPIO25 (motion), GPIO26 (socket 1), GPIO27 (socket 2), GPIO32 (temperature)
- **Input current**: ~2.5 mA per relay from ESP32 GPIO (within 40 mA max)
- **Output current**: 2 A continuous at 250 VAC (zero-cross recommended)
- **Life expectancy**: 10⁷–10⁸ operations (no mechanical wear)
- **Noise**: Silent operation
- **Creepage/clearance**: PCB must enforce ≥8 mm between input and output copper; leverages SSR's 4000 VAC internal insulation as primary barrier
- **BOM**: SSRs + 8 resistors replace relays + transistors; simpler driver circuit

### Electrical Specifications
- **Mains voltage**: 230 VAC, 50 Hz
- **Output voltage**: 5 VDC from HLK-PM01 (3 W, 500 mA fuse)
- **GPIO voltage**: 3.3 V logic (ESP32), 5 V tolerant
- **I2C**: GPIO21 (SDA), GPIO22 (SCL) for OLED
- **Serial**: GPIO16, GPIO17 for PZEM-004T
- **Fuse**: 5×20mm, 500 mA slow-blow in series with AC live
- **Isolation**: 4000 VAC reinforced insulation (SSR or G5LE-1, depending on option)

### Net Names & Connections
**Power nets**: 3V3, 5V, 5V_RAW, AC_L, AC_L_F, AC_N, GND, EN

**GPIO nets**: GPIO1-GPIO39 (esp. GPIO25, GPIO26, GPIO27, GPIO32 for relay/SSR control)

**Load nets**: L1, L2, L3, L4 (switched outputs to J9 terminal block)

**SSR/Relay nets** (Option B): SSR_K1_AN/SSR_K1_CAT/SSR_K1_COM/SSR_K1_NO (and K2-K4)

**Connector nets**: J1-J4, J8 pins 1-4, J9 pins 1-4

================================================================================
## SCHEMATIC DIAGRAM VISUALIZATION
================================================================================

### Schematic Elements to Include

#### Power Section
- HLK-PM01 AC/DC 5V 3W module
- SS34 Schottky diode (D1, reverse protection)
- 5×20mm 500 mA slow-blow fuse (F1)
- 275 VAC MOV (MOV1, surge protection)
- AC_L, AC_L_F, AC_N mains distribution nets
- 5V_RAW → SS34 → 5V rail with decoupling capacitors

#### ESP32 DevKit Section
- 30-pin header with all GPIO breaks
- GPIO21 (SDA) → OLED I2C data
- GPIO22 (SCL) → OLED I2C clock
- GPIO16, GPIO17 → PZEM-004T serial data
- GPIO25, GPIO26, GPIO27, GPIO32 → relay/SSR coil control
- 3V3, GND distribution nets
- GPIO13, GPIO12, GPIO14, GPIO15, GPIO16, GPIO17 for peripheral control

#### Relay/SSR Section (Option A)
- **4× Omron G5LE-1 DC5** relays (K1-K4)
- Each relay: 5 VDC coil, 4000 VAC reinforced insulation
- **Driver per relay**: S8050 NPN transistor + 1 kΩ base resistor + 1N4007 flyback diode
- **Coil connections**: GPIOxx_coil_a/b nets
- **Contact nets**: COM_Kx/NO_Kx/NC_Kx (mains, 4000 VAC internal)
- **Isolation**: PCB must enforce ≥8 mm between all mains and SELV nets

#### Relay/SSR Section (Option B)
- **4× Crydom ODN2225** (or Panasonic AQ222S) SSRs
- **Input side**: GPIOxx → 2.2 kΩ → SSR ANODE; SSR CATHODE → 1 kΩ → GND
- **No transistors needed** - direct GPIO drive
- **Output side**: SSR_COM (all 4 connected) → J8 pin 4 (AC_N/neutral)
- **Output NO**: SSR_NO K1→J9 L1, K2→J9 L2, K3→J9 L3, K4→J9 L4
- **4000 VAC internal insulation** between input and output per datasheet
- **Isolation**: PCB enforces ≥8 mm creepage between input/output copper as supplementary barrier

#### I2C OLED Section
- SSD1306 128×64 display
- GPIO21 → **SDA** (data line)
- GPIO22 → **SCL** (clock line)
- 3V3 → **VCC**
- GND → **GND**
- Library: `Adafruit-SSD1306`, `Adafruit-GFX-library`

#### PZEM-004T Energy Meter Section
- VCC → 5V rail
- GND → system ground
- GPIO16 → PZEM **RX** data
- GPIO17 → PZEM **TX** data
- Communication via serial at 9600 baud (typical)
- Library: `PZEM004T` by Markus Sattler

#### Terminal Blocks
- **J1**: 2×12 2.54 mm header, GPIO expansion (left side)
- **J2**: 1×4 2.54 mm header, PZEM-004T (5V, GND, GPIO16, GPIO17)
- **J3**: 1×4 2.54 mm header, OLED I2C (3V3, GND, GPIO21 SDA, GPIO22 SCL)
- **J4-J7**: 1×3 2.54 mm header, GPIO expansion (5V, GND, GPIO25/26/27/32)
- **J8**: 4-way 5.08 mm terminal block, AC in/out
  - Pin 1: AC_L (mains live in)
  - Pin 2: AC_L_F (fused live out)
  - Pin 3: AC_N (mains neutral out)
  - Pin 4: AC_N (mains neutral in)
- **J9**: 4-way 5.08 mm terminal block, switched loads L1-L4
  - L1-L4: Switched live outputs from relay/SSR NO contacts
  - Common: All SSR_COM connected to J8 pin 4 (AC_N)

#### Component Footprints
- **DevKit**: ESP32-DEVKIT-V1-30P, 2×15 pin headers (2.54 mm)
- **Relays**: Omron G5LE-1 DC5, 4-pin DPDT, 19.5×14.0 mm (Option A)
- **SSRs**: Crydom ODN2225, 4-pin DIP, ~15×10 mm (Option B)
- **MOV**: 14 mm 275 VAC, radial lead
- **Fuse**: 5×20 mm format, 500 mA slow-blow
- **Terminal blocks**: 5.08 mm and 2.54 mm pitch headers
- **OLED**: SSD1306, typically 0.96", I2C interface
- **PZEM**: PCB-mount energy meter module

### Silk Screen & Markings
- **Board outline**: Rounded corners, 130×70 mm, 1.6 mm thickness
- **Component designators**: C1, D1, F1, J1-J9, K1-K4 (Option A) or SSR_K1-K4 (Option B), L1-L4, MOV1, R1-R8, U1, U2
- **Section labels**: "AC IN", "LOAD OUT", "SELV", "Mains", "GPIO", "SSR/Relay"
- **Safety warning**: "230V AC - KEEP CLEAR", "Solid-state relays — 4000 VAC reinforced insulation — do not open under voltage"
- **Project text**: "FirebaseOTA  3x6 carrier  Rev A  130x70" (bottom-left, large font)

================================================================================
## 3D ENCLOSURE DESIGN
================================================================================

### Enclosure Specifications

#### Physical Requirements
- **Device**: FirebaseOTA 3x6 carrier board
- **Board dimensions**: 130 × 70 × 1.6 mm (max)
- **Components height**: Max 25 mm above PCB (including relays/SSRs + resistors)
- **Mounting**: 4× M3 screws, 3.5×12 mm countersunk with nuts
- **Cable entries**: 20 mm cable gland at back, 12 mm for sensor/PZEM cable
- **Ventilation**: Passive cooling; relays/SSRs may need small heatsink pads if switching >1 A continuous
- **Enclosure material**: ABS or PETG, 2-3 mm thickness, UV-resistant
- **IP rating**: IP20 indoor use only (not waterproof)

#### Front Panel Layout
```
╔═══════════════════════════════════════════════════════════════════════
║                      FirebaseOTA 3x6 carrier              ║
║  ╔══════════════════════════════════════════════════════════════════════
║  ║  OLED Display (128×64)                                ║  ║
║  ║  Shows: Energy, GPIO status, Relay/SSR state            ║  ║
║  ║                                                       ║  ║
║  ║  [K1] [K2]                                              ║  ║
║  ║  [K3] [K4]                                              ║  ║
║  ║                                                       ║  ║
║  ║  Status LEDs: PWR, Relay/SSR active indicators        ║  ║
║  ║                                                       ║  ║
║  ║  J8: AC IN  (L, N, Fused)                             ║  ║
║  ║  J9: LOAD OUT (L1, L2, L3, L4)                        ║  ║
║  ════════════════════════════════════════════════════════════════════════
║  ╂  Back View: Cable glands, fuse access, mounting holes  ╂  ║
╚════════════════════════════════════════════════════════════════════════
```

#### Enclosure Options

**Option A: Open-frame with Cover**
- Material: 3 mm ABS or PETG
- Open bottom for heat dissipation
- Snap-fit or screw-closed top cover
- Cable glands on rear panel
- ventilation slots (2-3 mm) on sides for relay heat
- Mounting: 4× M3 bosses at corners + 2× side bosses for wall mounting

**Option B: Sealed Enclosure**
- Material: 3 mm ABS, IP42 rated
- Full enclosure with gasket seal
- Cable glands with strain relief
- Removable front panel for service access
- Dust covers over OLED and PZEM
- Mounting: 4× M3 bosses + keyhole slots for wall mounting

**Option C: Din-rail Mount**
- Designed for DIN-rail (35 mm) mounting
- Enclosure hinges at top for book-open style
- Cable glands at bottom rear
- Label panel on front for relay/SSR assignments
- Heat sink compound on relay/SSR bases if needed

#### 3D Model Key Features

**Visual Appearance**
- **Color**: White (RAL 9010) or dark gray (RAL 7021)
- **Optional**: Custom color or logo embossing
- **Surface finish**: Matte or semi-gloss
- **Corner radius**: 3-5 mm typical

**Internal Layout (Top View)**
```
+---------------------------------------------------------+
|                                                         |
|              [DevKit ESP32]                              |
|              (left, 30-pin header)                       |
|                                                         |
|            +--------+          +--------+               |
|            |  HLK   |          |  MOV   |               |
|            |  Power   |          |  275V  |               |
|            +--------+          +--------+               |
|                                                         |
|      +---------+      +---------+      +---------+      |
|      |  OLED   |      |  PZEM   |      |  FUSE   |      |
|      |  Display  |      | Meter   |      |  500mA  |      |
|      +---------+      +---------+      +---------+      |
|                                                         |
|    +---------+ +---------+ +---------+ +---------+     |
|    |  Relay 1| |  Relay 2| |  Relay 3| |  Relay 4|     |
|    |  (Option A)| | (Option A)| | (Option A)| | (Option A)|     |
|    +---------+ +---------+ +---------+ +---------+     |
|    (Or: +---------+ +---------+ +---------+ +---------+     |
|    (Or: [SSR]  [SSR]  [SSR]  [SSR]                     |
|    (Option B))                                          |
|                                                         |
|      +---------+                                          |
|      +---------+      +---------+      +---------+      |
|      |  J8     |      |         |      |  J9     |      |
|      |  AC IN  |      |                         |  LOAD OUT|
|      +---------+      +---------+      +---------+      |
|                                                         |
+---------------------------------------------------------+
```

#### Enclosure Specifications for 3D Modeling

| Parameter | Value | Notes |
|-----------|-------|-------|
| **Width** | 140 mm (board 130 mm + 5 mm margin each side) |
| **Height** | 80 mm (board 70 mm + components ~25 mm + 5-10 mm margin) |
| **Depth** | 100 mm (back cavity + cable glands) |
| **Wall thickness** | 3 mm (ABS/PETG) |
| **Mounting holes** | 4× M3, 3.5 mm drill, at corners + keyhole slots |
| **Cable gland holes** | 20 mm (rear), 12 mm (side for PZEM sensor) |
| **Ventilation** | 2-3 mm slots on sides (Option A relays generate heat) |
| **Material** | ABS (default) or PETG (heat resistant) |
| **Color** | White (RAL 9010) default, customizable |

### Internal Layout Zones

**Zone 1: Left Side (x=0-30)**
- DevKit ESP32 (30-pin header)
- PZEM-004T energy meter
- GPIO headers J1, J2, J3

**Zone 2: Center (x=30-70)**
- HLK-PM01 power module
- MOV 275VAC surge protector
- 5V regulator area with SS34 diode
- 500 mA fuse
- Main AC terminals J8

**Zone 3: Right Side (x=70-130)**
- 4× Relays/SSRs (K1-K4)
- 8 input resistors (Option B only: 4× 2.2 kΩ + 4× 1 kΩ)
- J9 terminal block (L1-L4 switched loads)
- Cable glands and test points

**Zone 4: Bottom (entire width)**
- GND plane/pour (internal layer)
- Fuse holder
- MOV capacitor
- Large copper pours for power distribution

### 3D Model Parameters (for AI generators)

```
prompt: "3D model of FirebaseOTA 3x6 carrier enclosure, 
beige ABS plastic, 140×80×100 mm, 
M3 mounting bosses at corners, 
20mm cable gland at rear, 
12mm hole for sensor wiring, 
ventilation slots on sides, 
internal layout visible showing ESP32, 
HLK-PM01, MOV, 4 relays/SSRs, 
OLED display, terminal blocks J8/J9, 
white color, matte finish, 
engineering drawing style, 
lighting: studio softbox, 
background: white, 
--ar 16:9 --v 6.0"
```

### Enclosure Cross-section

```
+--------------------------------------------------------------+
|                                                          |
|            +-----------+          +-----------+            |
|            |   Top     |          |   Cover   |            |
|            |   Cover   |          |   (removable)|            |
|            +-----------+          +-----------+            |
|              |  vent     |               |                 |
|           /    /    /    /    /    /    /    /    /    /    |
|  +-------------+-------------+-------------+-------------+  |
|  |             |             |             |             |  |
|  |  GND pour   |   Components  |   Relays/SSRs   |   Cables   |  |
|  |   (internal)|   (height<25mm)|   (K1-K4)       |   (J8/J9)  |  |
|  +-------------+-------------+-------------+-------------+  |
|           |  vent     |               |                 |
|           /    /    /    /    /    /    /    /    /    /    |
|  +-------------+-------------+-------------+-------------+  |
|  |             |             |             |             |  |
|  |  GND pour   |   Components  |   Relays/SSRs   |   Cables   |  |
|  |   (internal)|   (height<25mm)|   (K1-K4)       |   (J8/J9)  |  |
|  +-------------+-------------+-------------+-------------+  |
|           |  vent     |               |                 |
|           /    /    /    /    /    /    /    /    /    /    |
|  +-------------+-------------+-------------+-------------+  |
|  |             |             |             |             |  |
|  |  GND pour   |   Components  |   Relays/SSRs   |   Cables   |  |
|  |   (internal)|   (height<25mm)|   (K1-K4)       |   (J8/J9)  |  |
|  +-------------+-------------+-------------+-------------+  |
|           |  vent     |               |                 |
|           /    /    /    /    /    /    /    /    /    /    |
|  +-------------+-------------+-------------+-------------+  |
|  |             |             |             |             |  |
|  |  ...        |             |             |             |  |
+--------------------------------------------------------------+
```

================================================================================
## PROMPT STRUCTURE GUIDE
================================================================================

### How to Use This Prompt

**1. Copy Entire Content**
- Select all content from `================================================================================` to `================================================================================`
- Paste into your AI image generator's prompt field

**2. Add Tool-Specific Parameters**
- **Midjourney**: `--style photorealistic --ar 16:9 --v 6.0 --st 25`
- **DALL-E 3**: Just paste the text; DALL-E handles parameters naturally
- **Stable Diffusion**: Use the prompt as-is with your favorite checkpoint, or add `best quality, ultra detailed`

**3. Modify for Your Needs**
- Change `--ar 16:9` to `--ar 16:10` for widescreen
- Change `white ABS` to `black PETG` or your preferred material/color
- Adjust component heights if your design differs
- Add your company logo or specific labeling requirements

### Example Prompt Formats

**For Midjourney:**
```
PROFESSIONAL PCB DESIGN & 3D ENCLOSURE PROMPT
[FULL PROMPT HERE]
--style photorealistic --ar 16:9 --v 6.0 --st 25 --q 2
```

**For DALL-E 3:**
```
PROFESSIONAL PCB DESIGN & 3D ENCLOSURE PROMPT
[FULL PROMPT HERE]
```

**For Stable Diffusion:**
```
PROFESSIONAL PCB DESIGN & 3D ENCLOSURE PROMPT
[FULL PROMPT HERE]
best quality, ultra detailed, professional rendering
```

================================================================================
## QUICK START EXAMPLES
================================================================================

### Example 1: Full PCB + Schematic + Enclosure (Midjourney)
```
PROFESSIONAL PCB DESIGN & 3D ENCLOSURE PROMPT
[FULL PROMPT HERE]
--style photorealistic --ar 16:9 --v 6.0 --st 25 --q 2
```

### Example 2: PCB Layout Only (DALL-E 3)
```
PROFESSIONAL PCB DESIGN & 3D ENCLOSURE PROMPT
[FULL PROMPT HERE, focusing on PCB/top view sections]
--style photographic --ar 4:3
```

### Example 3: Enclosure Only (Stable Diffusion)
```
PROFESSIONAL PCB DESIGN & 3D ENCLOSURE PROMPT
[FULL PROMPT HERE, focusing on enclosure/3D sections]
best quality, ultra detailed, 3d render, product design, 
aesthetic, minimal rendering, studio lighting, white background
```

================================================================================
## NOTES & TIPS
================================================================================

### For Best Results
1. **Include the full prompt** - all sections provide essential context
2. **Use appropriate aspect ratios** - 16:9 for widescreen presentations, 4:3 for documents
3. **Specify materials** - ABS, PETG, FR-4, etc. affect render realism
4. **Specify lighting** - studio softbox, natural light, or your preference
5. **Include version info** - ensures AI generates the correct Rev A design

### Customization Options
- **Change board color**: Modify "white ABS" or "green FR-4"
- **Change enclosure color**: "black PETG", "silver aluminum", etc.
- **Add logos**: Include "with company logo at bottom-right"
- **Show internal layout**: "exploded view showing internal components"
- **Multiple views**: "isometric, top view, side view in one image"

### AI Generator Notes
- **Midjourney**: Works best with `--style photorealistic` and version 6.0+
- **DALL-E 3**: Best with natural language; the prompt structure handles well
- **Stable Diffusion**: Use `best quality, ultra detailed` tags for professional results
- **All generators**: May need multiple attempts (parameter `--q 2` = 2x upscale quality)

================================================================================
## FILE INFORMATION
================================================================================

- **Format**: Markdown (.md)
- **Created**: 2026-11-05
- **Compatible with**: Midjourney, DALL-E 3, Stable Diffusion, and other AI image generators
- **Sections**: 8 major sections (Board Overview, Schematic, 3D Enclosure, Prompt Structure, Quick Start Examples, Notes)
- **Options covered**: Both Option A (Certified Relay) and Option B (Solid-State Relay)
- **Generated**: In `/home/the-brain/Desktop/project/FirebaseOTA/hardware/patress_3x6/pcb/`

================================================================================
END OF PROMPT
================================================================================