Maker Pro
Maker Pro

Bidirectional Data Line Circuitry

Lee.J.Baxter

Jan 13, 2014
14
Joined
Jan 13, 2014
Messages
14
Hi,

Excuse me if my terminology is a bit off; it's been a while since I've done any serious Electronics!

Anyway, I'm working on a project that requires a bidirectional flow of data; the problem is my connectors will need to be exactly the same, requiring exactly the same pinouts. The connectors will exist as surfaces with concentric-ring-shaped contacts.

So lets say I design my connectors to transmit 8 parallel bits of data between devices; this connector would therefore have a circle-shaped contact in the center (for ground), and 8 concentric ring-shaped contacts (for each bit of data). So in both devices, the innermost ring will be used to transmit the LSB, whereas the outermost ring will be used to transmit the MSB.

Here's the big problem; the 2 devices will be completely unaware of each other, and can't be set up in a master-slave configuration; in other words, the connector must allow bits to flow in both directions in an asynchronous manner, using only one contact for each bit.

An initial idea I had was to use a pull-up/pull-down resistor pair on the data pin, where each resistor has the same value. If we use a voltage of 5V on each device, this should mean that if device A is sending a '1' to device B, and device B is sending a '0' to device A at the same time, then the voltage at the pin will be 2.5V (as the pull-up resistor on device A and pull-down resistor on device B should act as a potential divider).

This, however, is not sufficient for my project, as a device should also be able to tell whether there actually is another device connected to them. In the circuitry designed above, this wouldn't be possible (we wouldn't be able to distinguish whether there's no device attached, or the other device is simply sending the same bit).

Please could somebody help with this? Ideally, I'm looking for a solution on a chip, but I'll make do if I need a complex circuit to achieve this.
 

Lee.J.Baxter

Jan 13, 2014
14
Joined
Jan 13, 2014
Messages
14
Adding to my previous post, the ideal solution to my problem would be a circuit with the following inputs and outputs;

Vcc/Gnd - Supply voltage (regulated 5V) and ground.
Detect - High if this device is connected, otherwise low.
DI(N) - Logic level coming in from connected device for bit 'N'.
DO(N) - Logic level going out to connected device for bit 'N'.
D(N) - Connection to contact for bit 'N'.

Both devices will use exactly the same circuitry and connector; in actual fact, the devices will be exactly the same as each other. The idea here is that there is no 'male' or 'female' connector (physically or logically), so a solution is needed that allows the devices to share the same pins for the same functions, and to communicate in an asynchronous fashion.
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
I think it would really help us if you could be more specific and less abstract with your description. How about starting with an overview of the purpose of the project and then get to the details of how the component parts need to behave, and the meaning of the eight bits of data that they need to exchange. Then tell us about what electronic and mechanical parts, if any, you have chosen. Some scanned drawings of your proposed connector and of the overall way things fit together would really help too.

I promise I won't try to steal your idea! (Just in case that's why you're being cagey; we see this a lot here, and I'm never sure why.)

Also tell us what types of technology you can work with. For example, do you program microcontrollers?
 

Lee.J.Baxter

Jan 13, 2014
14
Joined
Jan 13, 2014
Messages
14
I think it would really help us if you could be more specific and less abstract with your description. How about starting with an overview of the purpose of the project and then get to the details of how the component parts need to behave, and the meaning of the eight bits of data that they need to exchange. Then tell us about what electronic and mechanical parts, if any, you have chosen. Some scanned drawings of your proposed connector and of the overall way things fit together would really help too.

I promise I won't try to steal your idea! (Just in case that's why you're being cagey; we see this a lot here, and I'm never sure why.)

Also tell us what types of technology you can work with. For example, do you program microcontrollers?

Hi KrisBlueNZ,

The project I'm working on is a sort of modular robot in the shape of a cube. Each cube will be exactly the same, and will be able to electromagnetically couple to other cubes.

The 6 faces of each cube will contain a pattern of small electromagnets that allow 2 cubes to connect, disconnect, and rotate against each other (the latter will be acheived by switching the magnets on/off in specific patterns, similar to a stepper motor). Of course, the cubes must also communicate somehow, and this will be achieved by a set of concentric ring-shaped contacts in the center of the face; the contacts are in this shape to insure that the connections line up no matter what angle the faces are twisted against each other.

Now, the problem I'm going to come up against is that, due to the nature of the cubes, their faces are exactly the same (including the pattern of electrical contacts); this means the contacts will have exactly the same pinout. For example, usually for a serial connection you'd connect Rx to Tx and Tx to Rx; this isn't possible on the cubes, as the Tx line for one of the cubes would be in contact with the Tx line for the other (and the same with the Rx line). This means each data line will need to work bidirectionally on a single pin. By extension, there can't be a slave/master mode of communication, as all cubes will be the same (i.e. there is no "master" or "slave" cube).

I'll try to knock up a sketch or something later on if you're struggling to imagine how the cubes will work. I have knowledge of microcontroller programming, and have done A-level Electronics at college; I'm just a little rusty!!! :)
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
Thanks Lee for that description. It really helps to have an idea what we're talking about!

Do you intend to mechanically attach the cubes to each other? Or will you only use electromagnetism?

Do you think it might be a good idea to do the communication electromagnetically as well? That would avoid the need for intimate contact between surfaces and avoid disturbing the communication as the surfaces move against each other. I'm thinking perhaps a small inductor, say 100 µH, on a ferrite bobbin or stick with its end stuck to the inside of the centre of the face. You should be able to get at least 10 kilobits per second data transfer, using perhaps FSK with frequencies around 100 kHz. That's just a guess really. Communication would probably have to be half duplex. You might find the kind of modems used for power line carrier in home automation products would be a good fit. I'm just throwing out ideas here.

No matter how you communicate between the cubes, you are going to run into the problem of detecting a cube and negotiating for communication. I haven't done this before but a Google search will probably find material that analyses the issues and suggests approaches.

I haven't done this sort of thing before. Does anyone else here on Electronics Point have relevant experience?
 

Lee.J.Baxter

Jan 13, 2014
14
Joined
Jan 13, 2014
Messages
14
Thanks Lee for that description. It really helps to have an idea what we're talking about!

Do you intend to mechanically attach the cubes to each other? Or will you only use electromagnetism?

Do you think it might be a good idea to do the communication electromagnetically as well? That would avoid the need for intimate contact between surfaces and avoid disturbing the communication as the surfaces move against each other. I'm thinking perhaps a small inductor, say 100 µH, on a ferrite bobbin or stick with its end stuck to the inside of the centre of the face. You should be able to get at least 10 kilobits per second data transfer, using perhaps FSK with frequencies around 100 kHz. That's just a guess really. Communication would probably have to be half duplex. You might find the kind of modems used for power line carrier in home automation products would be a good fit. I'm just throwing out ideas here.

No matter how you communicate between the cubes, you are going to run into the problem of detecting a cube and negotiating for communication. I haven't done this before but a Google search will probably find material that analyses the issues and suggests approaches.

I haven't done this sort of thing before. Does anyone else here on Electronics Point have relevant experience?

I'm intending to only couple them electromagnetically, as I don't want them to stick, plus I'm after surfaces that exactly the same in structure (so any cube face can attach to any other cube face).

Doing the communication via electromagnetism may be a good way to go; as long as the cubes can communicate bidirectionally, I'm happy.

As for negotiating, I was thinking maybe I could incorprate some kind of protocol where the 2 cubes throw out a random number, and whichever gets the highest communicates first or something.
 

jpanhalt

Nov 12, 2013
426
Joined
Nov 12, 2013
Messages
426
Sounds like an interesting toy.

The first thought I had in reading your description was "three-state." In other words, adding a state that is neither high nor low. If you have access to Horowitz and hill (2nd ed.), the decription begins on page 487, is brief, and compares it to open collector designs.

If you don't have H&H available, here's a link to another discussion: http://cpuville.com/three_state.htm

John
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
As for negotiating, I was thinking maybe I could incorprate some kind of protocol where the 2 cubes throw out a random number, and whichever gets the highest communicates first or something.
I think the problem is messier than that. A cube doesn't know when another cube might be trying to transmit to it. When the cube isn't connected to another cube on a particular face, it can transmit a short "I'm here" message at irregular intervals, for example with each delay chosen randomly between 0.1 and 0.2 seconds, while watching for a received message with good signal strength. As soon as a cube receives a valid "I'm here" message from another cube, it would respond immediately, and communication can proceed from there.

Ideally the random delays should be randomised using a real-world input - for example, an accelerometer or vibration detector, to give some real element of randomness.

When cubes are communicating, they could exchanage messages constantly, so that the protocol can detect diminishing signal strength before communication is lost, and perform a proper disconnection.

It might be useful for each cube to have a unique identification number. This would be stored in EEPROM inside the microcontroller. I don't think it would be necessary though.

These are just ideas. As I said, you can probably find documents addressing these sorts of problems and offering tested solutions.
 

Lee.J.Baxter

Jan 13, 2014
14
Joined
Jan 13, 2014
Messages
14
I think the problem is messier than that. A cube doesn't know when another cube might be trying to transmit to it. When the cube isn't connected to another cube on a particular face, it can transmit a short "I'm here" message at irregular intervals, for example with each delay chosen randomly between 0.1 and 0.2 seconds, while watching for a received message with good signal strength. As soon as a cube receives a valid "I'm here" message from another cube, it would respond immediately, and communication can proceed from there.

Ideally the random delays should be randomised using a real-world input - for example, an accelerometer or vibration detector, to give some real element of randomness.

When cubes are communicating, they could exchanage messages constantly, so that the protocol can detect diminishing signal strength before communication is lost, and perform a proper disconnection.

It might be useful for each cube to have a unique identification number. This would be stored in EEPROM inside the microcontroller. I don't think it would be necessary though.

These are just ideas. As I said, you can probably find documents addressing these sorts of problems and offering tested solutions.

It looks like the bidirectional asychronous line part isn't going to be a problem; I'm essentially using a potential divider to set the signal on the data line (Vdata) to 5V (if both cubes are outputting 5V), 2.5V (if one cube is outputting 5V and one 0V), or 0V (if both cubes are outputting 0V). I've designed this section of the circuit and everything works (and my design should mean the circuits don't interfere with each other; sorry for bad terminology again!). I'll then derive Vin by comparing Vout to Vdata (I'll essentially reverse the potential divider calculation using op-amps).

The problem is the connection detection circuit, which I'd rather achieve by an additional pin on the connector rather than as part of the communication protocol if possible. This one's a real head-scratcher!!!
 

Lee.J.Baxter

Jan 13, 2014
14
Joined
Jan 13, 2014
Messages
14
It looks like the bidirectional asychronous line part isn't going to be a problem; I'm essentially using a potential divider to set the signal on the data line (Vdata) to 5V (if both cubes are outputting 5V), 2.5V (if one cube is outputting 5V and one 0V), or 0V (if both cubes are outputting 0V). I've designed this section of the circuit and everything works (and my design should mean the circuits don't interfere with each other; sorry for bad terminology again!). I'll then derive Vin by comparing Vout to Vdata (I'll essentially reverse the potential divider calculation using op-amps).

The problem is the connection detection circuit, which I'd rather achieve by an additional pin on the connector rather than as part of the communication protocol if possible. This one's a real head-scratcher!!!

Okay folks, I think I may know how to achieve what I set out to do using op-amps; imagine a circuit consisting of a non-inverting amplifier, where the junction between the 2 resistors goes to a pin on the contact surface. Now, when this pin is connected to the same pin on a copy of this circuit, R1 will halve (as the coupling will cause these resistors to connect in parallel; the ground connections on the circuits will be connected too), whereas R2 will remain the same, in turn adjusting the gain of the op-amps on both circuits; all I'd need to do is look at the output of the op-amp in order to determine whether the cube face is connected to another! I'll try it out tonight when I get back, and I'll be sure to post an image of the complete circuit if it works!!!
 

Lee.J.Baxter

Jan 13, 2014
14
Joined
Jan 13, 2014
Messages
14
Okay folks, I think I may know how to achieve what I set out to do using op-amps; imagine a circuit consisting of a non-inverting amplifier, where the junction between the 2 resistors goes to a pin on the contact surface. Now, when this pin is connected to the same pin on a copy of this circuit, R1 will halve (as the coupling will cause these resistors to connect in parallel; the ground connections on the circuits will be connected too), whereas R2 will remain the same, in turn adjusting the gain of the op-amps on both circuits; all I'd need to do is look at the output of the op-amp in order to determine whether the cube face is connected to another! I'll try it out tonight when I get back, and I'll be sure to post an image of the complete circuit if it works!!!

Just a quick question regarding the design of my circuit; for both the bidirectional data line circuitry, and the connection detect circuitry, I need an amplifier that can perform a weighted subtraction (i.e. Vout = (a * V2) - (b * V1)); can this be done with a differential amplifier?

For example, in theory I should be able to do "Vout = (2 * V2) - V1" by setting R1=Rf and R2=0 (no resistor present), where Rg can be any value. I got the calculation for Vout from Wikipedia.
 

Arouse1973

Adam
Dec 18, 2013
5,178
Joined
Dec 18, 2013
Messages
5,178
Can you supply a drawing of your circuit? That really help with visualising what you want to do and we can also see what devices you are planning on using and how you have them connected.
Adam
 

Lee.J.Baxter

Jan 13, 2014
14
Joined
Jan 13, 2014
Messages
14
Can you supply a drawing of your circuit? That really help with visualising what you want to do and we can also see what devices you are planning on using and how you have them connected.
Adam

Unfortunately I couldn't get all of the circuitry done last night; most of my time was spent fiddling around to get op-amps to work!

I'm using Yenka to design and simulate my circuitry, but I don't think that makes any difference to my dilemma. Is it possible to create a non-inverting amplifier from a 324 op-amp that can output right up to the power supply level; it seems that my amplifier's output saturates at about 1.5V below my power supply voltage (e.g. if I supply 5V to the op-amp, it can only output a maximum of 3.5V)?
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
BTW I suspect contacts are not going to be a workable solution here, and in any case you would be better to start from an overview of the requirements and work downwards towards the implementation details instead of starting by focussing on one aspect of the implementation; it's easy to paint oneself into a corner and then have to throw away all the time spent.

Right, the LM324 will not pull up to closer than about 1.5V below the positive rail. Also it will not pull all the way to 0V. There are "rail-to-rail output" op-amps that will pull fairly close, if not heavily loaded. Check out manufacturers like Analog Devices, Linear Technology, Maxim, Microchip, ON Semiconductor and Texas Instruments. Or use Digikey's selection guide; it will do most of your work for you!

There may be other options. For example, it may not be necessary to use a full 5V swing - you could just define the signal as using a 3V range instead. Or if the signal only needs to be high/low, instead of analogue, you can use something else to drive it - for example a 74HC gate, possibly with a series resistor. If you can post a schematic of your current ideas, we may be able to suggest something.
 

Lee.J.Baxter

Jan 13, 2014
14
Joined
Jan 13, 2014
Messages
14
BTW I suspect contacts are not going to be a workable solution here, and in any case you would be better to start from an overview of the requirements and work downwards towards the implementation details instead of starting by focussing on one aspect of the implementation; it's easy to paint oneself into a corner and then have to throw away all the time spent.

Right, the LM324 will not pull up to closer than about 1.5V below the positive rail. Also it will not pull all the way to 0V. There are "rail-to-rail output" op-amps that will pull fairly close, if not heavily loaded. Check out manufacturers like Analog Devices, Linear Technology, Maxim, Microchip, ON Semiconductor and Texas Instruments. Or use Digikey's selection guide; it will do most of your work for you!

There may be other options. For example, it may not be necessary to use a full 5V swing - you could just define the signal as using a 3V range instead. Or if the signal only needs to be high/low, instead of analogue, you can use something else to drive it - for example a 74HC gate, possibly with a series resistor. If you can post a schematic of your current ideas, we may be able to suggest something.

I'll draw up what I have so far and post it tonight. :)
 

Lee.J.Baxter

Jan 13, 2014
14
Joined
Jan 13, 2014
Messages
14
I'll draw up what I have so far and post it tonight. :)

Okay, I've attached what I have so far. The circuitry works by both faces have Gnd and DataAB connected to each other; OutA is the outgoing signal, and InA is the incoming signal (the OutA of the other face).
 

Attachments

  • Bidirectional Data Circuitry.png
    Bidirectional Data Circuitry.png
    9.8 KB · Views: 124

Lee.J.Baxter

Jan 13, 2014
14
Joined
Jan 13, 2014
Messages
14
Perhaps the attached image is a bit easier to understand. On the left side of the image is the circuitry of device A, and on the right we have device B (note the circuitry is exactly the same).

To connect the 2 devices, the Ground lines are connected, and the DataAB lines are connected. OutA is the output of device A, InA is the input of device A (the output of device B), OutB is the output of device B, and InB is the input of device B (the output of device A).
 

Attachments

  • Bidirectional Data Circuitry 2.png
    Bidirectional Data Circuitry 2.png
    15.6 KB · Views: 124

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
If you use 74HCxx devices instead of 74LSxx you will save a LOT of power and you will be able to drive R1 directly from a gate output.
 

Lee.J.Baxter

Jan 13, 2014
14
Joined
Jan 13, 2014
Messages
14
If you use 74HCxx devices instead of 74LSxx you will save a LOT of power and you will be able to drive R1 directly from a gate output.

Thanks, I'll do that! Anyway, this circuit (as long as it works as it does in the simulation) solves the problem of sending digital data in both directions simultaneously (without collisions).

Now I still have the problem of creating circuitry that can actually detect whether the devices are connected to each other. To recap, I need circuitry that doesn't involve a "crossed" connection between devices (I can't, for example, connect Tx to Rx and Rx to Tx). The only thing I can think of, at this point, is to fit both contact surfaces with mechanical push-buttons, but I'd prefer a solution that works with no mechanical element to it (so that it can't be fooled, for example, by somebody pushing the contact manually).

So far, when the devices are connected, I'll have 4 connected pins between the identical devices; ground, data, request and acknowledge. Data, request and acknowledge will use copies of the previously-posted circuitry. Again, to recap, the contacts will consist of concentric copper rings (separated by plastic insulation) that mate against the same ring on the connected device; the ground connection will be in the middle, followed by the data pin (ring), the request pin (ring), and the acknowledge pin (ring).
 

gorgon

Jun 6, 2011
603
Joined
Jun 6, 2011
Messages
603
I think you are making this a bit too complex. The simplest way would be to make an Interface With 2 independent multidrop lines. Each line needs to be bidirectional in nature. You then need a handshake algorithm to establish communication when connection happens, and define the direction of each signal. This will also generate a 'connected' status.
In your proposed Interface this will only need 3 'rings', 2 data and GND.

I'm refering to lines here, but they could be whatever medium you want, like wires, Optical or induction.

If you really need a separate 'connected' indication, you could do this the same way.

You specify that you have 4 signals, GND, data, request and acknowledge. I'm a bit confused by how you want to configure the the physical connection, if the requirement is for them to be identical. This mean 'request' to 'request' and 'ack' to 'ack'.
In addition,1 dataline makes it a bit messy to generate a full duplex connection.

A 'full duplex' connection is simultaneous both ways.

A last question. If this is for a cube, does it indicate that you plan to have 6 different Interfaces on each cube?
 
Top