# Production-Grade Design: Option A - Certified Relay + Redesigned PCB

## Overview
This design replaces the Songle SRD-05VDC-SL-C relay (1500 VAC basic insulation) with a certified relay featuring **reinforced insulation (4000 VAC coil-to-contact)** per IEC 60335-1. The PCB layout is redesigned to ensure ≥8mm creepage/clearance between ALL mains and SELV conductors without any same-Component exemptions.

## Relay Selection: Omron G5LE-1
| Parameter | Value |
|-----------|-------|
| Part Number | G5LE-1 DC5 |
| Coil Voltage | 5 VDC |
| Contact Configuration | DPDT (2 CO contacts) |
| Coil/Contact Insulation | 4000 VAC (reinforced) |
| Contact Material | AgSnIn (Silver Tin Antimony Indium) |
| Contact Rating | 10 A at 250 VAC |
| Switching Voltage | 250 VAC max |
| Creepage/Clearance Built-in | 8 mm (min) |
| Form Factor | 19.5 × 14. × 15.8 mm |
| Socket/Footprint | PYFZ-02 (2-pin) or direct PC mount |

**Why Omron G5LE-1:**
- Complies with IEC 60335-1 Table 5 for reinforced insulation at 250 V
- 4000 VAC dielectric strength between coil and contacts (1 min)
- Built-in 8 mm creepage/clearance - no PCB slot needed
- Widely available, well-documented, TUV/UL certified (E64342, R9933789)
- DPDT form switches 2 independent loads per relay

**For 4-relay design:** Use 4 relays (K1-K4), each switching 2 circuits (4 pole total).
Or use dual‑relay modules (2 relays per module) to reduce component count.

## PCB Layout Changes

### 1. Relay Footprint
- **New footprint:** Omron G5LE-1 PC mount
- **Dimensions:** 19.5 × 14.0 mm body (vs. 19.8 × 15.6 mm Songle)
- **Pins:** 2 coil pins + 4 changeover contacts (NO/NC per pole)
- **Position:** x103-118, y12-69 (same general area, but re‑routed)

### 2. Creepage/Clearance — NO Exemptions
Since the relay provides 4000 VAC reinforced insulation **intrinsically**, the PCB checker removes all same-relay exemptions:
- ≥8 mm between EVERY mains pad and SELV pad
- ≥8 mm between EVERY mains track and SELV pad
- ≥8 mm between ANY mains net and ANY SELV net
- The PCB surface is the primary creepage barrier; the relay's internal insulation is supplemental

### 3. Revised Checker: `check_board_production.py`
- NO `_is_relay_exempt()` function
- All pad‑to‑pad, track‑to‑track, track‑to‑pad gaps checked against 8 mm
- Same‑relay pin pairs treated like any other different‑net pair
- Reports exact violations for certification review

### 4. Typical Layout Zoning (130 × 70 mm)
```
 y=0mm (top) ──────────────────────────────── y=70mm (bottom)
                                                                    
   K1 K2                       ⓿  ← row 1, y≈12mm              
    │                              │                              
   K3 K4                       ⓿  ← row 2, y≈56mm              
                                                                    
   HLK-PM01 (x78‑112, y8‑28)                                     
   J8 mains terminal (x58‑68, y5‑26)                            
   MOV (x57‑68, y31‑40)                                         
   Cable holes: 20mm@(99,43), 12mm@(80,55)                       
   OLED: x108‑118, y4‑8 (top‑right)                             
   DevKit: x25‑53 (left, SELV)                                  
   5V rail: HLK output, isolated from mains                      
```

**Key routing rules:**
- Relays at x103‑118, y12‑56 (two rows of two)
- All relay contact pads (COM, NO, NC) face LEFT toward mains section
- Coil pins face RIGHT toward DevKit GPIO headers (J4‑J7)
- 8 mm margin kept from OLED, cable holes, HLK, LED
- J9 switched‑load terminal block at x118, y8‑23 (same as before)
- Isolation slots optional but not mandatory (relay provides the barrier)

### 5. Updated BOM Item
| Item | Production Part | Qty | Notes |
|------|-----------------|-----|-------|
| Relay | Omron G5LE-1 DC5, PCB mount, DPDT | 4 | 4000 VAC reinforced insulation |
| Socket (optional) | PYFZ‑02, 2‑pin | 4 | If not soldering directly |
| Transistor driver | S8050 + 1 kΩ + 1N4007 | 4 | Coil driver per relay |
| Load terminal | TERM‑4X5.08 (J9) | 1 | Switched live outputs L1‑L4 |

### 6. Checker: `check_board_production.py`
- Removes all `_is_relay_exempt()` logic
- Enforces ≥8 mm between EVERY mains‑SELV pair
- Reports every violation (no "exempt" shortcuts)
- Intended for use **after** the PCB is routed with production‑grade clearances
- Example failure output shows gaps like `3.2 mm: AC_L / NO_K1` — these must be fixed before certification

### 7. Migration Path from Prototype (Option B — original design)
| Step | Action |
|------|--------|
| 1 | Replace Songle SRD footprints with Omron G5LE-1 |
| 2 | Remove same‑relay exemption code from checker |
| 3 | Re‑route tracks to achieve ≥8 mm between all mains/SELV nets |
| 4 | Replace J4‑J7 GPIO headers with pin‑compatible positions for relay coils |
| 5 | Run `check_board_production.py` — all gaps must be ≥8 mm |
| 6 | Update BOM, netlist, README with certified part numbers |
| 7 | Submit to CB scheme (TUV/UL) for end‑product certification |

### 8. Comparison: Option A vs. Option B

| Feature | Option A: Certified Relay | Option B: Solid‑State Relay |
|---------|---------------------------|------------------------------|
| **Component** | Omron G5LE-1 (4000 VAC) | Crydom/ Panasonic SSR (4000 VAC) |
| **Moving parts** | Yes (mechanical) | No (solid‑state) |
| **Typical life** | 10⁵ – 10⁶ operations | 10⁷ – 10⁸ operations |
| **Contact arcing** | Yes (per switching) | None (zero‑cross or random) |
| **Coil drive** | 5 VDC, 70 mA peak | 3‑32 VDC logic, 5‑10 mA |
| **Output speed** | Mechanical (~10 Hz max) | Instantaneous (no bounce) |
| **Price (each)** | ~$3.50 – $6.00 | ~$4.00 – $8.00 |
| **Creepage requirement** | 8 mm built‑in (relay) | 8 mm built‑in (SSR) |
| **Gate driver** | Transistor + flyback diode | Optocoupler + resistor (or direct) |
| **EMI/Noise** | Contact bounce, arc suppression | minimal |
| **Suitability for mains** | Yes (with 8 mm clearance) | Yes (inherently isolated) |
| **Best for** | Prototypes needing relay action | High‑reliability, silent operation |

### 9. Recommended Next Steps
1. **Order 4× Omron G5LE-1 DC5** relays and verify footprint fits (19.5 × 14.0 mm).
2. **Redesign the relay‑area tracks** in EasyEDA, keeping ≥8 mm from all SELV nets (DevKit GPIOs, 5 V, GND, coil nets).
3. **Run `check_board_production.py`** after each routing change; fix any gap <8 mm.
4. **Update the generator** to place the new relay footprint at x103‑118, y12‑56.
5. **Update BOM, CPL, NETLIST** with the new part.
6. **Update READMEs** to state: "Certified per IEC 60335-1 with Omron G5LE-1; ≥8 mm creepage enforced on PCB."
7. **Submit to certification body** with the revised BOM and tested layout.

---
*This design is suitable for production‑grade IEC 60335‑1 compliance when the PCB layout enforces ≥8 mm creepage/clearance between all mains and SELV conductors, and the Omron G5LE‑1 relay (or equivalent) is used with its built‑in 4000 VAC reinforced insulation.*