Skip to the content
2 layersBlinky, the printed circuit board in 3D

Fang language, DesignGraph kernel, units, interfaces, constraints, transactions and serialization

Copper layers
2
Thickness
1.6 mm
Parts
5
Nets
9
Pads
16
Tracks, vias
0, 0
Routed
Not yet
KiCad
KiCad 0.15.8 (file 20241229)
Created
8 Sep 2026
Updated
3 Oct 2026

Overview

Blinky is an open-source printed circuit board by copperheadhq, from the copperheadhq/fang repository on GitHub, published under the Apache-2.0 licence. It is a 2-layer board with 5 parts on 9 nets.

Its parts include 1 capacitor, 1 resistor, 1 IC and 1 connector.

README

README.md
fang

Hardware as Code. The language and kernel under copperhead.

A code-defined electronics toolchain: a Python-embedded language for authoring hardware, a typed kernel that holds the design and compilers that lower it into netlists, views, simulation decks and CAD.

python
from fang.interfaces import I2CPort, Pin, PinMap
from fang.lang import Part, System, V, kOhm, require
from fang.parts import Regulator


class MCU(Part):
    i2c = I2CPort(voh_min=2.4 * V, voltage=3.3 * V, pull_up_resistance=4.7 * kOhm)
    PB8 = Pin("PB8", role="clock")
    PB6 = Pin("PB6", role="clock")      # two candidates: choosing is a decision
    PB9 = Pin("PB9", role="data")
    PB7 = Pin("PB7", role="data")
    pinmap = PinMap({"i2c.scl": ["PB8", "PB6"], "i2c.sda": ["PB9", "PB7"]})


class IMU(Part):
    i2c = I2CPort(vih_min=2.0 * V, voltage=3.3 * V)
    SCL = Pin("SCL", role="clock")
    SDA = Pin("SDA", role="data")
    pinmap = PinMap({"i2c.scl": "SCL", "i2c.sda": "SDA"})


class SensorBoard(System):
    regulator = Regulator(output_voltage=3.3 * V, package="SOT-23-5")
    mcu = MCU(package="LQFP-64")

The full version is examples/sensor_board/.

bash
fang build   board.py     # elaborate, gate, persist, run the plan
fang check   board.py     # constraints, topology, interface compatibility
fang netlist board.py     # components and nets
fang export  board.py -o board.net   # a KiCad netlist
fang view    board.py ground -o ground.svg
fang sim     board.py --analysis transient --probe "V(1)"
fang verify  board.py     # answer every declared question; --commit persists
fang emulate board.py     # run the board's firmware in Renode
fang mcp     board.py     # serve the agent surface over stdio

What it does

StageCapability
KernelEntity model, stable identity, units, values, constraints, transactions, the commit gate, canonical serialization, semantic diff, topology intent
LanguageModule, System, Part, parameters with units, traits, require(), the connect operator, deterministic sandboxed elaboration
InterfacesA catalogue of 21 typed interfaces, ports, buses, deterministic pin lowering, compatibility checks
PartsDesignators, packages, footprints, sourcing and a standard library of generic parts
NetlistNet inference, designator assignment, KiCad netlist emission
CADKiCad s-expression reading, project import, the mapping table, loss reporting, one safe round trip
Tool planHandles as symbolic conditions, the tool contract, the operation phase, realizations
ViewsSix required views, the layout boundary, SVG rendering, placement seeds
SimulationModels as traits, explicit plans, SPICE lowering, the ngspice backend, normalized results
EmulationCompiled firmware run against the board in Renode: plans resolved from the graph, probes, measures over events, answers through the gate
RationaleRequirements, assumptions, decisions, evidence, calculations, the verification graph, impact propagation
VerificationQuestions declared beside requirements, explicit benches and measures, routing to the cheapest level, measurements re-entering through the gate; ngspice, Xyce, KiCad ERC and Touchstone
CLIThe .copperhead/ workspace, the manifest and the commands above

The specification

The contract is one document: openspec/specs/fang-kernel/spec.md. It is self-contained and normative. It covers the terminology, the design principles, the layers of representation, the kernel architecture and the project root. Then come 111 requirements over 373 scenarios, spanning the Engineering Intermediate Representation (identity, quantities, constraints, provenance, serialization, diff) and the kernel and language over it, with all 26 acceptance criteria. RFC 2119 keywords in it are normative.

Delivery is staged in openspec/ROADMAP.md and managed with OpenSpec.

The package

text
fang/
  units.py          dimensions, unit algebra, decimal quantities
  values.py         value status, explicit unknowns, conflicting candidates
  identity.py       canonical semantic paths, UUIDv5 derivation, transliteration
  entities.py       the EIR entity model and the project root
  provenance.py     append-only provenance records
  constraints.py    the single registry, typed expressions, three-valued logic
  topology.py       topology intent and conductive-path enumeration
  serialization.py  canonical JSON and the canonical record stream
  validation.py     structural validation and the requirement state machine
  graph.py          snapshots, transactions, the proposal sandbox, the commit gate
  diff.py           semantic diff classification
  queries.py        rationale queries and on-demand graph analysis
  diagnostics.py    namespaced diagnostic codes and the code registry
  lang.py           the authoring surface
  sandbox.py        enforced network denial and declared, hashed inputs
  elaborate.py      program to snapshot and tool plan
  interfaces.py     the interface catalogue and the pin model
  lowering.py       deterministic interface-to-pin lowering
  compatibility.py  interface compatibility checking
  parts.py          the standard part library
  netlist.py        net inference and the netlist IR
  kicad.py          KiCad emission and import
  sexpr.py          the s-expression reader

Install

bash
pip install copperhead-fang               # the toolchain and the `fang` command
pip install "copperhead-fang[analysis]"   # add NetworkX for the graph queries
pip install "copperhead-fang[mcp]"        # add the agent surface, `fang mcp`

The distribution is named copperhead-fang. The import name is fang.

To work on it:

bash
git clone https://github.com/copperheadhq/fang
cd fang
pip install -e ".[dev,analysis,mcp]"
python -m pytest

Pure Python 3.11+, and the core install has no dependencies at all. Everything else is optional and none of it is required: NetworkX, an extra used for graph analysis; the MCP SDK, the extra behind fang mcp; and five external tools reached across a process boundary: ngspice and Xyce, which simulate, kicad-cli, which renders schematics and checks their electrical rules, copperhead, which drafts a placed and wired schematic, and Renode, which runs a board's firmware. When any of them is absent the toolchain says so rather than substituting anything.

Invariants the tests hold

  • One canonical model. No second persisted representation of the same facts.
  • Determinism. Identical inputs give byte-identical snapshots, verified across processes with differing hash seeds.
  • Explicit unknowns. null never means "unknown", and an unknown operand makes a check undecided rather than passing.
  • Undecided is a third truth value. Never silently a pass and never silently a failure. Whether it blocks is the gate's decision.
  • Transactional mutation. Every path, whether program, human, agent or import, passes the same gate, differing only in recorded provenance.
  • Dimensional rejection at write time. A dimensionally invalid expression cannot be stored, let alone evaluated.
  • Nothing invented. A missing model, an absent simulator, an unmodelled CAD construct and an uncited claim are each reported as what they are.

Tests

bash
python -m pytest          # 1639 tests; those needing a binary skip by name
python -m pytest -rs      # names each environment-dependent skip

The suite includes one test per acceptance criterion (AT-R1 to AT-R13, AT-K1 to AT-K10, AT-V1, AT-F1 and AT-F2). All 26 pass; AT-V1 runs a circuit simulation and needs ngspice, and AT-F1 and AT-F2 run firmware and need Renode 1.17.0. The only skips name what is missing: the NetworkX and MCP extras, and the ngspice, Xyce, kicad-cli, copperhead and Renode binaries. The examples that ship a KiCad schematic need kicad-cli to rebuild, and the ones with questions compare their verification.txt only where the tools those questions route to are installed.

Examples

Each example is a folder: the program, a document explaining it and the files fang produces from it under out/: the KiCad netlist, the check and graph listings, the views and the rationale where there is any. Each one builds, checks and exports. The suite rebuilds the committed outputs and compares them in tests/test_examples.py.

  • examples/divider/: a voltage divider with a filter cap
  • examples/rc_filter/: an RC low-pass whose corner is a question: ngspice answers it, the number enters through the gate, and asked again it is answered at the equation level
  • examples/antenna_match/: a chip antenna's Touchstone model through an L match, its return loss composed in closed form
  • examples/blinky/: an MCU pin, a resistor and an LED, showing the shape of a program with nothing else in the way
  • examples/equations/: a divider written as the ratio it must satisfy, reused by inheritance with different values
  • examples/i2c_bus/: one controller and three targets on a multi-drop bus, with address uniqueness as a constraint and one device whose thresholds are an assumption rather than a number
  • examples/sensor_board/: a regulated board with an MCU and an I2C sensor, showing pin lowering and recorded decisions
  • examples/sensor_node/: an STM32F401RE and an HS3001, with ports that name their controller, alternate functions cited from ST's table on the lowered pins, the sensor's address read by the check, and its firmware run in Renode against the board, two requirements decided by the run through the commit gate
  • examples/usb_uart_bridge/: USB to serial, with chosen vendor parts, a crystal and a UART crossover named wire by wire
  • examples/buck_regulator/: 12 V to 3.3 V, with the requirement, the part decision, the datasheet citations and the two calculations in the same graph as the inductor, and a question ngspice answers under full load
  • examples/servo_drive/: three half-bridges, CAN and a quadrature encoder, from one block declaration instantiated three times
  • examples/jee_advanced/: two exam questions rather than two boards, each answered by constraints the checker decides: one paper's four claimed currents, and one claimed current beside the two branches that carry none
  • examples/noninverting_amp/: a textbook figure's input impedance and gain, with the reading of the drawing they rest on recorded as a decision
  • examples/imported/: a KiCad netlist the import path reads
  • examples/parity/: the divider and blinky built again in atopile, so the two toolchains' components and nets can be asserted equal

Brand

fang is a sub-brand of copperhead rather than a separate identity, and the name is literal: copperhead is the snake, fang is the fang. The mark is a trace with a fang hanging from it, drawn on the same 32-unit grid and in the same copper as copperhead's via mark. The wordmark is lowercase, always, and set in IBM Plex Mono because it names a language.

site/BRAND.md is the identity in full: the mark's geometry and clear space, the palette in both themes with the two values nudged for contrast and the reason recorded, the type and the voice. The assets are in site/brand/, and the page they dress is fang.copperhead.sh.

License

Licensed under the Apache License, Version 2.0.

Parts

5
QtyValueFootprintReferences
1parts:SOIC8U1
1parts:PinHeader_1x02J1
1parts:R0603R1
1parts:C0402C1
1parts:LED0603DS1

More from copperheadhq/fang

1
  • 2 layersDivider, the printed circuit board in 3D

    Divider

    copperheadhq/fang

    Fang language, DesignGraph kernel, units, interfaces, constraints, transactions and serialization

    3 parts5Apache-2.0

Similar boards

  • 2 layers98 × 27 mmXy limit, the printed circuit board in 3D

    Xy limit

    opulo-inc/lumenpnp

    The LumenPnP is an open source pick and place machine.

    5 parts3.7k
  • 2 layers21 × 33 mm24g2usb pico2w, the printed circuit board in 3D

    24g2usb pico2w

    joypad-ai/joypad-os

    Universal controller firmware for building adapters, dongles, and custom controllers.

    5 parts1.7kApache-2.0
  • 2 layers53.2 × 59.6 mmA10 OLinuXino Lime Rev B SHIELD TEMPLATE, the printed circuit board in 3D

    A10 OLinuXino Lime Rev B SHIELD TEMPLATE

    OLIMEX/OLINUXINO

    OLINUXINO is Open Source / Open Hardware, low cost from EUR 24 Linux Industrial grade Single Board Computer capable to operate -25+85C

    5 parts1.5k
  • 2 layers30 × 11 mmMain control board servo tester, the printed circuit board in 3D

    Main control board servo tester

    jamro/tiny-engineer

    A small desktop robot that brings an AI coding assistant to life, physically acting out when it reads files, thinks, writes code, and finishes work.

    5 parts1.1k
  • 2 layers78.8 × 35.3 mmKiCadTest, the printed circuit board in 3D

    KiCadTest

    hackclub/OnBoard

    💡 Join 1,000 teenagers and make your first PCB with a $100 grant!

    5 parts915
  • 2 layers50 × 23 mmMiniCircuits LTCC, the printed circuit board in 3D

    MiniCircuits LTCC

    VanceVagell/kv4p-ht

    Open source handheld ham radio project KV4P-HT

    5 parts828GPL-3.0
  • 2 layers20.3 × 15.2 mmL0 light sensor, the printed circuit board in 3D

    L0 light sensor

    Luos-io/luos_engine

    Open-source and real-time orchestrator for cyber-physical-systems, to easily design, test and deploy embedded applications and digital twins.

    5 parts546MIT

Questions

What parts does the Blinky use?

5 parts. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the Blinky KiCad files?

From the copperheadhq/fang repository on GitHub, at the commit this page was made from: the board is examples/parity/elec/layout/blinky/blinky.kicad_pcb and its schematic examples/jee_advanced/problem_1/figure/problem_1.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Blinky design in my own project?

Its repository publishes it under the Apache-2.0 licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).