Tag: ngspice

  • ngSpice: single frequency FM modulated signal generation

    ever wanted to see how that 2N2222 might hold up as a linear RF amplifier? here’s a handy feature of ngSpice that i found recently. i’m rather new to ngSpice and at first was somewhat frustrated by its differences from other SPICE variants. however, i’ve earned a deep appreciation for it and its integration with the gEDA suite.

    V1 n1 0 sffm(2 24 10k 5 1k)
    .tran 0.01ms 2ms
    .plot n1
    

    the above code generates the waveform seen above. the corresponding values in the sffm() function run something like this.

    Parameters Default value Unit
    Vo (offset) Ampere or Volt
    Va (amplitude) Ampere or Volt
    Fc (carrier frequency) 1/Tstop Hz (Hertz)
    Mi (modulation index)
    Fs (modulation frequency) 1/Tstop Hz (Hertz)
  • SPICE: ngSpice plot test…

    nothing too special here. i’ve been practicing my SPICE skills and attempting to work with a single-supply active EQ circuit based on the TL082. further research of this chip has pointed out that the TL072 is better for audio applications, but it seems that the differences are pretty minuscule.

    here’s the spice code with the subcircuit that i downloaded off TI’s web site.

    * Spice netlister for gnetlist
    XU1 n7 	n2 	n1 	0 	n4 	TL082
    C1	n4	n6				10U
    C2	n5  n7				.1U
    RL	n6	0				1MEG
    R2 	n2 	n4 				10K
    R1	n2 	0				10K
    R3	n1	n7				10K
    R4	n7  0				3.3K
    V2 	n5	0 				SIN(0 1 1kHz)
    V1 	n1 	0 				9
    .TRAN 0.01ms 10ms
    .PLOT n5 n6
    .END
    
    
    
    * TL082 OPERATIONAL AMPLIFIER "MACROMODEL" SUBCIRCUIT
    * CREATED USING PARTS RELEASE 4.01 ON 06/16/89 AT 13:08
    * (REV N/A)      SUPPLY VOLTAGE: +/-15V
    * CONNECTIONS:   NON-INVERTING INPUT
    *                | INVERTING INPUT
    *                | | POSITIVE POWER SUPPLY
    *                | | | NEGATIVE POWER SUPPLY
    *                | | | | OUTPUT
    *                | | | | |
    .SUBCKT TL082    1 2 3 4 5
    *
      C1   11 12 3.498E-12
      C2    6  7 15.00E-12
      DC    5 53 DX
      DE   54  5 DX
      DLP  90 91 DX
      DLN  92 90 DX
      DP    4  3 DX
      EGND 99  0 POLY(2) (3,0) (4,0) 0 .5 .5
      FB    7 99 POLY(5) VB VC VE VLP VLN 0 4.715E6 -5E6 5E6 5E6 -5E6
      GA    6  0 11 12 282.8E-6
      GCM   0  6 10 99 8.942E-9
      ISS   3 10 DC 195.0E-6
      HLIM 90  0 VLIM 1K
      J1   11  2 10 JX
      J2   12  1 10 JX
      R2    6  9 100.0E3
      RD1   4 11 3.536E3
      RD2   4 12 3.536E3
      RO1   8  5 150
      RO2   7 99 150
      RP    3  4 2.143E3
      RSS  10 99 1.026E6
      VB    9  0 DC 0
      VC    3 53 DC 2.200
      VE   54  4 DC 2.200
      VLIM  7  8 DC 0
      VLP  91  0 DC 25
      VLN   0 92 DC 25
    .MODEL DX D(IS=800.0E-18)
    .MODEL JX PJF(IS=15.00E-12 BETA=270.1E-6 VTO=-1)
    .ENDS