← PS-1 · FROM CIRCUIT TO SPEC

Why series resistors — the rules engine

YOU WILL BE ABLE TO
  • Connect the LED rule to the diode physics of ME-1 and size a series resistor.
  • Distinguish rules the validator checks from guarantees the generator builds in.
  • Read the engine's rules list with its enforcement status and explain how a rule is satisfied by validation, by construction, or by the hardware itself.
  • Explain why one shared list of required fields beats two hand-maintained copies.

"every LED must have a series resistor between GPIO and anode". That is the first design rule in the engine's own list, and it is ME-1 physics wearing work clothes: a diode conducting forward is nearly a short — current grows exponentially with voltage — so something must limit it. At 3.3 V, a red LED dropping about 2 V leaves 1.3 V across the resistor; with 330 ohm, I=1.3/330≈4 mAI = 1.3/330 \approx 4\,\text{mA} — bright enough, and inside the pin's DEFAULT drive strength of 4 mA (configurable up to 12 mA). The rule is not bureaucracy; it is the reason the pin survives.

The engine enforces its rules two different ways, and the difference matters. Some rules are VALIDATED: the spec is checked, and a violation is a red message before anything is built — analog pins (V8), unique GPIOs (V5), required fields (V7). Others are guaranteed BY CONSTRUCTION: you cannot violate them because the generator does the wiring itself — it places the series resistor, wires the button to ground, joins the rails. The spec declares series_resistor: "330ohm"; the validator requires the field (V7); the generator builds the resistor. Declaration checked, construction guaranteed.

Since the rules are data, the engine reports HOW each is enforced — ask /api/parts and each rule carries an enforcedBy tag: V-numbers for validated clauses, "construction" for generated guarantees. When this track was written, one rule was stated but NOT enforced — the servo-header rule about VCC, GND, and PWM-capable pins — and the engine said so in its own tag: a servo header with no rails at all passed clean. It is enforced now, and its tag reads V3+construction: the required-signals check (V3) covers the rails, and the PWM clause needs no check at all, because every GPIO on this MCU can generate PWM — no pin choice can break it. A rule can be satisfied by validation, by construction, or by the hardware itself. A stated rule and an enforced rule are still different things; good engineering labels which is which — and the label changed the day the check arrived.

WORKED EXAMPLE

Rule audit

  1. For each event, name the enforcement class.
  2. (a) You omit series_resistor: VALIDATED — a V7 message, red, before anything is built.
  3. (b) The resistor appears in the schematic wired GPIO-to-anode: CONSTRUCTION — the generator drew it; no spec could have left it out.
  4. (c) A servo header with no VCC: VALIDATED now — the V3 message "J2: header_1x3 requires pins.VCC". It once passed silently: the same spec, the same rule, and a check that did not exist yet.
  5. (d) Two parts share GP20: VALIDATED — V5.
Where you see each: a red message (validated), the generated schematic (construction), or nowhere at all — a hardware-satisfied clause has nothing to violate.

PRACTICE

Q1

With a 3.3 V pin, a 2.0 V LED drop, and 150 ohm: what current flows? Is it safe?

Q2

Name one rule per enforcement class from the engine's list.

Q3

Why is "the generator would ignore it anyway" NOT a reason to drop pull and wiring from a button's spec?

Q4

What breaks, eventually, when the validator keeps its own copy of the required-fields table?

Why series resistors — the rules engine · PS-1 · iLearnSTEM Electronics