Maker Pro
Maker Pro

A ngspice Circuit using LM358

  • Thread starter Anand P. Paralkar
  • Start date
A

Anand P. Paralkar

Jan 1, 1970
0
Hi,

I am trying to construct a simple current to voltage convertor using the
LM358 single-supply op-amp. As a basic starting point, I am using two
stages. The first stage below is a voltage buffer that will later be
converted to an I-to-V stage. (Voltage source will become a current
source and a resistor will be added.)

The second stage consists of a bias voltage applied on the first stage
output followed by a simple buffer.

I am unable to understand the voltage plot at node 6 (capacitor C1
output). This should show a an AC coupled (no dc offset) complete sine
wave, but ngspice shows kind of a rectified sine wave output!

Any idea?

Thanks for your help,
Anand

==========================================================================
..include /cygdrive/c/work/ngspice/library/LM358-NAT.lib

*First stage

* NI, INV, POS, NEG, OP
X1 1 2 3 4 5 LM358/NS
Vp1 3 0 5V
Vn1 4 0 0V
R1 5 2 0.1 *Short circuit from o/p to inv
Vsource 1 0 sin(0 1 625) *to be replaced with current source

*Second stage
C1 5 6 18pF
R2 6 7 0.1
*Rb1 9 7 100K *voltage divider
*Rb2 7 0 100K *voltage divider
X2 7 8 9 10 11 LM358/NS
Vp2 9 0 5V
Vn2 10 0 0V
R3 11 8 0.1 *short circuit from o/p to inv
=============================================================================

*//////////////////////////////////////////////////////////////////////
* (C) National Semiconductor, Inc.
* Models developed and under copyright by:
* National Semiconductor, Inc.

*/////////////////////////////////////////////////////////////////////
* Legal Notice: This material is intended for free software support.
* The file may be copied, and distributed; however, reselling the
* material is illegal

*////////////////////////////////////////////////////////////////////
* For ordering or technical information on these models, contact:
* National Semiconductor's Customer Response Center
* 7:00 A.M.--7:00 P.M. U.S. Central Time
* (800) 272-9959
* For Applications support, contact the Internet address:
* [email protected]

*//////////////////////////////////////////////////////////
*LM358 DUAL OPERATIONAL AMPLIFIER MACRO-MODEL
*//////////////////////////////////////////////////////////
*
* connections: non-inverting input
* | inverting input
* | | positive power supply
* | | | negative power supply
* | | | | output
* | | | | |
* | | | | |
..SUBCKT LM358/NS 1 2 99 50 28
*
*Features:
*Eliminates need for dual supplies
*Large DC voltage gain = 100dB
*High bandwidth = 1MHz
*Low input offset voltage = 2mV
*Wide supply range = +-1.5V to +-16V
*
*NOTE: Model is for single device only and simulated
* supply current is 1/2 of total device current.
* Output crossover distortion with dual supplies
* is not modeled.
*
****************INPUT STAGE**************
*
IOS 2 1 5N
*^Input offset current
R1 1 3 500K
R2 3 2 500K
I1 99 4 100U
R3 5 50 517
R4 6 50 517
Q1 5 2 4 QX
Q2 6 7 4 QX
*Fp2=1.2 MHz
C4 5 6 128.27P
*
***********COMMON MODE EFFECT***********
*
I2 99 50 75U
*^Quiescent supply current
EOS 7 1 POLY(1) 16 49 2E-3 1
*Input offset voltage.^
R8 99 49 60K
R9 49 50 60K
*
*********OUTPUT VOLTAGE LIMITING********
V2 99 8 1.63
D1 9 8 DX
D2 10 9 DX
V3 10 50 .635
*
**************SECOND STAGE**************
*
EH 99 98 99 49 1
G1 98 9 POLY(1) 5 6 0 9.8772E-4 0 .3459
*Fp1=7.86 Hz
R5 98 9 101.2433MEG
C3 98 9 200P
*
***************POLE STAGE***************
*
*Fp=2 MHz
G3 98 15 9 49 1E-6
R12 98 15 1MEG
C5 98 15 7.9577E-14
*
*********COMMON-MODE ZERO STAGE*********
*
*Fpcm=10 KHz
G4 98 16 3 49 5.6234E-8
L2 98 17 15.9M
R13 17 16 1K
*
**************OUTPUT STAGE**************
*
F6 50 99 POLY(1) V6 300U 1
E1 99 23 99 15 1
R16 24 23 17.5
D5 26 24 DX
V6 26 22 .63V
R17 23 25 17.5
D6 25 27 DX
V7 22 27 .63V
V5 22 21 0.27V
D4 21 15 DX
V4 20 22 0.27V
D3 15 20 DX
L3 22 28 500P
RL3 22 28 100K
*
***************MODELS USED**************
*
..MODEL DX D(IS=1E-15)
..MODEL QX PNP(BF=1.111E3)
*
..ENDS
*$
 
A

Anand P. Paralkar

Jan 1, 1970
0
I tried that. Doesn't help. One can also try with a DC bias to the
first stage input. Say a 2.5V DC bias "Vsource 1 0 sin(2.5 1 625)".
This doesn't help too.

Infact, its not the first stage LM358 output (this is simulated
correctly). Its the node after the LM358 output, the one at the
capacitor "output" (node 6) which I find erroneous.

I was hoping that someone simulates this circuit with another Spice
software and cross-verifies the behaviour.

Thanks for looking into it,
Anand
 
J

Jamie

Jan 1, 1970
0
I meant most of us weren't born knowing electronics, not that
simulators were the best teachers.

Pffft....BANG! is one of the best teachers.
Kind of reminds me of when RAD, Java /JavaScript, PHP and related things
came along. Young people called themselves computer programmers! WOW

I think many of those have really forgotten or never knew what real
programming is all about..

Jamie
 
J

Jamie

Jan 1, 1970
0
RST said:
You mean you never got a horizontal sweep tube pressed into 40 meter
service so hot the glass got sucked onto the plate before it went
whizz-bang?

Jim
Sure

Made a CB amp years ago for the car using a pair of 6jS6 es....

some Radio shaft power transformers turned around backwards for
an inverter with a multiplier rectifier for the B+///it got warm
in the car after a while..

Jamie
 
Top