# Logic circuit to give "priority" to a specific (PWM) signal?

Hi, I want to implement sort of a kill switch, so i have two sources, one that's regularly providing a signal (to an ESC) and another one that whenever it's present, should have priority over the other.

Something like this: IF (SIGNAL-1) THEN CHOOSE(SIGNAL-1) //the priority/emergency signal ELSE IF (NOT SIGNAL-1 AND SIGNAL-2) THEN CHOOSE(SIGNAL-2)

I think I found once the design of a relatively simple circuit that did this switching, but i can't find it again and i don't know what exactly to google for.

The components I have in my disposal are AND,OR,NOT gates, NPN and PNP transistors among others...

Any ideas? The logic formula or even some sketch with the gates and their connections, would be great! :)

Thanks!

Something like this: IF (SIGNAL-1) THEN CHOOSE(SIGNAL-1) //the priority/emergency signal ELSE IF (NOT SIGNAL-1 AND SIGNAL-2) THEN CHOOSE(SIGNAL-2)

Logically that is a nonsense. This is because your signal-1 can be high or low and therefore there can never be "not present".

You have to define much more closely what your signals are. You can detect the non presence of a PWM signal with a missing pulse detector made from a re-triggering monostable. But you can not detect the non presence of your signal 1 unless you define more closely what "not present" means.

Grumpy_Mike: unless you define more closely what "not present" means.

LOW i suppose (could make sure it is, using some pull down resistors i guess)

So just to be clear. When signal 1 is low the output is the PWM input signal 2 and when the signal 1 is high the output is?

Alright, I created the truth table for the logic I am trying to explain. I hope that will be clear enough. Sorry that it’s a PDF but I’m on my phone at the moment and I couldn’t find a way to turn it into a picture.

Edit: I guess the first line of the truth table can be also written as “DON’T CARE”.

truth-table.pdf (4.47 KB)

Sorry that is not the way of making a truth table. The way you have drawn it does show an ambiguity.
Line 2 you show the output as being B.

Try the attached circuit.

Data select.pdf (13.5 KB)

Grumpy_Mike:
Sorry that is not the way of making a truth table. The way you have drawn it does show an ambiguity.
Line 2 you show the output as being B.

hmm, can you explain why is there an ambiguity there?
From how I see it, if the HIGH PRIORITY input is LOW, then the LOW PRIORITY signal should be the output.

So, will that specific circuit realize the behavior i intend (or at least the one i tried to describe in the truth table)?

Because I am going through it right now and i don’t understand how it should work.
From what I understood “PWM” on the sketch is my LOW-PRIORITY signal and the OVERRIDE is my “HIGH-PRIORITY” signal, correct?

So if that’s correct, i don’t see how if both of them are LOW, the final output will be LOW as well. Or how if both of them are HIGH, then i specifically get the “OVERRIDE” or “high priority” signal as the output.

So, will that specific circuit realize the behavior i intend (or at least the one i tried to describe in the truth table)?

As your truth table was ambiguous that circuit will do what I think you want rather than what you asked for because as I said what you asked for was not logically consistent.

Basically it is a data select switch which your override signal controls. In one state it feeds through a logic one in the other state it lets the other signal through.

However as you have not supplied a proper truth table it is hard to say. The output of your truth table must be either a zero or a one, if you can not draw one like this then you can not implement your required function because it is not logical.

Isn't this a really common problem in Radio Control? You want the servo to do something when the radio is disconnected. There must be thousands of modules available to do this. More googling is required.

I'm still confused (what's new?)...

First point. The "servo" signal for an ESC varies constantly between 5v and 0v - the only way to know if it has stopped is to check, over a period of time, that no pulses are coming - which could happen with the line HIGH or LOW.

Second point. What needs to happen for the principal signal to fail?

If the signal is being generated by an Arduino directly connected to the ESC you will have a really serious problem if the signal fails and some secondary system is unlikely to be a solution.

If the signal is coming via wireless to the Arduino for "onward" transmission to the ESC - again assuming the Arduino is directly connected to the ESC - why can't the Arduino be programmed to continue a "get-you-home" signal if the wireless signal is not detected.

...R

Grumpy_Mike: Basically it is a data select switch which your override signal controls. In one state it feeds through a logic one in the other state it lets the other signal through.

Well, ok this sounds like my intended behavior. Thanks! So just recreating this should do what i need it to do.

By the way, how should the truth table be? How would i show that i need "this specific signal" to pass through?

MorganS: Isn't this a really common problem in Radio Control? You want the servo to do something when the radio is disconnected.

Well sort of. In particular I want to do the opposite. To do something when the radio is connected. (it usually does something autonomously) The thing is, that i did not know "what" to google (in other words whatever i tried didn't give me any useful results).

How would i show that i need "this specific signal" to pass through?

By putting the high and low of the signal input and having the output as high and low on the output. As I said if you can't do that then you haven't got a proper logic system that can be implemented.