LT Spice help with adding this "S1" switch to my circuit.

Thread Starter

Tonyr1084

Joined Sep 24, 2015
5,258
Have hardly used LT Spice, but I have figured out one or two things about it. This circuit (without S1) gives me an approximate 30 second time delay, which is exactly what I want as far as timing is concerned. However, I want to control the switch in the circuit, but don't know how to do that. Here's the ASC file. Please show me how to modify the switch to turn on after just one second. I need to see how the circuit will perform beyond just applying the voltage from the battery. In other words, will the switch cause some adverse affect.

As far as the components go, I'm using generic components. I will have to eventually figure out how to add things like Op Amps and MOSFETS. For now the circuit has been adjusted close enough to the timing I want. Accuracy is not needed, just an approximately 30 second delay before Vout goes high. The switch is to prevent the battery from draining when the circuit is not active.

This is going to be a freezer door open alarm. If the door is not fully closed (or open) for about 30 seconds, the alarm will start to sound. If you have any other advice, please share.

Thanks.

[edit] The alarm (load) will be 6 - 16VDC @ 40mA Max. [end edit]
 

Attachments

Last edited:

Thread Starter

Tonyr1084

Joined Sep 24, 2015
5,258
Thank you @ericgibbs. So I can further understand;
PULSE(0 means zero volts, a.k.a the switch is at zero volts and open
5 means five volts and the switch closes.
1 means "One second before switching"
What's the "1u 1u 60 120 1)?

Another point of unfamiliarity is the
.model SW SW(Ron=.1 Roff=1Meg Vt=3)? These labels, what do they mean?
I'm guessing that the Ron=.1 means resistance, as does the 1Meg mean the off resistance. Correct?
 
Last edited:

crutschow

Joined Mar 14, 2008
25,680
What's the "1u 1u 60 120 1)?
If you right click on V1, you will see what they represent.
.model SW SW(Ron=.1 Roff=1Meg Vt=3)? These labels, what do they mean?
That's the switch operating parameters.
Ron and Roff should be self explanatory.
Vt is the control voltage where is switches.
If you look up Voltage Controlled Switch in the LTspice help files, you will find a complete explanation of its operation.
 

Thread Starter

Tonyr1084

Joined Sep 24, 2015
5,258
Any advice? Recommendations? Use an N channel MOSFET instead of a P channel and set up as a load follower?

[edit] since the load is small, maybe a 2n7000?
 

crutschow

Joined Mar 14, 2008
25,680
Any advice? Recommendations? Use an N channel MOSFET instead of a P channel and set up as a load follower?

[edit] since the load is small, maybe a 2n7000?
An N-Channel source-follower will have a Vgs(th) voltage drop from the supply to the load.
If you use an N-MOSFET (the 2N7000 if fine for a small load) the source should be grounded and the load put between the supply voltage and the the transistor drain.

One problem I see with your circuit is that you are using a standard op amp, not a rail-rail type, so the output will go from a couple voltages above ground to a couple volts below the supply voltage.
You should use a rail-rail op amp.
 

Thread Starter

Tonyr1084

Joined Sep 24, 2015
5,258
One thing I have never been able to do was upload models to the Spice files. I've tried a few times with no success. So the diagram is simply there as a place holder for functionality. Rail to rail would be fine, but not sure it's needed. I have to look through my stock. Seems I have at least one LM339 Quad Single Supply Comparator. That's all I need it to do - to turn the sonalert on and off. It's voltage range is 6V to 16V and should see a max of 40mA according to the sticker.
An N-Channel source-follower will have a Vgs(th) voltage drop from the supply to the load.
If you use an N-MOSFET (the 2N7000 if fine for a small load) the source should be grounded and the load put between the supply voltage and the the transistor drain.
Not sure, did you mean "A P-Channel Source-follower"? I have plenty of 2n7000's, so a redesign would be easy enough. But there again I don't have the spice model for the 7000. My On Hand stock inventory list seems to indicate I have four LM358's; Dual OpAmps.
 
Last edited:

crutschow

Joined Mar 14, 2008
25,680
Rail to rail would be fine, but not sure it's needed.
A standard op amp may not fully turn the MOSFET on or off.
did you mean "A P-Channel Source-follower"
No.
An N-CHANNEL source-follower with a grounded load.
I don't have the spice model for the 7000.
Here's the 2N7000 model I use:

.model 2N7000/2 VDMOS(Rg=3 Vto=3 Rd=0 Rs=.75 Rb=.14 Kp=.17 mtriode=1.25 Cgdmax=80p Cgdmin=12p Cgs=50p Cjo=50p Is=.04p mfg=Fairchild Vds=60 Ron=2 Qg=.223n)

Paste it into the lib\cmp\standard.mos file.

Close and open LTspice and it should appear in the nmos library.
 

ericgibbs

Joined Jan 29, 2010
11,156
hi tony,
In LTS, you use a generic model for the 2N7000 and paste the BOLD text from Carl's post #12 onto the circuit drawing.
There are also other options, but try that first,
E
.model 2N7000/2 VDMOS(Rg=3 Vto=3 Rd=0 Rs=.75 Rb=.14 Kp=.17 mtriode=1.25 Cgdmax=80p Cgdmin=12p Cgs=50p Cjo=50p Is=.04p mfg=Fairchild Vds=60 Ron=2 Qg=.223n)
 

Thread Starter

Tonyr1084

Joined Sep 24, 2015
5,258
Boy I must be a nincompoop! Can't figure it out at all.

[edit] Looks like I forgot to "Post reply" last night. I'll leave learning LT Spice for another day. For now (or last night) it was just frustrating not being able to find certain things. [end edit]
 
Top