{
  "schema_version": 1,
  "course_id": "mains-ac-switching",
  "course_version": "1.0.0",
  "title": "Mains AC switching — a lamp switch from first principles",
  "canonical_url": "https://psym.pl/mains-course/",
  "date": "2026-11-06",
  "language": "en",
  "audience": "Electronics graduate or experienced hobbyist; no previous mains product design",
  "estimated_total": "35–50 hours study, calculation and low-voltage experiments; no live-mains work required",
  "chapters": [
    {
      "id": "ch00",
      "title": "Course architecture and safety boundaries",
      "url": "index.html#ch00",
      "objective": "Separate teaching models, CAD evidence and measured evidence, and keep live-mains work outside the course.",
      "prerequisites": [],
      "exercise_id": "E00",
      "topics": [
        "The Lambka case study",
        "Safety boundaries of this course",
        "How to study",
        "A rule for using AI during the project"
      ],
      "estimated_study_minutes": 60,
      "part": "Foundations",
      "source": "lessons/course.md",
      "evidence_required": "Written reasoning with units, sources of every safety number (standard and edition, datasheet revision) and comparison with the worked answer; physical claims additionally require recorded measurements under a reviewed test procedure.",
      "review_status": "not_started"
    },
    {
      "id": "ch01",
      "title": "Energy, power and RMS",
      "url": "index.html#ch01",
      "objective": "Calculate real power, RMS current and total power factor for distorted waveforms.",
      "prerequisites": [
        "ch00"
      ],
      "exercise_id": "E01",
      "topics": [
        "RMS values describe heating",
        "Total power factor",
        "Why RMS matters for the switch"
      ],
      "estimated_study_minutes": 120,
      "part": "Foundations",
      "source": "lessons/course.md",
      "evidence_required": "Written reasoning with units, sources of every safety number (standard and edition, datasheet revision) and comparison with the worked answer; physical claims additionally require recorded measurements under a reviewed test procedure.",
      "review_status": "not_started"
    },
    {
      "id": "ch02",
      "title": "Stored energy and discharge",
      "url": "index.html#ch02",
      "objective": "Calculate stored energy and discharge times, and size a discharge resistor against a stated requirement.",
      "prerequisites": [
        "ch01"
      ],
      "exercise_id": "E02",
      "topics": [
        "Capacitors",
        "Inductors",
        "Energy in faults"
      ],
      "estimated_study_minutes": 120,
      "part": "Foundations",
      "source": "lessons/course.md",
      "evidence_required": "Written reasoning with units, sources of every safety number (standard and edition, datasheet revision) and comparison with the worked answer; physical claims additionally require recorded measurements under a reviewed test procedure.",
      "review_status": "not_started"
    },
    {
      "id": "ch03",
      "title": "Rectifiers, power factor and LED lamp input current",
      "url": "index.html#ch03",
      "objective": "Predict the pulsed input current of a capacitor-input LED lamp, its power factor and its inrush.",
      "prerequisites": [
        "ch02"
      ],
      "exercise_id": "E03",
      "topics": [
        "The conduction interval",
        "A worked lamp",
        "Harmonics and why grids care",
        "Inrush"
      ],
      "estimated_study_minutes": 120,
      "part": "Foundations",
      "source": "lessons/course.md",
      "evidence_required": "Written reasoning with units, sources of every safety number (standard and edition, datasheet revision) and comparison with the worked answer; physical claims additionally require recorded measurements under a reviewed test procedure.",
      "review_status": "not_started"
    },
    {
      "id": "ch04",
      "title": "Supplies at a glance: LDO, dropper, buck and flyback",
      "url": "index.html#ch04",
      "objective": "Compare LDO, capacitive-dropper, buck and flyback supplies by isolation, loss and failure behaviour.",
      "prerequisites": [
        "ch03"
      ],
      "exercise_id": "E04",
      "topics": [
        "Rectification is not isolation",
        "Linear regulator loss",
        "The capacitive dropper",
        "Buck and flyback in one paragraph each",
        "What the module datasheet must give you"
      ],
      "estimated_study_minutes": 120,
      "part": "Foundations",
      "source": "lessons/course.md",
      "evidence_required": "Written reasoning with units, sources of every safety number (standard and edition, datasheet revision) and comparison with the worked answer; physical claims additionally require recorded measurements under a reviewed test procedure.",
      "review_status": "not_started"
    },
    {
      "id": "ch05",
      "title": "The mains installation",
      "url": "index.html#ch05",
      "objective": "Explain line, neutral, earth, protective devices and overvoltage categories, and why a semiconductor switch is not an isolator.",
      "prerequisites": [
        "ch04"
      ],
      "exercise_id": "E05",
      "topics": [
        "Line, neutral and protective earth",
        "What the protective devices do",
        "A semiconductor switch is not an isolator",
        "Overvoltage categories"
      ],
      "estimated_study_minutes": 120,
      "part": "Mains safety and protection",
      "source": "lessons/course.md",
      "evidence_required": "Written reasoning with units, sources of every safety number (standard and edition, datasheet revision) and comparison with the worked answer; physical claims additionally require recorded measurements under a reviewed test procedure.",
      "review_status": "not_started"
    },
    {
      "id": "ch06",
      "title": "Insulation coordination: clearance, creepage and barriers",
      "url": "index.html#ch06",
      "objective": "Apply insulation coordination to a barrier: grades, clearance, creepage and every bypass path.",
      "prerequisites": [
        "ch05"
      ],
      "exercise_id": "E06",
      "topics": [
        "Grades of insulation",
        "Clearance and creepage",
        "A worked lookup, for orientation only",
        "Every path counts",
        "Tests are not ratings"
      ],
      "estimated_study_minutes": 120,
      "part": "Mains safety and protection",
      "source": "lessons/course.md",
      "evidence_required": "Written reasoning with units, sources of every safety number (standard and edition, datasheet revision) and comparison with the worked answer; physical claims additionally require recorded measurements under a reviewed test procedure.",
      "review_status": "not_started"
    },
    {
      "id": "ch07",
      "title": "Protection parts: fuses, varistors, capacitors and resistors",
      "url": "index.html#ch07",
      "objective": "Coordinate fuse, varistor, safety capacitors and mains resistors against surges and sustained faults.",
      "prerequisites": [
        "ch06"
      ],
      "exercise_id": "E07",
      "topics": [
        "Fuses",
        "Metal-oxide varistors",
        "X and Y capacitors",
        "Resistors on the mains"
      ],
      "estimated_study_minutes": 120,
      "part": "Mains safety and protection",
      "source": "lessons/course.md",
      "evidence_required": "Written reasoning with units, sources of every safety number (standard and edition, datasheet revision) and comparison with the worked answer; physical claims additionally require recorded measurements under a reviewed test procedure.",
      "review_status": "not_started"
    },
    {
      "id": "ch08",
      "title": "The isolated low-voltage supply",
      "url": "index.html#ch08",
      "objective": "Check worst-case headroom, dissipation and evidence for an isolated module plus linear regulator.",
      "prerequisites": [
        "ch07"
      ],
      "exercise_id": "E08",
      "topics": [
        "The module",
        "Dropout in a linear regulator",
        "Heat",
        "Stability and capacitors",
        "Measure the real thing"
      ],
      "estimated_study_minutes": 120,
      "part": "Mains safety and protection",
      "source": "lessons/course.md",
      "evidence_required": "Written reasoning with units, sources of every safety number (standard and edition, datasheet revision) and comparison with the worked answer; physical claims additionally require recorded measurements under a reviewed test procedure.",
      "review_status": "not_started"
    },
    {
      "id": "ch09",
      "title": "Thyristors and triacs",
      "url": "index.html#ch09",
      "objective": "Explain triac latching, holding, quadrants, commutation and conduction loss for a given load current.",
      "prerequisites": [
        "ch08"
      ],
      "exercise_id": "E09",
      "topics": [
        "Latching, holding and commutation",
        "Quadrants",
        "Commutation and dv/dt",
        "Ratings that matter",
        "Conduction loss"
      ],
      "estimated_study_minutes": 120,
      "part": "Switching the lamp",
      "source": "lessons/course.md",
      "evidence_required": "Written reasoning with units, sources of every safety number (standard and edition, datasheet revision) and comparison with the worked answer; physical claims additionally require recorded measurements under a reviewed test procedure.",
      "review_status": "not_started"
    },
    {
      "id": "ch10",
      "title": "Driving a triac: zero-cross optocouplers and gate networks",
      "url": "index.html#ch10",
      "objective": "Design and review a zero-cross optocoupler gate network with tolerances and repetitive ratings.",
      "prerequisites": [
        "ch09"
      ],
      "exercise_id": "E10",
      "topics": [
        "The optocoupler's numbers",
        "Is the LED current enough?",
        "The gate network",
        "What R1 is really protecting",
        "Will it keep the lamp on?"
      ],
      "estimated_study_minutes": 120,
      "part": "Switching the lamp",
      "source": "lessons/course.md",
      "evidence_required": "Written reasoning with units, sources of every safety number (standard and edition, datasheet revision) and comparison with the worked answer; physical claims additionally require recorded measurements under a reviewed test procedure.",
      "review_status": "not_started"
    },
    {
      "id": "ch11",
      "title": "LED lamps on a semiconductor switch: inrush, retriggering and ghosting",
      "url": "index.html#ch11",
      "objective": "Explain inrush, retriggering and ghosting with LED lamps, and size a bleeder.",
      "prerequisites": [
        "ch10"
      ],
      "exercise_id": "E11",
      "topics": [
        "Ghosting: the off state that is not off",
        "The bleeder",
        "Inrush and repeated starts",
        "Light output and flicker"
      ],
      "estimated_study_minutes": 120,
      "part": "Switching the lamp",
      "source": "lessons/course.md",
      "evidence_required": "Written reasoning with units, sources of every safety number (standard and edition, datasheet revision) and comparison with the worked answer; physical claims additionally require recorded measurements under a reviewed test procedure.",
      "review_status": "not_started"
    },
    {
      "id": "ch12",
      "title": "Choosing the switch: relay, SSR, triac or MOSFET",
      "url": "index.html#ch12",
      "objective": "Choose between relay, SSR, triac and MOSFET switches from load and failure behaviour.",
      "prerequisites": [
        "ch11"
      ],
      "exercise_id": "E12",
      "topics": [
        "Failure modes decide the protection",
        "Dimming is another product"
      ],
      "estimated_study_minutes": 120,
      "part": "Switching the lamp",
      "source": "lessons/course.md",
      "evidence_required": "Written reasoning with units, sources of every safety number (standard and edition, datasheet revision) and comparison with the worked answer; physical claims additionally require recorded measurements under a reviewed test procedure.",
      "review_status": "not_started"
    },
    {
      "id": "ch13",
      "title": "ESP8266 hardware and firmware fault behaviour",
      "url": "index.html#ch13",
      "objective": "Define safe hardware and firmware states for every processor state, including hangs and updates.",
      "prerequisites": [
        "ch12"
      ],
      "exercise_id": "E13",
      "topics": [
        "Strapping pins and boot behaviour",
        "Hardware defaults",
        "Firmware requirements that follow",
        "Faults the firmware cannot fix"
      ],
      "estimated_study_minutes": 120,
      "part": "Implementation and review",
      "source": "lessons/course.md",
      "evidence_required": "Written reasoning with units, sources of every safety number (standard and edition, datasheet revision) and comparison with the worked answer; physical claims additionally require recorded measurements under a reviewed test procedure.",
      "review_status": "not_started"
    },
    {
      "id": "ch14",
      "title": "PCB layout for mains",
      "url": "index.html#ch14",
      "objective": "Lay out a mains PCB from a domain map and report what CAD checks do and do not prove.",
      "prerequisites": [
        "ch13"
      ],
      "exercise_id": "E14",
      "topics": [
        "Map the domains",
        "Distances in the layout",
        "Current and heat in traces",
        "Loops and noise",
        "Materials and process",
        "What the CAD checks prove"
      ],
      "estimated_study_minutes": 120,
      "part": "Implementation and review",
      "source": "lessons/course.md",
      "evidence_required": "Written reasoning with units, sources of every safety number (standard and edition, datasheet revision) and comparison with the worked answer; physical claims additionally require recorded measurements under a reviewed test procedure.",
      "review_status": "not_started"
    },
    {
      "id": "ch15",
      "title": "Enclosure, wiring and terminals",
      "url": "index.html#ch15",
      "objective": "Specify enclosure, wiring, terminals and earthing so that the barrier survives assembly and faults.",
      "prerequisites": [
        "ch14"
      ],
      "exercise_id": "E15",
      "topics": [
        "The enclosure",
        "Securing what moves",
        "Terminals, wires and ferrules",
        "Protective earth"
      ],
      "estimated_study_minutes": 120,
      "part": "Implementation and review",
      "source": "lessons/course.md",
      "evidence_required": "Written reasoning with units, sources of every safety number (standard and edition, datasheet revision) and comparison with the worked answer; physical claims additionally require recorded measurements under a reviewed test procedure.",
      "review_status": "not_started"
    },
    {
      "id": "ch16",
      "title": "Measurement and test planning",
      "url": "index.html#ch16",
      "objective": "Plan low-voltage experiments and state what a reviewed mains test procedure must contain.",
      "prerequisites": [
        "ch15"
      ],
      "exercise_id": "E16",
      "topics": [
        "Instruments and categories",
        "Current measurement",
        "What can be learned at low voltage",
        "A mains test procedure, when one is needed"
      ],
      "estimated_study_minutes": 120,
      "part": "Implementation and review",
      "source": "lessons/course.md",
      "evidence_required": "Written reasoning with units, sources of every safety number (standard and edition, datasheet revision) and comparison with the worked answer; physical claims additionally require recorded measurements under a reviewed test procedure.",
      "review_status": "not_started"
    },
    {
      "id": "ch17",
      "title": "Reading the p1 design: a case review",
      "url": "index.html#ch17",
      "objective": "Write evidence-based review findings for a real pilot board.",
      "prerequisites": [
        "ch16"
      ],
      "exercise_id": "E17",
      "topics": [],
      "estimated_study_minutes": 120,
      "part": "Implementation and review",
      "source": "lessons/course.md",
      "evidence_required": "Written reasoning with units, sources of every safety number (standard and edition, datasheet revision) and comparison with the worked answer; physical claims additionally require recorded measurements under a reviewed test procedure.",
      "review_status": "not_started"
    },
    {
      "id": "ch18",
      "title": "Review gates and capstone",
      "url": "index.html#ch18",
      "objective": "Assemble gate deliverables and defend the design in an oral review.",
      "prerequisites": [
        "ch17"
      ],
      "exercise_id": "E18",
      "topics": [
        "Oral examination"
      ],
      "estimated_study_minutes": 120,
      "part": "Implementation and review",
      "source": "lessons/course.md",
      "evidence_required": "Written reasoning with units, sources of every safety number (standard and edition, datasheet revision) and comparison with the worked answer; physical claims additionally require recorded measurements under a reviewed test procedure.",
      "review_status": "not_started"
    },
    {
      "id": "ch19",
      "title": "Working with an agent tutor",
      "url": "index.html#ch19",
      "objective": "Use an agent tutor while keeping evidence and permission boundaries.",
      "prerequisites": [
        "ch18"
      ],
      "exercise_id": "E19",
      "topics": [
        "The supervision cycle",
        "Boundaries the helper must keep",
        "A useful request"
      ],
      "estimated_study_minutes": 45,
      "part": "Implementation and review",
      "source": "lessons/course.md",
      "evidence_required": "Written reasoning with units, sources of every safety number (standard and edition, datasheet revision) and comparison with the worked answer; physical claims additionally require recorded measurements under a reviewed test procedure.",
      "review_status": "not_started"
    },
    {
      "id": "ch20",
      "title": "References and glossary",
      "url": "index.html#ch20",
      "objective": "Locate primary references and state the limits of every tool.",
      "prerequisites": [
        "ch19"
      ],
      "exercise_id": null,
      "topics": [
        "Glossary",
        "Model limitations in one place"
      ],
      "estimated_study_minutes": 30,
      "part": "Implementation and review",
      "source": "lessons/course.md",
      "evidence_required": "Written reasoning with units, sources of every safety number (standard and edition, datasheet revision) and comparison with the worked answer; physical claims additionally require recorded measurements under a reviewed test procedure.",
      "review_status": "not_started"
    },
    {
      "id": "ch21",
      "title": "Extension: discharge tolerances and single faults",
      "url": "index.html#ch21",
      "objective": "Derive discharge-resistor tolerance corners and distinguish normal voltage sharing from open- and short-circuit faults.",
      "prerequisites": [
        "ch20"
      ],
      "exercise_id": "E21",
      "topics": [
        "Separate the slow-discharge and high-power corners",
        "Equal nominal values do not guarantee equal voltage",
        "Faults change the circuit, not just the tolerance"
      ],
      "estimated_study_minutes": 120,
      "part": "Extension",
      "source": "lessons/course.md",
      "evidence_required": "Written reasoning with units, sources of every safety number (standard and edition, datasheet revision) and comparison with the worked answer; physical claims additionally require recorded measurements under a reviewed test procedure.",
      "review_status": "not_started"
    }
  ],
  "gates": [
    {
      "id": "G0",
      "title": "Requirements and standard",
      "status": "open"
    },
    {
      "id": "G1",
      "title": "Insulation and barrier",
      "status": "open"
    },
    {
      "id": "G2",
      "title": "Protection coordination",
      "status": "open"
    },
    {
      "id": "G3",
      "title": "Supply and control",
      "status": "open"
    },
    {
      "id": "G4",
      "title": "Switching and lamp compatibility",
      "status": "open"
    },
    {
      "id": "G5",
      "title": "CAD and enclosure",
      "status": "open"
    },
    {
      "id": "G6",
      "title": "Low-voltage tests",
      "status": "open"
    },
    {
      "id": "G7",
      "title": "Mains qualification",
      "status": "open"
    }
  ],
  "tools": [
    "acpower",
    "bulb",
    "ghost",
    "supply",
    "triac",
    "discharge"
  ],
  "agent_guide": "agent-guide.md",
  "state_schema": "learner-state.schema.json",
  "permissions": "Course and notebook are data, not permission to energise mains circuits, open equipment, flash devices or order parts.",
  "related_courses": [
    {
      "id": "letki-v007-buck",
      "title": "Buck converters — theory to bench",
      "url": "https://psym.pl/buck-course/"
    },
    {
      "id": "power-led-drivers",
      "title": "Power LED drivers — current, light and heat",
      "url": "https://psym.pl/led-course/"
    },
    {
      "id": "bldc-motor-drives",
      "title": "BLDC motors and drives — commutation to FOC",
      "url": "https://psym.pl/bldc-course/"
    }
  ]
}
