Quickly switching signal sources - Page 1
Forum section: electronics / projects

author: hans
author_rank: Super Contributor
timestamp: April 17, 2013, 05:37:54 pm
content: 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..

author: PA0PBZ
author_rank: Super Contributor
timestamp: April 17, 2013, 05:50:22 pm
content: 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.

author: hans
author_rank: Super Contributor
timestamp: April 17, 2013, 06:35:18 pm
content: Those switches are nice indeed like aSN74LVC1G3157. 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.

author: C
author_rank: Super Contributor
timestamp: April 19, 2013, 04:13:23 am
content: HiYou 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 up1. 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 close4. relay one energized to allow electronic switch to gain control.On power loss1. quickly switch the electronic switch to connect input to output.2. de-energize relay oneNote: 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

author: hans
author_rank: Super Contributor
timestamp: April 19, 2013, 08:36:37 pm
content: 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 offI'll give it a weekend to think about it

author: Rufus
author_rank: Super Contributor
timestamp: April 20, 2013, 12:00:03 am
content: 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.

author: croberts
author_rank: Regular Contributor
timestamp: April 20, 2013, 11:56:12 pm
content: 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.

author: hans
author_rank: Super Contributor
timestamp: April 22, 2013, 07:25:33 pm
content: Quote from: Rufus on April 20, 2013, 12:00:03 amThe 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 guessFor 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 versionUnfortunately , 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.

author: kxenos
author_rank: Frequent Contributor
timestamp: April 22, 2013, 08:33:00 pm
content: Can you try this out?The second one has almost the same delay from low to high and high to low

author: croberts
author_rank: Regular Contributor
timestamp: April 22, 2013, 08:43:23 pm
content: Hello hansSorry if you've already answered this but is it permissible to use the pull up 5V to bias npn switches?

author: croberts
author_rank: Regular Contributor
timestamp: April 22, 2013, 09:33:48 pm
content: Hello hansJust 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.ascCheers.

author: hlavac
author_rank: Frequent Contributor
timestamp: April 23, 2013, 08:44:48 pm
content: If the pwm signal is simple 5V logic, why not use a simple multiplexor? I can build one from one 74HC00 chip!

author: hlavac
author_rank: Frequent Contributor
timestamp: April 24, 2013, 01:35:53 pm
content: This iswhat you need.

author: Rufus
author_rank: Super Contributor
timestamp: April 24, 2013, 04:17:14 pm
content: Quote from: hlavac on April 24, 2013, 01:35:53 pmHe needs one of the signals to pass to the output when there is no power supplied to his circuit. That is the real problem.

author: hans
author_rank: Super Contributor
timestamp: April 25, 2013, 12:07:16 pm
content: Quote from: kxenos on April 22, 2013, 08:33:00 pmThis 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..)Quote from: croberts on April 22, 2013, 08:43:23 pmI 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.

author: croberts
author_rank: Regular Contributor
timestamp: April 25, 2013, 12:39:09 pm
content: Quote from: hans on April 17, 2013, 05:37:54 pmHello hansThe 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.

author: hans
author_rank: Super Contributor
timestamp: April 25, 2013, 03:24:22 pm
content: Maybe I forgot to mention some thingsWe 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, 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.

author: croberts
author_rank: Regular Contributor
timestamp: April 25, 2013, 03:33:08 pm
content: Quote from: hans on April 25, 2013, 03:24:22 pmHello hansI 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.

author: croberts
author_rank: Regular Contributor
timestamp: April 25, 2013, 05:29:05 pm
content: 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.

author: hans
author_rank: Super Contributor
timestamp: April 25, 2013, 09:16:24 pm
content: 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