Open-source electronic circuit simulator — analog, digital, and mixed-signal.
OhmPy is a schematic-capture and simulation environment built with Python + PyQt6. Its custom MNA (Modified Nodal Analysis) engine solves DC, AC, and transient analyses from the same netlist, with virtual instruments (a multimeter, two-channel oscilloscope, and function generator) integrated into the canvas.
- DC analysis — linear and nonlinear (Newton–Raphson), with source stepping for circuits containing diodes, LEDs, BJTs, MOSFETs, and op-amps.
- AC analysis — frequency sweeps with cached LU factorization at each frequency point.
- Transient analysis — adaptive time steps with LTE error control for linear and nonlinear analog circuits.
- Digital engine — event-driven binary simulation with propagation delays.
- Mixed signal — internal bridges couple shared analog and digital nodes during co-simulation.
| Category | Components |
|---|---|
| Passive | Resistor, potentiometer, capacitor, inductor, generic impedance |
| Sources | DC voltage, AC voltage, current, function generator |
| Semiconductors | Diode, LED (color-specific Vf), NPN/PNP BJT, N/P MOSFET, ideal op-amp, dual TL082 |
| Converters | Ideal transformer, diode bridge rectifier |
| Digital | AND, OR, NOT, NAND, NOR, XOR, DFF, JKFF, TFF, SRFF, binary counter, 2:1 MUX, NE555, logic state and clock |
| Mixed signal | Automatic internal CMOS-level bridges; ADC/DAC are not canvas components |
The engine API additionally exposes digital models such as XNOR, buffers, registers, memories and standalone A/D bridge classes. They are not all wired into the schematic editor.
- Multimeter — DC/AC voltage, current and resistance readings between two schematic pins.
- Oscilloscope — two differential channels with configurable time base and vertical scale; it can also read the optional serial hardware stream.
- Function generator — sine, square and triangle waveforms with amplitude, frequency and offset controls.
- Digital circuit analyzer — truth tables, SOP/POS minimization and automatic construction of a gate circuit.
- Resistor calculator — color code ↔ value conversion and E12/E24/E96 series.
- Power triangle — P, Q, S, and power factor for AC analysis.
- SPICE interchange — import and export R, C, L, independent sources and
diodes in
.cir,.netor.spfiles. Imported node names are preserved; subcircuits, models and expressions are intentionally left untouched. - Themes — support for customizable JSON themes. See
themes/README.mdto create your own.
Requirements: Python 3.10 or later; Windows, Linux, or macOS.
git clone https://github.com/pabdan2003/OhmPy.git OhmPy
cd OhmPy
python -m venv .venv
# Windows
.venv\Scripts\activate
# Linux/macOS
source .venv/bin/activate
pip install -r requirements.txt
python main.pyTo create the distributable macOS application, install the optional build tool and run:
python -m pip install ".[build]"
sh scripts/build_macos.shThis produces dist/OhmPy.app and dist/OhmPy-<version>-macOS.dmg. Distribute
the DMG and ask users to drag OhmPy.app to Applications. For each new
release, build it with an increased version in pyproject.toml; replacing
the existing app in Applications updates it in place, without duplicating the
application. User preferences and custom themes remain in ~/.ohmpy.
Before distributing outside a small trusted group, sign and notarize the app with an Apple Developer certificate; otherwise macOS will show a security warning on first launch.
| Platform | Status | Download |
|---|---|---|
| macOS (Apple Silicon) | Available | Latest release |
| Windows | Coming soon | — |
| Linux | Coming soon | — |
For macOS, download the .dmg asset from the release, open it, and drag
OhmPy.app to Applications. The current build is for Apple Silicon
(M1, M2, M3, M4, or M5); an Intel macOS build is not available yet.
- Start OhmPy with
python main.py. - Choose a category and component, then click the canvas to place it.
- Connect pins by clicking one pin and then another.
- Double-click a component to edit its value.
- Click ▶ SIMULATE; OhmPy automatically detects DC, AC, digital, or mixed-signal mode.
Open any project in examples/ with File → Open. They are
small, working circuits intended both for learning the editor and checking
that a release still behaves correctly.
| Area | Projects |
|---|---|
| Analog | LED DC, LED dimmer, BJT fixed bias, active filters, transformer, power factor |
| Digital | Logic gates, binary counter, MUX with clock, 555 astable |
| Editor and instruments | DC multimeter, sheets with net labels, reusable subcircuit |
| LED DC simulation | BJT DC operating point |
|---|---|
![]() |
![]() |
| Digital logic | Low-pass Bode plot |
|---|---|
![]() |
![]() |
from ohmpy.engine import Resistor, VoltageSource, MNASolver
solver = MNASolver()
circuit = [
VoltageSource("V1", "in", "0", 10.0),
Resistor("R1", "in", "out", 1000.0),
Resistor("R2", "out", "0", 1000.0),
]
result = solver.solve_dc(circuit)
print(result["voltages"]["out"]) # 5.0 VOhmPy/
├── main.py # Entrypoint (opens the main window)
├── ohmpy/ # Main package
│ ├── circuit_analyzer.py # Simulation-mode classification and mixed-boundary detection
│ ├── spice.py # Basic SPICE import/export
│ ├── theme_manager.py # Theme loading and persistence
│ ├── engine/
│ │ ├── mna.py # MNA solver (DC, AC, transient)
│ │ ├── components.py # Analog component models
│ │ ├── digital_engine.py# Event-driven digital simulator
│ │ ├── bridges.py # Analog ↔ digital converters
│ │ └── mixed_signal.py # Mixed-signal simulation coordinator
│ └── ui/
│ ├── scene.py # QGraphics scene and netlist construction
│ ├── items/ # ComponentItem, WireItem
│ ├── dialogs/ # Instruments and configuration dialogs
│ └── style.py # Theme, fonts, and visual constants
├── themes/ # JSON themes (data)
├── examples/ # Ready-to-open .csin circuits
├── firmware/ # Protocol and firmware examples for a physical probe
└── tests/ # pytest suite (engine, editor, SPICE, and project I/O)
pip install -r requirements-dev.txt
pytest -vPushes to main and pull requests run the suite on Python 3.10, 3.11 and 3.12 through GitHub Actions (see .github/workflows/ci.yml).
- Migrate tests to
pytest+ GitHub Actions CI. - Bode plots (magnitude and phase) for the existing AC analysis.
- FFT in the oscilloscope.
- Basic SPICE netlist import/export (R, C, L, V, I, D).
- Reusable subcircuits (selection encapsulation).
- Undo changes using snapshots.
- Redo, duplicate, alignment/distribution, grid snap, and manual wire corners.
- Optional migration from snapshots to
QUndoStack. - Persistent probes on the schematic.
Contributions are welcome. Before opening a pull request:
- Read
docs/architecture.mdto understand the separation between engines and global conventions (signs, units, node names). - Run the existing tests and add the ones relevant to your change.
- For engine changes, include a validation case against a known analytical solution.
- For visual changes, attach before-and-after screenshots.
Quick package maps:
ohmpy/engine/README.md— purpose of each engine file.ohmpy/ui/README.md— purpose of each UI file.themes/README.md— JSON theme format and how to create one.firmware/README.md— binary protocol for the physical oscilloscope probe.
Distributed under the MIT License.




