How to Create Custom Components — Subcircuits and Custom Logic Chips
You can build your own components in FreeCircuitSim in two ways: package any working circuit as a reusable subcircuit (a "black box" chip with pins you choose), or define a custom logic chip from a simple truth-table definition. Both are built into the simulator — no code, download or account needed.
Two Ways to Make Your Own Component
On a small screen, swipe the table sideways to see all columns.
| Subcircuit | Custom logic chip | |
|---|---|---|
| What it is | Any circuit you built, packaged as one block with labelled pins | A digital chip whose behaviour you write as input → output patterns |
| Works with | Analog and digital parts — resistors, diodes, transistors, op-amps, gates, other subcircuits | Digital signals only (logic HIGH / LOW, plus high-impedance) |
| Best for | Rectifier bridges, amplifier stages, filters, adders built from gates | Decoders, counters, flip-flops, comparators, any truth table |
| Where to find it | File → Create Subcircuit... | Right-click → Digital Chips → Add Custom Logic |
Part 1 — Create a Subcircuit
A subcircuit turns a group of components into a single reusable block. The pins of the block come from labeled nodes you place on the circuit before you package it.
→ Open a bridge rectifier ready to packageBuild and test the circuit
Draw the circuit you want to reuse and run it once to check it behaves the way you expect. It is much easier to fix a problem now than after it is packaged.
Mark every input and output with a labeled node
Right-click the canvas and choose Outputs and Labels → Add Labeled Node. Attach one to each point that should become a pin, and give it a short name such as in+, out or EN. Each labeled node becomes one pin of your new component.
Choose File → Create Subcircuit...
A symbol editor opens showing your pins. Drag the pins to the sides where you want them, type a model name (for example bridge), and click OK. If you selected part of the circuit before choosing this menu item, only the selected parts are packaged.
Place your new component
Right-click and choose Active Building Blocks → Add Subcircuit Instance, then click and drag on the canvas. Double-click the block to choose which model it uses (it defaults to the one you just made) or to edit its pin layout. You can place as many copies as you like.
Save or share it
The subcircuit model is stored inside the circuit itself. Use File → Save As... to keep a file, or File → Export As Link... to share a URL — anyone who opens it gets your custom component too.
See finished examples from the simulator's own library:
▶ Full-wave rectifier as a subcircuit ▶ 4-bit adder built from nested subcircuitsIn both examples, double-click a block and press View Components to look inside it.
Make the pins look like a real chip
The name of a labeled node changes how its pin is drawn on the symbol. These prefixes are purely cosmetic — they do not change the signal:
CLK— draws a clock marker and hides the textCLK:prefix (e.g.CLK:C1) — clock marker plus the text after the prefixINV:prefix (e.g.INV:EN) — inversion circle on the pin/prefix (e.g./EN) — a bar over the text, the usual "active-low" notation
Part 2 — Create a Custom Logic Chip
A custom logic chip lets you describe a digital device with text instead of wiring it from gates. Right-click and choose Digital Chips → Add Custom Logic, place it, then double-click it to edit its model. You fill in five fields:
- Model Name — every chip with the same model name behaves the same way, so editing the model changes all of them
- Inputs and Outputs — comma-separated pin labels of one or two characters, such as
A,B,C. A leading slash marks an inverted pin, such as/Q - Info Text — shown in the corner when you hover over the chip
- Definition — one rule per line, written as
input pattern = output pattern
How the definition works
The simulator checks the rules from the top and uses the first one whose left side matches the current inputs. The pattern characters are:
0/1— logic LOW / HIGH+/-— a rising / falling transition (used for clock inputs)?— don't careA,B… — pattern letters that copy a matched value to the output_(outputs only) — high-impedance, for tri-state outputs
If the left side is longer than the number of inputs, the extra characters are matched against the chip's current outputs. That is how you give a chip memory. Spaces are ignored, so you can use them to separate inputs from outputs.
Example 1: 3-input NAND gate
Inputs: A,B,C
Outputs: X
Definition: 111=0
???=1
If all three inputs are HIGH the output is LOW; any other combination falls through to the second rule and gives HIGH.
Example 2: Full adder
Inputs: A,B,C
Outputs: S,C
Definition: 111=11
110=10
011=10
101=10
100=01
010=01
001=01
000=00
The two output digits are the sum S and carry C — this is simply the full-adder truth table written one row per line.
Example 3: D flip-flop (a chip with memory)
Inputs: D,Clk
Outputs: Q,/Q
Definition: ?? 00=10
0+ ??=01
1+ ??=10
?? AB=AB
The first two characters match D and Clk; the last two match the current outputs. Line 1 sets a valid starting state when the circuit resets. Lines 2 and 3 copy D to Q on a rising clock edge. Line 4 keeps the outputs unchanged at all other times.
Subcircuit or Custom Logic — Which Should You Use?
- Use a subcircuit when the component contains analog parts, or when you want to see the real internals (for teaching, this is usually better).
- Use custom logic when you only care about the digital behaviour — it is faster to write and simulates faster than dozens of individual gates.
- You can combine them: a subcircuit can contain custom logic chips and other subcircuits.
What You Cannot Build
FreeCircuitSim simulates circuits, not code. There is no microcontroller or Arduino component, so you cannot run a sketch, and there is no stepper motor. The simulator does include a DC motor and a 3-phase motor (right-click → Outputs and Labels), so you can still design and test the driver side — transistor switches, relays and H-bridges. If you need to run Arduino code, a code-focused simulator such as Wokwi or Tinkercad Circuits is the better tool; you can then use FreeCircuitSim to check the analog parts of the design.
Common Mistakes
No labeled nodes
Create Subcircuit needs labeled nodes to know where the pins are. Without them the block has no connections.
Unwanted extra pins
Every labeled node becomes a pin unless you tick Internal Node on the ones used only inside the circuit.
Rules in the wrong order
Custom logic uses the first matching rule. Put specific rules first and catch-all rules like ???=1 last.
No reset rule for memory
Chips with state should start with a rule such as ?? 00=10 so the outputs begin in a valid state after a reset.