Physically (electronically) separating two input sources to one servo

I am pondering over the problem, where I have one servo, and two input sources controlling it at different times. How to I decouple the signals electronically?

A servo has to be controlled by two controllers, depending on the state of the machine.
One source is manual mode. The other is auto mode.

Both PWM signals are within the 5V range.

I'd like to avoid relays.
The two controllers share the Vcc and ground rails. But the PWM comes from either controller A or controller B. [edit1] The controllers are separate from each other. One is on, the other off, and vice versa.[/edit1]

While I have controlled a lot of things one-on-one, I never worked with this scenario.

Any hints appreciated.

You may be approaching this the wrong way.

Connect only one output pin to the servo and each input to a separate input pin. You can then use the sketch to control which input signal is passed to the output pin

How does the Arduino detect which mode it is in?

Apologies if I wasn't clear enough. I edited my original post saying:
The controllers are separate from each other. One is on, the other off, and vice versa.

The controllers just happen to actuate the same servo.

There are two controllers, each driving one servo at dedicated times.

----------
|  uC A  |-----
----------     |
               --------| servo |
----------     |
|  uC B  |-----
---------- 

uC A: The Arduino controls the machine.
uC B: The second controller is a remote receiver

bool auto_on in uC A determines whether uC A should be "quiet', while uC sends the PWM.

My concern is that if I physically connect the PWM outputs from uC A and uC B that some interference may happen. Hence, the query: how can I electronically separate the signals.

Yes, one pin to the servo from uC A.
I do not want to read a PWM from uC B into uC A and do whatever processing to pass the signal through. Then I rather use relays :slight_smile:

The machine has six servos. I am sure there is a better way; e.g., two transistors of sort?! [edit1]Or a multiplexer?

I am comfortable to switch two inputs to one output via software, e.g., AND, OR, etc. I am after physically separating one input from the other.
Please ask further questions, if this is not clear.[/edit1]

Yes.

I googled

 arduiono demultiplexer module

and see this

Which looks plausible. You may find 8 to 1, or 4 to 1. There are ICs, dunno about convenient modules. Look around.

HTH

a7

Genius! :slight_smile:
Reading the description made it clear that this is the type of device I am looking for.
The googled for 2 to 1 and found this guy:

This is 2 to 1 in a package of 4.
Two of these and my problem has been solved.

sometimes we need third party input to get the 'brain block' out of the way. Thanks :slight_smile:

Good, I like to work with ICs directly when I can, and not only because I am cheap. :wink:

You might have less wiring and trouble with an 8 to 1 unit, I have not used any in so long but they come in all lengths or sizes, whatever you call it.

a7

How about a Schottky diode on each Arduino output and a 10k pulldown (if needed) on the servo signal line?

If the inputs are connected to separate pins then they will be separated from one another so I don't see the problem

But why would you actually design something in that manner? :crazy_face:

These are two systems.

One controller replaces the wiring harness and mechanical operating components of the mower. [manual mode]
The mechanical linkages are severed.
The inputs will have encoders.
The mechanical actuators will be driven by servos.
I am almost done coding the original functions.

The other system is a flight controller (ArduPilot Rover) running on pixhawk, with yaw GPS. [automation]

The aim of my OP is to have the servos driven by [manual mode] XOR [automation].

Ideally the [manual mode] controller can be completely switched of, and automation takes over.

Lacking the experience in the design of the PWM switching, I am asking how to best achieve this.

I do not know, what happens when I connect two PMW outputs to one servo, when one of the outputs is 'switched off', not present, or whatever voltage it has if any, or what else it could do to interfere.
Why I want to switch between the two PWM sources, without using mechanical switches.

The multiplexer appeared to me as a proper solution.

I am more than happy to be educated of better ways for achieving the desired outcome.

That is not what you do

  • You connect the servo to an output pin as usual. It does not need to be a PWM capable pin
  • you connect the manual output to an input pin
  • you connect the automatic output to a second input pin
  • the sketch reads from both inputs, but outputs only the selected one to the output pin

Selection of which input to be sent to the output could be done in a number of ways, including detecting that there is no input from the manual mode controller causing the automatic input to be selected to be output and vice versa

1 Like

Say OR instead of XOR and I don’t see why a simple OR gate won’t do what you want.

You may need some simple electronics, but switched off system should present as logical zero or false or low.

Many ideas presented assumed that there would be servo signals present from two locations, running at all times, and one to be used.

You have repeat claim that by design only one line will actually have a signal. Somewheres above there are a few solutions that operate using this very convenient constraint.

A few diodes was one, I think.

We all like the more complicate solutions, natch. But you do not need them it seems.

a7

1 Like
x  y  (x or y)  (x xor y)
0  0     0          0
1  0     1          1
0  1     1          1
1  1     1          0

I want XOR :slight_smile:
One or the other, not both.

But yes, you're right... a PWM signal form one source, not both.

So if a switched off system presents itself as zero, low or false, then diodes may well do the trick, to prevent the live signal to be grounded.
I think I have to go and experiment.

I can see the option of the [manual] controller to be on, routing the signal as @UKHeliBob suggested; whether I use the pins or control a multiplexer or not.

You have said repeatedly and missed many opportunities to correct the impression you gave that

one and only one signal would be active at any time.

So OR.

Do we yet have it wrong?

XOR will work, but diodes make an easy OR gate...

a7

Look, I appreciate every input :slight_smile: and if I could have described it better, I apologise for not having done so.

I understand that we have to be not only precise, but very precise, and hence, appreciate you pointing out that my OP may not have been as clear as some would like.

So to be explicit:

  1. there is one dedicated controller operating the machine's functions (in essence replacing physical controls with electronic ones)
  2. there is an [automation] controller, taking full control over the machine.
  3. The controllers, while independent, control the same servos
  4. the option (A) exists to have the manual controller routing the automation PWM signals to the servos
  5. the option (B) exists to have a more passive routing scheme, which can operate with one controller at any given time.

Not sure, whether this is any better. I hope it makes it clear, compared to my original statement: "I am pondering over the problem, where I have one servo, and two input sources controlling it at different times. How to I decouple the signals electronically?"

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.