I'm working on a little project now where we need to change a PWM signal source. The PWM is quite slow; about 500Hz. We basically want to override this input from a sensor. We have to switch this when the system is already up & running.
An important criteria is that the system would restore the system to original configuration (original connections - pass through) when it (OUR system, not the load/original sensor) has no power. So I started off with a SPDT reed relay (2ms switch time) to switch signal sources. In this case I would use the normally closed contact of the relay for the original signal and the normally open contact for our signal. Unfortunately the load detects a glitch when we switch NC to NO and goes into an error state..
So I've been looking in other ways of switching. I know there are some really fast solid-state relays out there but I haven't seen them with normally-closed contacts and are fast.
My idea is to use a P-channel MOSFET to switch the signal. In essence works pretty good..
(Yeah I know, I don't know how to flip symbols in LTspice, but I believe this is the right way to connect the PMOS
)
Green is output signal, blue is MOSFET gate signal. When I apply a voltage the FET opens and the signal is dampened/stopped. I added an external diode because I am uncertain whether LTspice contains the body diode. C1/R3 are there to smooth the switching spikes a bit.
The original signal source has a push-pull output, so I can use an ideal voltage source in this case. However, after more testing I discovered the load actually has a pull-up resistor to 5V. This way it can detect whether there is a sensor connected. For our sensor output, it means we can just use an open-drain output. However switching off the original signal is a bit more complicated:
Ouch! What happens I think is the body diode conducts when the signal source pulls low, and therefore the actual signal goes low with a bit of voltage drop to spare.
I can't put a series diode with the MOSFET because when the signal pulls down the series diode would become reverse biased. This way the signal never will be pulled-low.. A second PFET with source/drain reversed neither seems to work (order of MOSFETs doesn't seem to matter).. I think I've seen this trick as a load switch for bidirectional currents/loads or something, I thought I just try it:
I wonder if anyone else has idea's how I can switch these signal sources preferably in the sketched situation.
It seems like a long shot to me..