Choosing a physical layer for a custom serial communication protocol.


I've designed a serial communication protocol after a thorough review didn't find any that were suitable. One of the main points of it is its robustness, however I'm having difficultly with a couple of options for the physical layer.

The cable will only be carrying DC signals (and assuming the cable allows it, power as well), but I'm wanting to make sure that EMI interference is minimal. I'm aware that spacing from an AC power line is the best option (and will be followed), I'd like to make sure that signal integrity is kept as high as possible by designing the most suitable physical layer.

My options are:

  1. Use standard screened multicore cable of a good guage (18 - 20) AWG, and use something such as 0-12VDC for a low and 36-48VDC for a high. I've looked high and low for various suggestions, calculations etc. But I'm at a loss as to how much EMI an 50hz AC cable carrying x current can affect another cable for a certain length at parallel. I am assuming that using such high voltages would remove any potential for EMI to negatively affect the signal.

  2. Use a something such as a Cat6a cable which has shielding along with twisted pair. A positive aspect to this is that I'm using a differential and twisted pair. However, I can find mountains of interfaces that can handle the physical layer of ethernet etc. but I'm wanting a transciever that can handle abeing given a logic level voltage spit out a differential signal to two wires, or take those two signals and output a digital high or low.

If somebody has any suggestions I'd appreciate them.

Take a good look at RS-485 - that was designed for dealing with all sorts of stuff like that.

Hello. :slight_smile: Yes, I did look at RS-485 however there will be 50+ devices attached to the bus and slaves must be able to initiate communication. From what I've gathered, RS-485 doesn't handle either of these cases very well.

What distances are you looking at? I2C is good for what you ask for but distance must be short, like centimeters. You can get I2C bus extenders to go up to 20ft total length. However the software on the Arduino can't handle multi-master mode.

This sounds like a job for Ethernet. If you look inside the conventional Ethernet socket, you find it is full of "magnetics" which are very good at isolating the circuit board from any crap on the long wires. However a single Ethernet segment is limited to 100m due to propagation speed and packet size. Fortunately switches are available very cheaply to split segments and you can even go to fibre optic for long-haul between buildings.

If you must stick with serial, then you probably need to have a bus master which polls the slaves to ask them if they have anything to say. Modbus over RS485 is pretty well known and reliable.

Distances will be approximately 120 meters round trip so ethernet with switches would be just fine. To be honest, I really did fancy ethernet as there are plenty of cheap modules that can easily interface with just about any microcontroller, and the concept of having it run alongside the standard networking is wonderful... The only thing that turns me off ethernet is not being able to daisy chain and having to run a cable from every device back to a switch or a router...

Are you aware of any module capable of running ethernet as a daisy chain?

CANBUS is an excellent choice given the constraints you've provided.

Ethernet actually is a daisy chain. But it turns out that the best way to wire it up is “structured cabling” which means each device has one cable going back to a wiring closet. This cable actually has an “up” and a “down” wire so that your device has a complete loop that participates in the chain.

Otherwise if you take a machine out of the chain, re-joining the chain is always an issue. If you unplug your computer from structured cabling, it doesn’t affect any other. The hub or switch detects this and routes around the gap.

Ethernet actually is a daisy chain.

There is NO form of ethernet that is a "daisychain."

ThickNet and ThinNet were broadcast over coax cable.
The twisted-pair ethernets are proper "star" topologies with separate active circuitry to each host (and frequently actual "switching" code that only routes appropriate packets to each port.)
(This has the unfortunate effect that it's quite difficult to use ethernet as a "local" interconnect.)

Token rings were actual daisychains (and Good Riddance!)

(I see that there are some (one?) published circuit for a 3-port “passive ethernet hub” that might fit the “daisychain” description. That’s NOT the way it’s supposed to be done!)

The WIKI entry on daisy chaining that says "Ethernet" is daisy chained just wrong. In fact, there is no mention of daisy chaining in the Ethernet Wiki entry.

Ethernet as we know it (Ethernet over twisted pair) is a star topology.

Ethernet is quite robust actually (assuming you are using TCP where it is "did you get my message and is it correct" vs UDP which is "I sent it and don't care if you are listening or not"). TCP typically also handles collision and error detection/correction without a lot of overhead from the processor that is talking to the interface board. It also allows everybody on the net to initiate a conversation as appropriate (and deal with collisions which will happen if you have more than one device capable of initiating a connection).

Ethernet used to be forbidden on the factory floor because it doesn't provide guaranteed timely delivery. Now everything is Ethernet and the manager is asking why his new thousand-tonne machine can't be connected via wifi to save a few bucks running an Ethernet cable.

Ethernet used to be forbidden on the factory floor because it doesn't provide guaranteed timely delivery. Now everything is Ethernet and the manager is asking why his new thousand-tonne machine can't be connected via wifi to save a few bucks running an Ethernet cable.

Yeah, I've had my experiences over the years where the manager comes running up with some trade journal open to some full page ad that says it will "solve all their problems at a low cost" wanting to know why we are not doing it that way. For some reason they know better than to believe (they do don't they???) the "but wait there's more" late night TV ads, but don't understand the same ad people write the full page ads in the trade journals (often the parts being advertised are not even available yet - been down that path a few times!!)

Note that you can “daisy chain” ethernet switches; that’s different than daisy-chaining the ethernet itself. Since a switch is an electrical and link-level termination of each ethernet, you’re not even limited to the normal ethernet length restrictions, and 120 meters between “most distant” nodes should not be a problem.
You’d have to decide whether a strict daisy chain (upstream, downstream, host) or a chain of stars (upstream, downstream, n*host) makes more sense, but don’t forget that a modern single-chip ethernet switch (< $20 for 4-8 ports), plus all the RJ45 cables to connect them up, is still going to be MUCH cheaper than the old bus-topology 10base2 thin-net + coax (I can find used single transceivers for about $20. Much higher for new, and it raises the cost of the host hardware as well. if you can find any!)

TCP typically also handles collision

Ethernet handles packet collisions (two systems trying to transmit at the same time) without having to involve TCP at all.