Floating voltage in an LTspice voltage source component

Thread Starter

cmartinez

Joined Jan 17, 2007
6,802
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?
 

MikeML

Joined Oct 2, 2009
5,444
...

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?
Put a switch in series with it:

304.gif
 
Last edited:

eetech00

Joined Jun 8, 2013
1,844
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.
 

Attachments

Thread Starter

cmartinez

Joined Jan 17, 2007
6,802
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.
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:)
 

Alec_t

Joined Sep 17, 2013
10,928
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.
 

PeterCoxSmith

Joined Feb 23, 2015
148
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.
 

eetech00

Joined Jun 8, 2013
1,844
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.
 

Thread Starter

cmartinez

Joined Jan 17, 2007
6,802
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.
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.
 

MikeML

Joined Oct 2, 2009
5,444
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. ...
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
 

Attachments

Last edited:

Thread Starter

cmartinez

Joined Jan 17, 2007
6,802
Isn't what you are building a simple level shifter, like this:

View attachment 95258

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

View attachment 95260
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.
 

Thread Starter

cmartinez

Joined Jan 17, 2007
6,802
I dont get that the PNP sensor has both an input and an output? Can you post a link to it's data sheet?
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.
 

MikeML

Joined Oct 2, 2009
5,444
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.
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.
 

Thread Starter

cmartinez

Joined Jan 17, 2007
6,802
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:
View attachment 95265
Note the three terminals, the external 12V supply. Note how I model the current consumed by the electronics inside the sensor.
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.
 

MikeML

Joined Oct 2, 2009
5,444
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...
 

Thread Starter

cmartinez

Joined Jan 17, 2007
6,802
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?
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!
 
Top