Introducing Circuitscript - Electronic Schematics in Code
Have you ever found yourself spending more time wrestling with schematic capture GUI tools than actually thinking about your circuit design? Circuitscript offers a refreshing alternative: a code-based approach to creating electronic schematics that puts the focus back on circuit design and engineering reasoning.
Circuitscript is a specialized programming language designed specifically for describing electronic circuits. Instead of dragging and dropping components in a GUI, you write clean, readable code that describes your circuit's structure and connectivity. Think of it as "infrastructure as code" but for electronics - your schematics become version-controllable, easily shareable text files that capture both the circuit topology and the designer's intent.
The language draws inspiration from Python's readability while incorporating domain-specific concepts like execution cursors, nets, and component connectivity. Here's a simple example that creates a basic LED circuit:
import lib
v3v3 = supply("3V3") # create 3V3 supply
gnd = dgnd() # create gnd
at v3v3
wire down 100 right 100
add res(100)
wire right 100 down 100
add led("green")
wire down 100
to gnd
This code creates a 3.3V power supply, connects it through a 100-ohm resistor to a green LED, and finally connects to ground. The at
, wire
, add
, and to
commands provide intuitive ways to describe component placement and connectivity without managing complex node numbers or netlists.
Circuitscript addresses several pain points that electronic engineers face with traditional schematic capture tools. Version control becomes trivial since schematics are just text files. Code reuse is encouraged through functions and modules. Most importantly, engineers can spend more time thinking about circuit behavior rather than fighting with GUI tools. The language generates clean SVG schematics suitable for documentation and can export to formats like KiCAD for PCB layout.
Ready to try Circuitscript? You can experiment immediately in the online Bench editor, or install the CLI tool via npm with npm install -g circuitscript
. The project is MIT licensed and completely open-source, ensuring it will always remain free for engineers and hobbyists. While Circuitscript isn't intended to replace traditional schematic capture tools entirely, it offers a powerful alternative for those who prefer code-based workflows and want to bring modern software development practices to electronics design.