Skip to content

Repository files navigation

⚡ RC Circuit Convolution Simulator

Authors: Sérgio Carneiro & Eduardo Piassaroli

Convolution Animation Demo

A dynamic Python simulator that visualizes the convolution integral $y(t) = x(t) * h(t)$ of an RC circuit. This project bridges circuit theory and digital signal processing, simulating the transient response using PySpice and animating the mathematical convolution process with Matplotlib.

🛠️ Features

  • PySpice Integration: Simulates real circuit behavior using the NGSpice engine.
  • Causal Convolution: Accurately computes the discrete convolution while maintaining system causality.
  • Dynamic Visualization: Animates the step-by-step overlap of the input signal $x(\tau)$ and the impulse response $h(t-\tau)$.
  • Modular Codebase: Separated concerns for circuit definition, signal processing, and frontend animation.

⚙️ Prerequisites & Setup

To run this simulator, you need Python 3.14.0 and the NGSpice engine installed on your machine. Here is the step-by-step setup to get the environment ready:

1. Download the Project

First, clone this repository to get the source code on your local machine and navigate into the project folder:

git clone [https://github.com/slcarneiro/Circuit-Convolution.git](https://github.com/slcarneiro/Circuit-Convolution.git)
cd Circuit-Convolution

2. Install Python Dependencies

pip install -r requirements.txt

3. Configure NGSpice (Important Step)

  • Because this project uses PySpice as a bridge to simulate real circuits, the code depends on the external NGSpice engine to work. You must configure it manually:

  • Download and install NGSpice.

  • Add the NGSpice installation folder (specifically the folder containing the .dll or executable, usually .../ngspice/bin) to your system's Environment Variables (PATH).

  • DLL Error Fix: If you encounter any .dll missing errors (e.g., "ngspice.dll not found"), you can easily fix it by running pyspice-post-installation --install-ngspice-dll directly in your VS Code terminal, or by manually copying the .dll file to your project's root folder.

  • 🚨 CRITICAL NOTE: If PySpice cannot find the engine in your PATH, the simulation will fail to run.

About

No description or website provided.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages