Author Topic: Quickly switching signal sources  (Read 6143 times)

0 Members and 1 Guest are viewing this topic.

Offline hansTopic starter

  • Super Contributor
  • ***
  • Posts: 1659
  • Country: nl
Quickly switching signal sources
« on: April 17, 2013, 05:37:54 pm »
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..  :-//
« Last Edit: April 17, 2013, 05:54:07 pm by hans »
 

Online PA0PBZ

  • Super Contributor
  • ***
  • Posts: 5154
  • Country: nl
Re: Quickly switching signal sources
« Reply #1 on: April 17, 2013, 05:50:22 pm »
What about using a simple cmos analog switch? Most packages have multiple switches so you could even use one to make it a 'pulse and hold' system so that it will return after being powered off.
Keyboard error: Press F1 to continue.
 

Offline hansTopic starter

  • Super Contributor
  • ***
  • Posts: 1659
  • Country: nl
Re: Quickly switching signal sources
« Reply #2 on: April 17, 2013, 06:35:18 pm »
Those switches are nice indeed like a SN74LVC1G3157. But what is the behavior when the device is powered off? The specification table clearly specifies for VCC at a certain range, which is not zero volts.

We do have a microcontroller on the system that will switch these sensors when required. We will incorporate Brown Out detection and switch outputs back when we have to. But for example if the system has (already) lost power it should always work as original without user intervention.
« Last Edit: April 17, 2013, 06:38:54 pm by hans »
 

Offline C

  • Super Contributor
  • ***
  • Posts: 1346
  • Country: us
Re: Quickly switching signal sources
« Reply #3 on: April 19, 2013, 04:13:23 am »
Hi
You might want to try a three stage approach.

Relay one normally closed contacts connect input to output.
Relay two normally open contacts connect input & output to electronic switch. When de-energized isolates the electronic switch.
Electronic switch for fast switching.

On power up
1. electronic switch set to connect input to output.
2. relay two energized to connect electronic switch in parallel to relay one's normally closed contacts.
3. time delay for relay two to close
4. relay one energized to allow electronic switch to gain control.

On power loss
1. quickly switch the electronic switch to connect input to output.
2. de-energize relay one
Note: power supply would need to supply power to relay two & electronic switch longer then the time for relay one's normally closed contacts to close and stop bouncing.
 
C
 

Offline hansTopic starter

  • Super Contributor
  • ***
  • Posts: 1659
  • Country: nl
Re: Quickly switching signal sources
« Reply #4 on: April 19, 2013, 08:36:37 pm »
Hi 'C' ;)

That sounds like a doable set-up, by using 2 relays with 'break after make' (instead of the usual break-before-make) principle you basically avoid switch glitches, as it doesn't matter really that the input and outputs of the analog switch are shorted together at first.

In total it means we have to use about 8 relays though, because we have 4 sensors to switch. I guess that will only cost a bit of extra box space.

I've also thought about other options, but that basically involves changing the use-case... like manual switch over when the system is turned off  |O

I'll give it a weekend to think about it :)
 

Offline Rufus

  • Super Contributor
  • ***
  • Posts: 2095
Re: Quickly switching signal sources
« Reply #5 on: April 20, 2013, 12:00:03 am »
As long as the duty cycle doesn't go down to zero you could probably steal from the PWM signal enough to power a CMOS analog switch (74HC CMOS switch probably needs around 10uA).

With the switch constantly powered you just have to be careful with the control signals as your system powers up and down.

Just noticed your last post - with 4 sensors all 4 would share the load and all 4 have to go to zero duty to be a problem.
 

Offline croberts

  • Regular Contributor
  • *
  • Posts: 94
  • Country: us
Re: Quickly switching signal sources
« Reply #6 on: April 20, 2013, 11:56:12 pm »
I've been playing with the attached schematic in LTspice. I'm not sure if it meets your requirements or has more components than you wanted to use. All the best.
 

Offline hansTopic starter

  • Super Contributor
  • ***
  • Posts: 1659
  • Country: nl
Re: Quickly switching signal sources
« Reply #7 on: April 22, 2013, 07:25:33 pm »
As long as the duty cycle doesn't go down to zero you could probably steal from the PWM signal enough to power a CMOS analog switch (74HC CMOS switch probably needs around 10uA).

With the switch constantly powered you just have to be careful with the control signals as your system powers up and down.

Just noticed your last post - with 4 sensors all 4 would share the load and all 4 have to go to zero duty to be a problem.

The application is a steer-by-wire project we want to drive autonomously at certain sights.. We only want to do this offside public roads and such, on private area's where there is nothing to hit when something does go wrong.

However, when we do go over public roads, it would become quite an insurrance issue if something does go wrong (accident) and it turns out the signals from the steering were modified.
If we can prove it will feed through the original signals if turned off, I think we're pretty safe. Though, it will still be a hassle , but this is the vital part of our project, not much we can do about it I guess :-//
For example, we have considered driving all the time on our own encoder outputs and have software control all of it. However, when our project box loses power for whatever reason (blown fuse) we have a pile of "urgent" error messages and possibly a crash on a public road. Oops

@croberts:
I've redrawn your schematic. Although I was optimistic about the PNP switches, there was one vital element missing in your schematic. Namely, the pull-up at the output.. :(  (see schematic link)


My schematic version

Unfortunately , it doesn't pull the signal quite well down.. I think this is in the nature of a PNP which is basically a current controlled current source..
I don't think it will easily conduct currents both ways.



Maybe I should build a multiplexer or analog switch arrangement instead, powered off the steer encoders/column itself.
« Last Edit: April 22, 2013, 07:31:52 pm by hans »
 

Offline kxenos

  • Frequent Contributor
  • **
  • Posts: 284
  • Country: gr
Re: Quickly switching signal sources
« Reply #8 on: April 22, 2013, 08:33:00 pm »
Can you try this out?

The second one has almost the same delay from low to high and high to low
« Last Edit: April 22, 2013, 08:59:48 pm by kxenos »
 

Offline croberts

  • Regular Contributor
  • *
  • Posts: 94
  • Country: us
Re: Quickly switching signal sources
« Reply #9 on: April 22, 2013, 08:43:23 pm »
Hello hans

Sorry if you've already answered this but is it permissible to use the pull up 5V to bias npn switches?
 

Offline croberts

  • Regular Contributor
  • *
  • Posts: 94
  • Country: us
Re: Quickly switching signal sources
« Reply #10 on: April 22, 2013, 09:33:48 pm »
Hello hans

Just in case the answer to my previous question is yes, I've attached a version using npn switches. For convenience here is a link to the LTspice schematic file.

https://www.dropbox.com/s/92skfzsgj4l47ff/Transistor%20Switch%202.asc

Cheers.
« Last Edit: April 22, 2013, 10:16:32 pm by croberts »
 

Offline hlavac

  • Frequent Contributor
  • **
  • Posts: 536
  • Country: cz
Re: Quickly switching signal sources
« Reply #11 on: April 23, 2013, 08:44:48 pm »
If the pwm signal is simple 5V logic, why not use a simple multiplexor? I can build one from one 74HC00 chip!
Good enough is the enemy of the best.
 

Offline hlavac

  • Frequent Contributor
  • **
  • Posts: 536
  • Country: cz
Re: Quickly switching signal sources
« Reply #12 on: April 24, 2013, 01:35:53 pm »
This is what you need.
Good enough is the enemy of the best.
 

Offline Rufus

  • Super Contributor
  • ***
  • Posts: 2095
Re: Quickly switching signal sources
« Reply #13 on: April 24, 2013, 04:17:14 pm »
This is what you need

He needs one of the signals to pass to the output when there is no power supplied to his circuit. That is the real problem.
 

Offline hansTopic starter

  • Super Contributor
  • ***
  • Posts: 1659
  • Country: nl
Re: Quickly switching signal sources
« Reply #14 on: April 25, 2013, 12:07:16 pm »
Can you try this out?

The second one has almost the same delay from low to high and high to low

This is more or less identical with what I started out with.

The output has a 5V pull-up, and when the signal source pulls low, a P-MOSFET and it's body diode will pull the signal low (to about 0.6V though, diode drop..)

Hello hans

Sorry if you've already answered this but is it permissible to use the pull up 5V to bias npn switches?

I think we still need 5V for one of the signals to pass through unharmed.
However, if that requirement must be met for our signal, that's OK because we can only use our own signal if there is power (for example 5V)

If I disable the switch command and I remove the bias connection I don't see any output..
However, we may be able to take power from the encoders steer-column, so it maybe isn't a problem at all.

Indeed - a digital mux is not an option because it will take power - however, if I can take power for a transistor, I can probably also take it for a multiplexer.
I'll have to see whether this is possible, my prefer is still it doesn't need any power at all. But I think that only is met with (mechanical) relays.
 

Offline croberts

  • Regular Contributor
  • *
  • Posts: 94
  • Country: us
Re: Quickly switching signal sources
« Reply #15 on: April 25, 2013, 12:39:09 pm »
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.

Hello hans

The specification calls for the load/original system to keep working when your system power is lost (not the load/original sensor power). If the load pull up voltage is being sourced by the load (not by your system) it should be OK to use it (within it's power limits of course) for the switch.

One additional thought. Why is the pull up resistor there? Maybe the encoders (or whatever is the source) have open collector/drain outputs and the resistor is needed to pull the signal line high. If this is true and the pullup voltage is lost then all will be lost and it is OK to use the pull up voltage for the switch.
« Last Edit: April 25, 2013, 01:06:03 pm by croberts »
 

Offline hansTopic starter

  • Super Contributor
  • ***
  • Posts: 1659
  • Country: nl
Re: Quickly switching signal sources
« Reply #16 on: April 25, 2013, 03:24:22 pm »
Maybe I forgot to mention some things :)
We have a box that will take over control of steering and other driving inputs under certain circumstances.

The ECU of the car reads steer inputs from the wheel via encoders. These encoders are push-pull because we have measured the encoders without being passed through. The pull-up is probably there to make my life harder :-X, or just to define a signal state when there is no encoder connected. ;)

Anyway, we power our box separately from the steering column because the box needs to be off when we drive on open roads. Moreover, our box is fused so if for some reason the fuse blows we don't have any steering. It should revert to original configuration. That's why we have the spec 'no power, original configuration'. ;)

I guess we can use the power of the steering column just for the encoder switching/biasing and such. Because if that power rail is lost, there is no chance the original encoders will work anyway.
 

Offline croberts

  • Regular Contributor
  • *
  • Posts: 94
  • Country: us
Re: Quickly switching signal sources
« Reply #17 on: April 25, 2013, 03:33:08 pm »
I guess we can use the power of the steering column just for the encoder switching/biasing and such. Because if that power rail is lost, there is no chance the original encoders will work anyway.

Hello hans

I think those last two sentences say it all. Now you have power for whatever switch solution you choose and you can move forward. Best Regards.
 

Offline croberts

  • Regular Contributor
  • *
  • Posts: 94
  • Country: us
Re: Quickly switching signal sources
« Reply #18 on: April 25, 2013, 05:29:05 pm »
One more thought. If the load(ECU?) will allow it and it is your choice, you could try changing the pull up to a pull down (to ground..still defines a signal state) and then go back to the PNP switches and a no power solution.
 

Offline hansTopic starter

  • Super Contributor
  • ***
  • Posts: 1659
  • Country: nl
Re: Quickly switching signal sources
« Reply #19 on: April 25, 2013, 09:16:24 pm »
I haven't opened the steering ECU yet to see what's what, but as it's hidden in a pile of cables and panels it would be a last resort. ;)

I think I probably could change the pull-up if it was applied external. I don't think they would be using internal pull-ups due to protection (automative use etc.)..
I will see if I can get it to work with some transistors.

Thanks everyone for joining in my thought process  :-/O
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf