Little help understanding why (or why not)?

Discussion in 'General Electronics Chat' started by Tonyr1084, Jul 8, 2016.

  1. Tonyr1084

    Thread Starter Active Member

    Sep 24, 2015
    535
    86
    I have this LTSpice simulation. It does what I want it to do (time wise) to wait approximately 4 to 5 seconds before switching the load on. In my sim I'm using 14.4 volts because it's conceivable a car battery will charge to 14.4 volts (and will likely settle down around 13.6 to 13.8 volts). I'm unsure of what the load is but it is small. On the order of less than 2 amps.

    What has me confused is why the Vout (test point) is showing about 9.5 volts. The opamp should turn the MOSFET on, right? Should be hard on. NO? I'm confident my circuit can't operate on that low voltage. And when the car battery settles down to around 13.8 volts I'm sure the voltage will only drop even lower. How do I overcome this problem?

    [edit] I have a 3405 but Spice has the closest MOSFET as a 1405. But even looking at the spec sheet for 1405, the full on resistance should be only 5.3mΩ
     
    Last edited: Jul 8, 2016
  2. wayneh

    Expert

    Sep 9, 2010
    12,106
    3,038
    For the benefit of LTspice non-users
    Screen Shot 2016-07-08 at 5.09.04 PM.png

    You're trying to use an N-channel MOSFET in an "emitter follower". Vout rises until the gate-source voltage difference shrinks and fails to turn the MOSFET hard on.

    Put the MOSFET with source at ground and the load to the drain. The MOSFET switches the return to ground for the load. Or, use a P-channel MOSFET if you need to switch the V+ side instead of ground.
     
  3. crutschow

    Expert

    Mar 14, 2008
    13,003
    3,232
    As wayneh noted, you are using the N-MOSFET as a source follower and its gate has to be several volts above the source voltage to turn ON.
    Are you familiar with the threshold voltage of a mosfet?
    If you right click on that MOSFET in LTspice and you will see that the threshold voltage Vto=3.9V. The means that the gate has to be at least 3.9V above the source voltage to just barely turn on the MOSFET.
    To fully turn it on and achieve the mΩ On resistance, the gate-source voltage needs to be at least 10V.
    You can't get there from here using an N-MOSFET.
    That circuit will work if you put the load from V+ to the transistor drain and ground the transistor source, which will allow you to apply at least 10V across the gate-source terminals.

    If you want the full battery voltage into a grounded load then you need to use a P-MOSFET with it's source going to V+.
    That means you need to reverse the polarity of the amp input to get the proper reverse polarity output to the P-MOSFET.
    Then for proper switching you need to use a rail-rail op amp or a comparator such as the LM339, since the output needs to go to V+ to turn off the P-MOSFET.

    Below is your circuit modified with those changes:

    upload_2016-7-8_15-37-58.png
     
  4. EM Fields

    Member

    Jun 8, 2016
    165
    28
    The problem is that you're using an N channel MOSFET as a source follower so, with the load connected between the source and ground, you'll never be able to saturate the MOSFET and use it as a switch.

    A better solution, if you need the load to be ground referred, would be to use a P-channel enhancement mode MOSFET for the switch and then to rewire the comparator inputs.
     
  5. Tonyr1084

    Thread Starter Active Member

    Sep 24, 2015
    535
    86
    I never had any training with MOS. All my education was with BJT's. And that was back in the 70's. For many years I did the father thing - parenting and such with little time for hobbies. What free time I had was spent in family bible study. So I'm seriously playing catch-up with MOS transistors. They seem to work backwards from conventional BJT's - but even that I'm not sure of. I read article after article after article, and many of them I re-read. YouTube has been of some help, but some of the people there make matters worse when they say things the wrong way around.

    I appreciate all the help on this - what with using Spice AND using MOSFET's I'm still trying to learn how to determine what is the right chip to use in different situations. But I'll get there.

    Do my glasses make me look smart?

    OK, off to go play with the grandchildren now. See y'all tomorrow.
     
  6. crutschow

    Expert

    Mar 14, 2008
    13,003
    3,232
    Not backwards.
    The main difference is that MOSFETS have a very high gate input impedance and require a voltage between the gate and source to turn on of at least a few volts (for the common enhancement-mode MOSFET) whereas BJTs have a low impedance base input that looks like a forward biased diode and requires an input current to turn on.

    They both come in two polarities: NPNs and N-MOSFETs require a positive voltage on the base/gate and collector/drain for normal operation whereas PNPs and P-MOSFETs require a negative voltage for those.

    Both BJTs and MOSFETs outputs look basically like a high impedance current source whose value depends upon the device gain and input gate-source voltage for a MOSFET and input base-emitter current for the BJT.

    Does that help any?
     
  7. WBahn

    Moderator

    Mar 31, 2012
    17,743
    4,789
    Most circuits will work, at least roughly, the same whether you use BJT or MOS transistors. This one is no different. Replace the N-channel MOSFET with an NPN transistor and you would still have an emitter follower circuit. Once the transistor is turned on, it will be in the active region and the emitter will be about one diode-drop (the Vbe needed to turn it on) below the base. It's similar with the NFET, once the gate voltage is high enough to turn the transistor on, the transistor will be in the active region (so Rdson does not come into play) and the source will be Vgs below the gate (the Vgs needed to turn it on).

    The threshold voltage for this NFET is between 2 V and 4 V and then you need to have more beyond that to support whatever current is needed. So I would expect your load voltage to be somewhere in the 10 V range, though I would actually expect it to be more like 11 V instead of the 9.5 V your sim is showing.

    If you want to use the transistor as a switch, then if you were using a BJT you would either use a PNP or swap the load and the transistor (and invert the waveform driving the base). So you do the same here, either use a PFET or swap the load and the transistor (and invert the waveform driving the base).
     
  8. Tonyr1084

    Thread Starter Active Member

    Sep 24, 2015
    535
    86
    That's mostly the part that confuses me, the "Negative" voltage. Does that mean it requires a voltage in the negative region such as -2 volts (to -4) or does that mean the difference between Gate and Source? In other words, the gate has to be lower than the source?

    I do appreciate all the help. And I'm happy to be learning to use Spice as well. Both are massive learning experiences for me.
     
  9. Tonyr1084

    Thread Starter Active Member

    Sep 24, 2015
    535
    86
    Thanks. This next question is more about how to choose op-amps from spice library when it seems mine is very limited in choices. I can't find an LM339 in the library. In fact, of the some few different op-amps I have in my stock I can't find any of them in the spice library.

    [edit]
    Do I have to upload something more? My library has only two LM xxx op-amps. MANY LT & LTC as well as several RH types.
     
  10. wayneh

    Expert

    Sep 9, 2010
    12,106
    3,038
    You have to search for spice models of the ICs. I prefer to start at the manufacturer, but sometimes you have to go elsewhere to find them.

    Then, there are a couple ways to get it into your project. The "approved" method is to place it in the same folder as your project and put a .include command into your simulation, to include your new model. This method makes your project portable. You just zip the whole folder and you can send it anywhere. Also, you won't lose anything when LTspice updates itself.

    There is a way to make the new model appear in the menus like the provided models, but then you lose those two advantages. I eventually decided it wasn't worth the trouble. But if you reuse the same model in a lot of different projects, it might be worth it.
     
  11. crutschow

    Expert

    Mar 14, 2008
    13,003
    3,232
    Yes, if by "lower" you mean minus.
    The operating voltage magnitudes are similar for PNPs and P-MOSFETS as compared to NPNs and N-MOSFETs, but the voltage polarities are all minus instead of plus (with respect to the emitter/source).
     
  12. WBahn

    Moderator

    Mar 31, 2012
    17,743
    4,789
    "Negative" in the latter since -- the base (gate) must be negative relative to the emitter (source), so Vbe and Vgs must be negative (by the appropriate amount) for a PNP (PFET). Remember that "a voltage in the negative region" (i.e., the voltage at a point) is fundamentally meaningless since it is merely the voltage relative to so arbitrarily chosen reference point. A device such as a transistor neither knows nor cares what reference we choose to use so as to assign numbers to the voltages at various nodes. All it knows are the voltage differences between its pins and the currents flowing in those pins.
     
  13. Tonyr1084

    Thread Starter Active Member

    Sep 24, 2015
    535
    86
    Does this mean I can find spice models in manufacturers data sheets? Honestly I'm really lost with this. Could you give me an example of how to down load - say - oh, you choose something, some sort of op-amp, something obscure so I have no choice but to practice it myself to get the ones I want (have in my stock).

    Is there a spice library with more IC's to choose from? Or is what I want something the user has to build each time he/she needs a new model?

    Also, I understand "use the ".include" command but I have no idea how to use it. I'm still figuring out how to use voltage supplies to provide things like square waves and such.
     
  14. WBahn

    Moderator

    Mar 31, 2012
    17,743
    4,789
    In the past I've seen models printed in data sheets, but that was when (1) models were simple enough to be reasonably entered by hand, and (2) most people had no means to electronically download models.

    Let's say you have a part from Texas Instruments and what to see if TI has a SPICE model for it. Go to

    http://www.ti.com/

    After selecting "Tools and Software" guess what you find? Under "Analog Design Tools" you have "SPICE Models Library".

    As for how to use the ".include" command, have you tried looking for information? Perhaps something like:

    http://bfy.tw/6g6Q
     
    Last edited: Jul 10, 2016
  15. wayneh

    Expert

    Sep 9, 2010
    12,106
    3,038
    Here's an example. First, here are the .include statements in one of my LTspice files.
    Screen Shot 2016-07-10 at 1.15.50 PM.png
    Each of the files named there are in the same folder as my LTspice project file. I think you could specify an absolute or relative path to the file, but I've never bothered to do that.

    Those files are component models that were not part of LTspice. I believe I found the CD4000 library at the Yahoo LTspice user group. It contains a model of the CD4017. The TLV op-amp models probably came from TI.

    Point is, you simply have to go look.

    Once you have the model, it can still be a bit tricky to get it working nicely in your project, the right symbol connected to the right model file. There are plenty of tutorials out there, so I won't reproduce it all here.
     
  16. crutschow

    Expert

    Mar 14, 2008
    13,003
    3,232
    I put all my added model and symbol files in the LTspice library because I tend to reuse them and don't like messing with the .include command more than I have to. That way you can use them the same as the originally included models.
    The disadvantage, besides any projects using the added devices will not be portable, is that you will lose the added files if you update LTspice to a newer version.
    To save them you will need to backup your library files before the update and then use your old library files after the update (or transfer all your added models to the new library).
     
  17. WBahn

    Moderator

    Mar 31, 2012
    17,743
    4,789
    For LTSpice, I tend to put third-party models into a single user-specified folder specifically so that I don't have to worry about dealing with losing them if and when I upgrade. Also, I like to be able to know at a glance which files ARE third party. I find this to be a reasonable compromise between making schematics inherently portable (all I have to do is include the library folder along with the project folder) and making models easily usable across projects.

    For IC design work, we adopted an approach in which each project had a library folder but the contents of that folder consisted of the model libraries for that process and we set up an easy way of doing that at the time we set up the project folders. The approach we used also made it trivially easy to change processes since all we had to do was replace the library folder with the one for the new process. But maintaining internal IC models is quite different from maintaining package-level IC models.
     
  18. ian field

    Distinguished Member

    Oct 27, 2012
    4,415
    783

    That's the obvious way - if its powered by a mains transformer; a more devious trick is to keep the N-channel MOSFET and rig a voltage doubling rectifier alongside the main one to generate the same thing as a bootstrap supply for gate bias - but you'd also have to add circuitry to the comparator unless its already open collector output.
     
  19. Tonyr1084

    Thread Starter Active Member

    Sep 24, 2015
    535
    86
    @ian field

    Yeah, uh, no. This is going in the truck.

    I have two gauges that have memory and different color schemes. Without the delay every time I start the truck the colors reset to the factory original. Been a pain in the butt. But then I built a timer using a transistor, capacitor and a relay (of sorts) to delay the startup of the gauges. By holding off for a few seconds I have time to start the truck and no voltage spikes are making it through to reset the gauges. It's been working wonderfully for about three years. But lately I've been having to smack the dash to get the relay to click in. So it's time to go solid state. Hence the need for the above circuit and the 4 to 5 second delay. It probably could be as low as 2 seconds but if the truck is hard starting one morning - - - . 6 to 10 seconds would't hurt either. But why wait that long?! So I've settled on 4 to 5 seconds delay on starting the gauges. That way they retain their color scheme and I don't have to sit there and cycle through the colors until I get to the desired colors (to match my dash gauges). I'm just wondering if I need to clean up the supply before feeding my circuit. Probably should. Below is a schematic of what's in place now (and beginning to fail).

    But thanks for the input. It's all appreciated.
     
  20. Tonyr1084

    Thread Starter Active Member

    Sep 24, 2015
    535
    86
    OK, back to extra files for LTSpice. I've found an LM339 I'd like to practice upload.

    http://ltwiki.org/images/7/72/LM339.sub

    It may be from an unapproved source, but the thing I need to know is how to upload this thing. There's no "Upload" button, just the parameters and pinout for the device, so how would I upload this? I need specifics on this, not just 'Go ahead and upload it to spice library'.

    Quick comment on Crutschow's comments about saving files; Perhaps making a backup folder and putting everything there. When you add a new model you add it to the backup folder. Then make copies of them and load them into lib. (or .lib) however you do that. THAT is the part I haven't figured out yet.

    Can someone walk me through it? Oh, I'm on a Mac, not a PC.
     
Loading...