3 years, 7 months ago.

Can anyone suggest the best way to establish communication between an arduino and a mbed?distance5m

I have already tried the serial communication between them at a little distance, but I heard that with a long distance we have to use a RS485. So would I have to buy two shields RS485? one to use in the arduino and another to use in mbed LPC1768? I just want to send some words between them. Speed is not a priority. Would wireless communication be better? and cheaper?

1 Answer

3 years, 7 months ago.

Hi Rayan. To best answer your question, you will need to define your environment. The distance of 5m is not that far away but is there a possibility of a ground difference between the 2 connected pieces of equipment ? Electrical noise from perhaps motors ? Inductive surges ? If yes, then consider the thought of offering isolation between the 2 pieces of equipment.

RS485 is a very popular method of using copper wiring to connect equipment and the differential signals of RS485 provide for a robust transfer of data. Varying with the number of nodes you have in the end project and speed, you could have up to 4000 ft wiring with RS485 compliant transceivers. Factors like termination network, the impedance of each RS485 transceiver will ultimately limit your wiring length. The short answer is that yes RS485 is a lower cost, easily to manage method of connecting the 2 boards. You can use $1-$3 USD RS485 transceivers (ie. Intersil, Maxim, Linear are good products to consider). If your budget allows for it, consider to use isolated RS485 modules which will then remove the issue of ground differences out of this equation. Isolation is used for factory automation where there are long lengths of wiring between the RS485 master and the external RS485 nodes. Other methods to consider are optical isolation such as fiber modules - there are some $10-$20 USD modules from Avago that work like your serial interface transceivers. Simply, power them up and feed data or receive data @ 3v3 swing. However, the modules and then the interconnect fiber will be more costly but they do exist AND will offer isolation. Then there is wireless which will do the same but the frequency / frequencies of the wireless solution must be considered. The popular ESP8266 modules may be a good choice but we have not yet started to experiment with these new versions of modules. You can source these for under $10 USD everywhere and are stand alone WIFI modules that talk via 3v3 serial interface. You can source the same modules for about $2 USD on Aliexpress out of China.

https://www.pine64.org/?page_id=917

You should be able to use 2 of the above WIFI modules (point to point) and communicate over the air between the 2 boards.

http://www.geekstips.com/two-esp8266-communication-talk-each-other/

Accepted Answer

--

The RS485 board and wiring looks fine. RS485 is tolerant of some noise so you really do not need to use high quality cabling and even Ethernet (CAT5) cable will work but your cable looks easier to work with.

In reviewing the MAX485 datasheet (Maxim), the transceiver can support upto 32 RS485 nodes which is industry standard. Often you can find RS485 transceivers which are 1/8th impedance so this means you can support upto 8 times industry standard = 256 nodes. That is, if you use 1/8th impedance transceivers in each and every RS485 node then you can technically support upto 256 of RS485 nodes.

The RS485 board you will be using is HALF DUPLEX. This means that when one board is transmitting, the other must be listening and vice-versa. So you must use a GPIO pin to ENABLE and DISABLE the local RS485 transmitter. The transmitter & receiver pins are shared. When the transmitter is enabled (active high usually) then the local receiver is automatically disabled (active low usually).

Recommend that you wire up the boards:

D+ to D+ D- to D- Ground to Ground

and then send out the alphabet or similar and be sure you can receive the same on the other board.

In RS485 you will need to apply a 120 ohm resistor at the START of the chain (across D+ & D- pins) and then again with another 120 ohm resistor on the last node of the RS485 chain.

Post back if you have any questions. Our company has very high volumes of such designs in the industry including all across Brazil :)

-

https://electronics.stackexchange.com/questions/33455/is-cat5-cable-good-enough-for-rs-485-vs-true-rs-485-cable

https://www.maximintegrated.com/en/app-notes/index.mvp/id/3884

posted by Sanjiv Bhatia 02 May 2017

Regarding the Ethernet cable. Did you mean I can use the wires from inside the ethernet cable to make the connection from rs485 to rs485? Because I had already thought about it but I did not know if it would work.

posted by Rayan Noronha Mesquita 05 May 2017