EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

RS485 - MODBUS or PROFIBUS or ....

Started by eeboarder July 21, 2009
I am going to work on a project involving multiple devices on the same
network(3 or more). One device will have user input and display(master).
The other devices(slaves) will just collect sensory data and possibly
process PID control loops. Data speeds are not a priority(< 1Mbps is okay).


The master will read data from the two slave devices, and it may have to
change manipulate data on the slaves(PID gains are an example).

There may be times when device 2(slave) may need information or data from
device 3(slave).

More devices may be added in the future.



My questions are:
1) Is RS485 a good physical layer for this type of project? 

2) What would be the best communication protocol to use? I only know of
MODBUS and PROFIBUS. Are there any others that would be a good fit given
the very limited requirements listed above?

Thank you.
Also, all devices will be no more that four (4) feet from each other.
On Tue, 21 Jul 2009 18:26:22 -0500, "eeboarder"
<jmeyer@emittechnologies.com> wrote:

>I am going to work on a project involving multiple devices on the same >network(3 or more). One device will have user input and display(master). >The other devices(slaves) will just collect sensory data and possibly >process PID control loops. Data speeds are not a priority(< 1Mbps is okay).
With short distances (tens of meters) and speeds <= 1 Mbit/s the CAN bus would also be OK, especially if there is a lot slave to slave communication.
>The master will read data from the two slave devices, and it may have to >change manipulate data on the slaves(PID gains are an example). > >There may be times when device 2(slave) may need information or data from >device 3(slave).
One way of implementing this is to let the master read from slave 2 and send it to slave 3 in a separate transaction. In the RS-485 network (Modbus/Profibus DP) the master could also send out read requests sequentially to all slaves, the slave replies with all data it wants to share. The master ignores the response, but all slaves on the RS-485 bus will snoop the response messages from the other slaves and pick the information they need. Of course, this does not work with standard COTS (Commercial, of-the-shelf) slaves and when doing in-house design, a lot of coordination is required to get the network working. In a CAN bus system, each station (master or slave) broadcasts all data each wants to share in up to 64 _bit_ (8 byte) net payloads without centralized bus arbitration. Each node will pick those messages they are interested in, based on the 11/29 bit message ID.
>More devices may be added in the future.
32 nodes is the limit for standard RS-485 transceivers, but this can be extended with repeaters or using 1/2, 1/4 etc. unit load transceiver.
>My questions are: >1) Is RS485 a good physical layer for this type of project?
OK.
>2) What would be the best communication protocol to use? I only know of >MODBUS and PROFIBUS. Are there any others that would be a good fit given >the very limited requirements listed above?
It lot depends if you are designing your own nodes or use off the shelf nodes. Modbus is simple that it does not contain much of the higher protocol layers, so you can implement them as needed on your own. Unfortunately, Modbus is very picky about message framing timing, especially on the slave side, so at 1 Mbit/s, you would in practice need UARTs with the "idle timeout" or hardware timers, with at least a few microsecond resolution. If you want to operate with COTS Profibus-DP devices, you would have to implement much more of the protocol stack, including parameterization. If no COTS devices are used, you can pick just the Profibus-DP framing structure (which is similar to e.g. the framing structure on IEC 60870 series protocols), which is not so picky about timing as Modbus is. If there is a lot of slave to slave communication, in which the master is not interested in, the CAN bus should also be considered. Much of the protocol lower levels are implemented in hardware (usually integrated into some microcontrollers). Paul

eeboarder wrote:
> I am going to work on a project involving multiple devices on the same > network(3 or more). One device will have user input and display(master). > The other devices(slaves) will just collect sensory data and possibly > process PID control loops. Data speeds are not a priority(< 1Mbps is okay). > > > The master will read data from the two slave devices, and it may have to > change manipulate data on the slaves(PID gains are an example). > > There may be times when device 2(slave) may need information or data from > device 3(slave). > > More devices may be added in the future. > > > > My questions are: > 1) Is RS485 a good physical layer for this type of project? > > 2) What would be the best communication protocol to use? I only know of > MODBUS and PROFIBUS. Are there any others that would be a good fit given > the very limited requirements listed above?
Apparently you are the student who doesn't have the slightest clue neither about the hardware nor about the software. The project is supposed to operate at the tabletop conditions. Is that right? For that reason, the best approach for you would be stick to the evaluation boards that you are going to use, and implement whatever interfaces they have already. Most likely it is going to be RS-232, SPI or I2C. So, you can do the ring topology over RS-232, or star topology over I2C or SPI. As for the protocol, most practical solution is to roll your own. There is no point for you in messing with MODBUS or PROFIBUS other then for the educational purpose. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
Vladimir Vassilevsky wrote:
> > > eeboarder wrote: >> I am going to work on a project involving multiple devices on the same >> network(3 or more). One device will have user input and display(master). >> The other devices(slaves) will just collect sensory data and possibly >> process PID control loops. Data speeds are not a priority(< 1Mbps is >> okay). >> >> >> The master will read data from the two slave devices, and it may have to >> change manipulate data on the slaves(PID gains are an example). >> >> There may be times when device 2(slave) may need information or data from >> device 3(slave). >> >> More devices may be added in the future. >> >> >> >> My questions are: >> 1) Is RS485 a good physical layer for this type of project? >> 2) What would be the best communication protocol to use? I only know of >> MODBUS and PROFIBUS. Are there any others that would be a good fit given >> the very limited requirements listed above? > > Apparently you are the student who doesn't have the slightest clue > neither about the hardware nor about the software. The project is > supposed to operate at the tabletop conditions. Is that right? > > For that reason, the best approach for you would be stick to the > evaluation boards that you are going to use, and implement whatever > interfaces they have already. Most likely it is going to be RS-232, SPI > or I2C. So, you can do the ring topology over RS-232, or star topology > over I2C or SPI. > > As for the protocol, most practical solution is to roll your own. There > is no point for you in messing with MODBUS or PROFIBUS other then for > the educational purpose. > > > Vladimir Vassilevsky > DSP and Mixed Signal Design Consultant > http://www.abvolt.com
Since distance is only 4 feet, simplest way is to make a TTL level RS232 wire-or'd bus. Just requires adding an open collector TTL buffer to each transmit line, and resistor pullup. MODBUS wouldn't be a bad starting point.
On 2009-07-22, Rumpelstiltskin <rumpy@abc.biz> wrote:

> Since distance is only 4 feet, simplest way is to make a TTL > level RS232 wire-or'd bus.
Since "TTL level" and "RS232" are mutually exlusive, can you explain what you mean by "TTL level RS232"? -- Grant Edwards grante Yow! I smell a RANCID at CORN DOG! visi.com
Grant Edwards wrote:
> On 2009-07-22, Rumpelstiltskin <rumpy@abc.biz> wrote: > >> Since distance is only 4 feet, simplest way is to make a TTL >> level RS232 wire-or'd bus. > > Since "TTL level" and "RS232" are mutually exlusive, can you > explain what you mean by "TTL level RS232"? >
The output of a UART is TTL. UART output is generally referred to as RS232, though RS232 is really +/-12V interface definition. Don't use the RS232 driver. Use a TTL open collector driver. Something like 74HCT06 or something like that. Maybe 1K pullup. Then all device or'd outputs can coexist on one wire without damaging each other. Then you have 3 wire bus; gnd, tx, rx and don't have to buy expensive RS485 I/O chips.
On 2009-07-22, Rumpelstiltskin <rumpy@abc.biz> wrote:
> Grant Edwards wrote: >> On 2009-07-22, Rumpelstiltskin <rumpy@abc.biz> wrote: >> >>> Since distance is only 4 feet, simplest way is to make a TTL >>> level RS232 wire-or'd bus. >> >> Since "TTL level" and "RS232" are mutually exlusive, can you >> explain what you mean by "TTL level RS232"? > > The output of a UART is TTL. UART output is generally referred > to as RS232,
OK, I see. That usage of RS232 is a new one on me...
> though RS232 is really +/-12V interface definition.
That's what it's always meant to me.
> Don't use the RS232 driver. Use a TTL open collector driver.
Got it. -- Grant Edwards grante Yow! Should I get locked at in the PRINCICAL'S visi.com OFFICE today -- or have a VASECTOMY??
On Wed, 22 Jul 2009 07:28:08 -0700, Rumpelstiltskin <rumpy@abc.biz>
wrote:

>Grant Edwards wrote: >> On 2009-07-22, Rumpelstiltskin <rumpy@abc.biz> wrote: >> >>> Since distance is only 4 feet, simplest way is to make a TTL >>> level RS232 wire-or'd bus. >> >> Since "TTL level" and "RS232" are mutually exlusive, can you >> explain what you mean by "TTL level RS232"? >> > >The output of a UART is TTL. UART output is generally referred >to as RS232,
You misspelled "generally" as "incorrectly." The signal polarity (mark-high versus mark-low) is also flipped and there are a number of other constraints that follow the designation. Practitioners generally refer to a UART's external interface as asynchronous serial or async serial or just async, which itself can interoperate with a range of physical layers. -- Rich Webb Norfolk, VA
On Wed, 22 Jul 2009 07:03:07 -0700, Rumpelstiltskin <rumpy@abc.biz>
wrote:

>Since distance is only 4 feet, >simplest way is to make a TTL level >RS232 wire-or'd bus. Just requires >adding an open collector TTL buffer >to each transmit line, and resistor pullup.
While wire-ORing some TTL open collector outputs would be sufficient to implement a bus _within_ a single PCB, there are hardly any PCBs more than 1 m long these days :-) When interconnecting any PCBs with cables at least a few centimeters long, you are going to have ground potential problems, due to the resistance (and most importantly the inductance) of the ground connection. When transferring data from one PCB to an other, I really would suggest using some kind of differential signaling such as RS-485 or CAN bus. The other alternative is to use for instance Biphase-M coding, which will pass through transformers and hence the PCBs can be galvanically isolated from each other. Paul

The 2024 Embedded Online Conference