Is there a way to split a single wire serial communication to two wires?

Hi. I am using Arduino to investigate a single wire, bidirectional serial communication between two devices. (They are a servo and a servo programmer.)

I used the SoftwareSerial example sketch at https://docs.arduino.cc/tutorials/communication/SoftwareSerialExample to read the serial data and then output it to the serial monitor.

The problem is, I am getting the serial data from both devices, and I don't know which is which. Is there any way to separate the two signals so that they can still communicate with each other, but I can read the data from each device separately?

Using a 10k resistor, I was able to create a voltage drop in the signal wire, so that with an oscilloscope I could see which parts of the data were from which device. What I would rather do is receive the data on two different pins, so the arduino knows which is which, and so I can plot them on two different oscilloscope channels. Do you have any ideas on how to separate the signal like this?

Thank you for any suggestions!

Well, since with normal Serial, you have two separate wires for bidirectional comms, I presume you're actually looking at "eavesdropping" on something like RS485 half-duplex, where device A talks, Device B talks, etc. etc., and you can't tell from which direction each transmission is coming?

Each device should send a unique identifier in all messages.

To avoid collisions, the device reports only when it is directly commanded to do so, by a controller using the device's unique identifier.

Probably, the easiest thing to do is to

  • record the beginning of a session, both directions, in one Serial Monitor listing.
  • Save that somewhere (notepad will do) by copy and paste (I hope you're in Arduino 1.x.x)
  • Disconnect one device, and restart; you'll likely see either no traffic(because one device is waiting to be asked a question), or traffic(as one device is looking for the other). Either way, what you see should be identifiable as either one side of the convo or the other, when you compare it with the first listing.
    Best I can do, unless you actually come back with more details about your real configuration.

Thanks for your help. Camsysca, yes, they take turns on the same wire, like you are saying. Unfortunately, I don't know what protocol is being used, but here is some of the data that I collected using the arduino sketch.

Programmer sends:
255
255
254
2
1
254

Servo sends:
255
255
1
2
0
252

Programmer sends:
255
255
1
4
2
21
1
226

Servo sends:
255
255
1
3
0
0
251

jremington, What you are saying about the unique identifier and only communicating when commanded to do so, it seems to fit with that scheme, right?

When I did what you suggested, Camsysca, the programmer outputs the first 6 byte sequence listed above, even if the servo is not connected. Without the servo being there to respond, the programmer remains silent after that.

I went one step further and used the arduino to mimic the servo or the programmer. I was able to get both devices to respond to the arduino for part of the dialogue.

There are only three wires connecting the servo with the programmer: power, ground, and signal. The Tx pin of the programmer's microcontroller is connected to the Rx pin of the servo's microcontroller. (I assume they have them programmed to both send and receive through the same pin.)

This is the datasheet for the programmer microcontroller.
Datasheet - STM8S003F3 STM8S003K3 - Value line, 16-MHz STM8S 8-bit MCU, 8-Kbyte Flash memory, 128-byte data EEPROM, 10-bit ADC, 3 timers, UART, SPI, I²C

This is the datasheet for the servo's microcontroller.
Technical Reference Manual (nuvoton.com)

You wanted to identify which is which, there you go, no? It's no longer clear to me what it is that you want further help with.

Servos I have seen don't usually send data?
So exactly what is your setup?
Can you draw a schematic please.

In effect what you have done is to modulate two signals on a single wire. So to get back the two different signals onto different wires you will have to demodulate the signal. This can be done using two window comparator with different settings to get two signals.

Hi Mike. Thank you for the window comparator suggestion. Provided that I have already used a resistor to make one signal at a different voltage from the other, it looks like that ought to work. I was thinking that I could use diodes or something to separate the two signals, on the idea that they are travelling in different directions, but I couldn't figure out a way of doing that that would actually work.

Camsysca, the servos are unusual in that they can operate as a continuous rotation motor, or as a regular servo. The programmer is used to change modes. I don't have a schematic for either device, the servo or the programmer. There are literally just the three wires connecting them (and also a battery hooked up to the programmer) that's it.

Most servos don't send a signal but these ones do. I was surprised at that because it seems to me that the programmer should be able to tell the servo which mode to operate in without having to get any information back from the servo.

Identifying the two signals was an important step in what I want to do. But I also want to be able to use the arduino to program the servo. That's so the aircraft can change modes in flight: You see, the Gobilda programmer requires a button to be pressed manually. I think I am closing in on that. For that purpose, I don't really need to separate the signal onto two wires, but I want to do it just to learn how.

By the way, here is a link to the programmer.

There is no word anywhere in the link that the servo responds to the controller.

Well it does say:-

In the default mode the servo is able to rotate a maximum of 280 degrees and has positioning feedback.

Interesting I have never come across this sort of thing before, but it does seem a bit of a faff to change modes.

Every servo has its internal position feedback, but I think it is not mean that the servo send this feedback back to controller.

It always Much easier with schematic, photos, datasheets...

In this case yes it is in the servo position mode. See the posted link and data sheet of the servo off the link page.

After identifying which parts of the signal are coming from which source, I was able to mimic the programmer signals using Arduino Leonardo, Software Serial at 76800 bps. I tested the three different servos: torque, speed, and super speed. All three responded to the same input signals and sent the same signals back to the programmer. The servo reply only varies in one spot, where it seems to communicate which mode the servo was in prior to programming. (I wish I could get other information, like the position of the servo!) Here is the entire sequence, in case anyone wants to do this or is just curious:

Programmer Signal #1
255
255
254
2
1
254

Servo Reply
255
255
1
2
0
252

Programmer Signal #2
255
255
1
4
2
21
1
226

Servo Reply (varies depending on mode)
255
255
1
3
0
0 (in continuous mode it is 1)
251 (in continuous mode it is 250)

Programmer Signal #3
255
255
1
4
3
52
0
195

Servo Reply
255
255
1
2
0
252
255

Programmer Signal #4 (for entering servo mode)
255
1
47
3
6
2
30
0
5
0
15
0
45
0
0
0
0
15
3
252
0
0
0
0
65
3
197
0
0
1
255
1
0
2
9
196
1
244
3
232
0
1
0
0
0
0
3
232
0
178

Servo Reply
255
255
1
2
0
252

Programmer Signal #5
255
255
1
4
3
52
1
194

Servo Reply
255
255
1
2
0
252


Programmer Signal #4 (for entering continuous rotation mode)
255
255
1
47
3
6
50
20
0
5
0
10
0
10
0
30
0
0
0
3
255
1
0
0
0
65
3
197
1
244
1
255
0
0
2
6
14
5
170
3
232
0
20
0
0
0
0
3
232
0
153

This is what the whole sequence looks like with the oscilloscope. If a servo is not connected to the programmer, only the Programmer Signal #1 is produced.

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