A browser‑based interactive circuit building tool designed for beginners learning electronics and programming.
Users can build simple electrical circuits, connect components with wires and see live calculations for current, voltage and power.
This project demonstrates the crossover between electrical engineering and software development using JavaScript and HTML5 canvas.
https://ya0903.github.io/circuit-simulator/
- Add batteries, resistors, LEDs, switches, capacitors, inductors and diodes
- Add ammeters and voltmeters for measurements
- Junction nodes for parallel branches
- Drag-and-drop component placement
- Search bar to quickly find components
- Manual wire drawing between terminals
- Right-angle wire routing for clarity
- Wire mode toggle for quick connections
- Lock point mode for custom wire corners and path control
- Visual wire highlighting when current flows
- Undo support for wiring and layout changes
- Automatic series circuit analysis
- Automatic parallel circuit analysis
- Equivalent resistance calculation
- Ohm’s Law current calculation
- Voltage drop estimation
- Power dissipation calculations
- LEDs glow when powered
- Active wires glow green
- Clear open vs closed circuit status
- Per‑component electrical readings
- Auto layout for series circuits
- Auto layout for parallel circuits
- Clear wires tool
- Reset workspace tool
- Undo button for recent changes
- Lock point mode for manual right-angle wire shaping
- Component search mode for faster placement
- Click components to edit values
- Change resistance
- Adjust battery voltage
- Set LED forward voltage and colour
- Edit capacitance and inductance values
- Toggle switches open or closed
- Attach voltmeter probes to components
- HTML5 Canvas for schematic rendering
- CSS3 for modern responsive UI
- Vanilla JavaScript for simulation logic
No frameworks or libraries used.
circuit-simulator/
├── index.html → Main UI and layout
├── style.css → Visual design and responsive layout
└── script.js → Circuit logic and simulation engine
-
Download all project files
-
Ensure these three files are in the same folder:
index.htmlstyle.cssscript.js
-
Double‑click
index.html -
The simulator opens in your web browser
- Open the folder in VS Code
- Install the Live Server extension
- Right‑click
index.html - Click Open with Live Server
This enables automatic refresh when editing code.
- Add Battery
- Add Resistor
- Add LED
- Click Auto Layout Series
- Click Run Simulation
- Add Battery
- Add Two Resistors
- Click Auto Layout Parallel
- Click Run Simulation
- Add components
- Turn Wire Mode on
- Click one terminal
- Turn Lock Point Mode on if you want custom corners
- Click on the canvas to place one or more lock points
- Click another terminal to complete the wire
- Run simulation
- Use the search box in the component panel
- Type a name such as
capacitor,inductorordiode - Click the matching component button to add it
- Move a component, add a wire or add a component
- Click Undo to step back one change
This project helps demonstrate:
- Basic circuit theory
- Ohm's Law in action
- Series vs parallel behaviour
- Power dissipation concepts
- Interactive graphical programming
- Canvas rendering techniques
- Event-driven UI design
- UI state management with undo history
- Search and filtering logic in JavaScript
- Path-based wire drawing with manual lock points
This project is useful for showcasing:
✅ Engineering knowledge ✅ JavaScript programming ✅ UI design skills ✅ Simulation logic ✅ Problem solving
Ideal for applications in:
- Electrical Engineering
- Electronic Engineering
- Embedded Systems
- Software Engineering
- Robotics
- Mechatronics
- Real SPICE-level simulation
- Oscilloscope tool
- More accurate capacitor and inductor behaviour
- AC signal analysis
- Save and load circuits
- Multi-select and box selection
- Mobile touch gestures
- Dark/light theme toggle
Free to use for educational and portfolio purposes.
Created as an educational engineering project combining electronics and programming.