RS485 to Ethernet

Hello, i checked out the mudbis library and it works fine with my ethernet board. Now i like to make something like an interface converter RS485 (Modbus) to ethernet. Are there any tutorials? Suggestions?

If there is nothing available on the market you'll have to DIY, I'll start the suggestions with either an Arduino and an Ethernet shield or better yet one of the models with built in Ethernet such as the Ethermega or the Arduino Ethernet. Then add an RS-485 transceiver shield and write code to do the conversion.


Rob

I already have a ethernet shield an a 485 IC, the code is the problem.

For example, let’s say you wanted to send the data bytes you got from the RS485 as UDP packets.
Firstly set up the code required to do UDP with the Ethernet shield and communicating with the RS485 bus.
Set up an array into which you store the bytes you get from RS485, then read the array and send that data with Udp.write.
Something like this:

Udp.beginPacket(Udp.remoteIP(), Udp.remotePort());
Udp.write(MyArray[1]);
Udp.write(MyArray[2]);
//and so on
 Udp.endPacket();

If you were wanting to carry the ethernet data at the physical layer over
RS485, give up, ethernet uses a 3-level code which cannot be sent over a
2-level physical layer.

So you’ll need to do protcol conversion and you haven’t mentioned which
protocols you are interested in.

There is Ethernet over serial (and vice versa) but it gets quite hairy. I thought Ethernet uses 7 layers:

http://en.wikipedia.org/wiki/OSI_model

Ethernet is just the link/physical layer. Applications using the internet use 7 notional layers (In TCP/IP as in all real work networking protcols you cannot truly separate all the layers, its really just an aid to understanding. Its also trying to encompass all possible network designs.

Another way to think about IP protocols is in terms of the protocol headers, roughly speaking each layer of protocol adds a header (or at the lower levels a modulation scheme) and may also store state at each end.

Understood, thanks.

komika: Now i like to make something like an interface converter RS485 (Modbus) to ethernet. Are there any tutorials? Suggestions?

You need to understand the protocols that you will be sending/receiving on each interface, and how they relate to each other. The more directly they relate, the easier it would be to implement a bridge between them. You also need to know the data rates on each interface - the Arduino is not suitable for handling large packets or high data rates and also doesn't have much memory for holding state information or much program space for holding your protocol logic. In other words, although the Arduino is capable of doing the sort of thing you need to do, it may not be suitable in this case.

If you simply want to provide a tunnel to bring RS485 data packets into a LAN in a DIY format so that you can look at them then it would be a lot easier to use a USB/serial adapter on a PC/laptop.

We are using this in our company: https://www.phoenixcontact.com/online/portal/de?uri=pxc-oc-itemdetail%3Apid=2744490&library=dede&tab=1

USB is not good because of the less distance.

Sorry, I don't understand what that is or how it relates to your question.

Here's the english version:

https://www.phoenixcontact.com/online/portal/us?uri=pxc-oc-itemdetail:pid=2708740&library=usen&pcck=P-08-08-01-01&tab=1 You cn connect one ore Modbus Slaves and it will be converted to Ethernet.

The device you linked to looks as if it is designed to tunnel an async serial connection over Ethernet i.e. you have an async serial connection on one side, a similar async connection on the other side, and data is carried between then over Ethernet. Is that what you’re trying to achieve?

Yes, i think so.

If so you're going to need to create two devices, each with an Ethernet interface and a serial interface.

You will need to decide how you're going to transfer the serial data over the network, but since you're designing both the sender and the receiver, you have a free choice how to do this and won't be restricted to the standard frameworks for serial-over-lan. I would suggest you designate one of the devices as a server and have it listen to a TCP port, and designate the other as the a client which attempts to establish a TCP connection to the IP address and TCP port of the server. Ideally you would provide a way for the client to be configured with the address of the server, but in the short term you could just hard-code it.

If it's easy for you to detect the start and end of messages received over the serial port, and if you know the messages aren't going to exceed the available RAM, then you could buffer each message as it is received and then transmit it once it is complete. The logic for establishing and maintaining the TCP connection would be different on the client and server, but the logic dealing with data received over the serial port and over the TCP connection would be identical on both sides.

Note that you can buy products off the shelf to do this for not much more than the cost of an Arduino, so unless you're doing this for fun you should consider whether it's sensible to develop your own solution.

komika: Hello, i checked out the mudbis library and it works fine with my ethernet board. Now i like to make something like an interface converter RS485 (Modbus) to ethernet. Are there any tutorials? Suggestions?

Hello, If you want to convert modbus serial to modbus tcp you just need to understand the protocol, and belive me, it is not difficult at all. But you need to specify a bit more what you are willing to do. I guess, due to its industrial use that, you have a modbus slave device and want to connect it to a modbus/tcp network (plc's or scada) Let me know what you want

PeterH:
If so you’re going to need to create two devices, each with an Ethernet interface and a serial interface.

You will need to decide how you’re going to transfer the serial data over the network, but since you’re designing both the sender and the receiver, you have a free choice how to do this and won’t be restricted to the standard frameworks for serial-over-lan. I would suggest you designate one of the devices as a server and have it listen to a TCP port, and designate the other as the a client which attempts to establish a TCP connection to the IP address and TCP port of the server. Ideally you would provide a way for the client to be configured with the address of the server, but in the short term you could just hard-code it.

If it’s easy for you to detect the start and end of messages received over the serial port, and if you know the messages aren’t going to exceed the available RAM, then you could buffer each message as it is received and then transmit it once it is complete. The logic for establishing and maintaining the TCP connection would be different on the client and server, but the logic dealing with data received over the serial port and over the TCP connection would be identical on both sides.

Note that you can buy products off the shelf to do this for not much more than the cost of an Arduino, so unless you’re doing this for fun you should consider whether it’s sensible to develop your own solution.

Hi all
someone has managed to accomplish the rs485 a ethernet?

Should I make a
RS485<>LAN-----------LAN<>RS485
but I can’t find any arduino project to do, you succeeded?

Olá pessoal,

tenho um Ethernet Lan Shield W5100 e um Arduino uno. gostaria de fazer um receptor DMX, de um notebook eu mando o sinal para o roteador e ele vai estar conectado no shield ,shield recebe o sinal e passa para o arduino e atraves do MAX485 manda para uma maquina dmx. ex.um canhao de led

A non-English zombification of a 4 years old zombification of a 6 years old thread. Sheesh!