Floating voltage in an LTspice voltage source component

Discussion in 'General Electronics Chat' started by cmartinez, Nov 23, 2015.

  1. cmartinez

    Thread Starter AAC Fanatic!

    Jan 17, 2007
    3,573
    2,541
    I know how to configure a voltage source in LTspice to deliver synched pulses during a simulation.

    For instance, something like this:

    Capture.JPG

    But how do I tell it that I do not want it to go all the way down to 0V, but to go into a floating (disconnected, or high-z state) mode instead?
    Also, is that even practical for simulation purposes, or am I splitting hairs here?
     
  2. eetech00

    Active Member

    Jun 8, 2013
    650
    112
    What kind of circuit are you trying to simulate?
     
  3. cmartinez

    Thread Starter AAC Fanatic!

    Jan 17, 2007
    3,573
    2,541
    Exactly the one attached. I'd like the PNP voltage source to float instead of reaching zero.


    Capture.JPG
     
  4. MikeML

    AAC Fanatic!

    Oct 2, 2009
    5,450
    1,066
    Put a switch in series with it:

    304.gif
     
    Last edited: Nov 23, 2015
    cmartinez likes this.
  5. eetech00

    Active Member

    Jun 8, 2013
    650
    112
    Hi

    Since this is an inductive proximity sensor I think you mean you want the control signal to stay above 0v...right? The control voltage source is behaving as the sensor trigger voltage. So..the control voltage needs to toggle somewhere below the mosfet threshold voltage and Max Vgs for the mosfet to switch.
    I've added a small cap at the base of Q2 to eliminate spikes. See attachment.
     
    cmartinez likes this.
  6. cmartinez

    Thread Starter AAC Fanatic!

    Jan 17, 2007
    3,573
    2,541
    Thanks, Mike! you're a trove of nifty tricks :)
    Would you mind posting the asc file of that circuit so I can play with it a little?
    Thanks again!
     
  7. cmartinez

    Thread Starter AAC Fanatic!

    Jan 17, 2007
    3,573
    2,541
    Thanks! The added cap is definitely a plus.

    What I'm trying to do is to interface a pnp inductive sensor between a ttl output and a ttl input.
    The left part of the circuit is my clumsy attempt at simulating the output, and the right side is the input.
    What I want is for the input to go high when both the ttl output and the pnp sensor are high. But I'm wondering if this is the best way to do it.

    Perhaps @MaxHeadRoom would like to make an comment or two on my circuit? (please be gentle, btw :confused:)
     
  8. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    5,800
    1,104
    Instead of using a switch in series to float a voltage source, I often use just a diode and jack the voltage source up/down by 0.6V or so if necessary.
     
    cmartinez likes this.
  9. PeterCoxSmith

    Member

    Feb 23, 2015
    148
    38
    In PSpice you cannot have a floating voltage, you have to put a high resistance to ground. I had to do this when modelling the high side of an H Bridge.

    There are other instances when you have to use a low value resistor, for example when a diode is feeding a capacitor. PSpice will not converge on a solution unless you add an ohm or two between the the diode and the capacitor.
     
    cmartinez likes this.
  10. MikeML

    AAC Fanatic!

    Oct 2, 2009
    5,450
    1,066
    Last edited: Nov 24, 2015
    cmartinez likes this.
  11. eetech00

    Active Member

    Jun 8, 2013
    650
    112
    What model of sensor do you want to simulate? Do you have a specific model in mind?
    In addition to modelling switching characteristics, you can also model sensitivity.
     
  12. cmartinez

    Thread Starter AAC Fanatic!

    Jan 17, 2007
    3,573
    2,541
    I have no specific model in mind. Just the general, ordinary PNP 8mm diameter, flush type of sensor with a discrete output (that is, either its output is 12V when sensing or is floating when not) that has a normal working range of 10 to 40V DC. And I intend to run it at 12VDC. I have no issues with

    To make my idea even clearer, here's the circuit that the machine is currently using:

    Capture.JPG

    As I said before, the left and right side parts of the circuit are inside the machine that I'm controlling, while the switch shown inside the box is what I'm trying to replace with an inductive sensor.
    Since the machine's internal logic works at 5V, and the sensor at 12V, I'm planning on using an N-Fet activated by the inductive sensor to replace the mechanical switch, as shown in post #3.
     
  13. MikeML

    AAC Fanatic!

    Oct 2, 2009
    5,450
    1,066
    Isn't what you are building a simple level shifter, like this:

    305.gif

    Here is a version that uses an NPN in place of the NFet:

    305n.gif
     
    Last edited: Nov 24, 2015
    cmartinez likes this.
  14. cmartinez

    Thread Starter AAC Fanatic!

    Jan 17, 2007
    3,573
    2,541
    You could say it's a level shifter, yes. But the left side of the original circuit, (shown in post #12) can both source and sink current. Referring to the figure in post #12, it's when the left side of the circuit (U1) goes low AND the switch is closed that the right side (U2) gets low a input. What I'm trying to do is replace the mechanical switch with an inductive sensor, that's all.
     
  15. MikeML

    AAC Fanatic!

    Oct 2, 2009
    5,450
    1,066
    I dont get that the PNP sensor has both an input and an output? Can you post a link to it's data sheet?
     
  16. cmartinez

    Thread Starter AAC Fanatic!

    Jan 17, 2007
    3,573
    2,541
    My apologies, Mike. Maybe I didn't explain myself clearly. The PNP sensor only has an output, and that is either floating, or active high. If the sensor were of the NPN type, the output would be either floating, or active low. Here's a brief explanation on how these sensors work.
     
  17. MikeML

    AAC Fanatic!

    Oct 2, 2009
    5,450
    1,066
    That agrees with my expectations.

    So what does the Schottky diode represent. The way you drew it in post 3, it appears to be inside the dashed box which I thought shows what is inside the sensor?

    To be completely accurate, the sensor should be drawn as a three terminal device: Vcc, PNP, and Gnd. The sensor's external power supply is tied between Vcc and Gnd

    The PNP out put is shorted to Vcc when the sensor is active, and PNP floats with respect to either Vcc or Gnd when the sensor is not active.

    This more closely models a PNP sensor:
    3053.gif
    Note the three terminals, the external 12V supply. Note how I model the current consumed by the electronics inside the sensor.
     
    cmartinez likes this.
  18. cmartinez

    Thread Starter AAC Fanatic!

    Jan 17, 2007
    3,573
    2,541
    The Schottky is there because there are other outputs (like U1) in parallel (each with a mechanical switch after it) in the machine that merge in one input (that's U2). The machine's logic works by scanning the outputs one by one (by pulling U1 low, then reading the input at U2, and then bringing it high up again) to find which switches are closed. So the diode is there to prevent a short circuit between outputs when they're being scanned. A schottky was chosen because of its low voltage drop.
     
  19. MikeML

    AAC Fanatic!

    Oct 2, 2009
    5,450
    1,066
    This is a non-standard way of using PNP sensors. I am surprised it even works. You are effectively shutting off the 12V power supply to a given sensor while the upstream one is deciding if it wants to pass 12V to the downstream one?

    Redraw the circuit using the three terminal representation of a PNP sensor...
     
  20. cmartinez

    Thread Starter AAC Fanatic!

    Jan 17, 2007
    3,573
    2,541
    Not really... the sensor is always on. It just pushes its output high when it senses something, or floats it when it doesn't.
    In the original case of the mechanical switch, that's why there's a pull-up resistor at the entrance of U2, so that it will always have a determined state. So U2's input will be pulled low when the mechanical switch is closed AND U1's output goes low, otherwise it remains high.
    I'll be more than happy redraw the circuit in a few more hours... gotta get busy!
    Thanks!
     
Loading...