How to view Frequency in KiCad Simulation

How to view Frequency in KiCad Simulation (Frequency Counter / Frequency Measurment) ?

How familiar are you with ngspice in general? Have you used it before? Do you already have a circuit designed and setup in the schematic?

i am new in kicad. i had created simple pulse generator design but i am unable to measure frequency/ frequency counter view. simulation showing only graph pwm and only time but not showing frequency.Test Frequency1.sch (3.7 KB)

Unfortunately the eeschem-ngspice interface is rather limited. There is no frequency counter view.

I am thinking of a ngspice control language script, but it is not yet done.

1 Like

If you add this text snippet to your eeschema circuit diagram

.tran 1n 10u
.control
  set controlswait
  meas tran tdiff TRIG v(out) VAL=6 RISE=2 TARG v(out) VAL=6 RISE=12
  let freq = 10/tdiff
  echo
  echo frequency is $&freq Hz
.endc

you will get the frequency as output. It simply measures the time point difference of signal v(out), when it crosses a value of 6 V for the second time (while the signal is rising) until it crosses the value for the 12th time (again while the signal is rising). Then the difference is inverted, multiplied by 10, and printed as frequency.

KiCad5TestNew.pro (688 Bytes) Test Frequency1.sch (3.9 KB) Test Frequency1-cache.lib (1.6 KB)

4 Likes

Genius. Thank you, @holger!