getting a lot of serial ports to a single one (RS485)

Hi all,

For a project, I'm looking for a way to gather serial data from up to 50 devices which have a RS232 port. I'm talking one-way traffic, so the devices will send data regularly (we're talking relatively low bitrate traffic at 9600 baud, and a message say every second or so). They might however output data at the same time.

I was looking into RS485, which as per the standard seems to allow to make a multidrop network supporting up to 32 nodes. Even 64 with a tranceiver like this one:

SN65HVD485E (http://www.farnell.com/datasheets/1850948.pdf)

Would what I'm trying to do actually be possible with something like this or am I missing very obvious stuff? The goal would be to get all the data to a PC, where timing is not very important (doesn't really matter which stream comes first, as long as I get them all within a reasonable timeframe).

Any input would be greatly appreciated. As I'm not by any means an electronics specialist, I'd appreciate a constructive answer :slight_smile:

Thanks a lot!
Jens

If you are using an UNO you can use Software Serial but only one of the sofware serial multiple ports can receive at a time. If you can live with sequential read/writes instead of simultaneous it might work for you. Otherwise you would need a Mega2560 which comes with multiple serial ports.

Rs485 is a good option I've used it with 3 arduinos and a PC and works fine. I used hardware serial from arduino connected to MAX485 chips, and the pc had a usb-to-RS485 transceiver.

Rs485 is a good option I've used it with 3 arduinos and a PC and works fine. I used hardware serial from arduino connected to MAX485 chips, and the pc had a usb-to-RS485 transceiver.

All true but the OP's question pertains to obtaining more than 32 nodes.

They might however output data at the same time.

They can not be permitted to do so.

RS485 is only a half duplex standard. There must only be one talker on the line at any one time. To do this you have to have some sort of protocol with a master / slave arrangement. The one master asks a specific device to transmit and will not ask another until it has received the data or timed out.

Grumpy_Mike:
They can not be permitted to do so.

RS485 is only a half duplex standard. There must only be one talker on the line at any one time. To do this you have to have some sort of protocol with a master / slave arrangement. The one master asks a specific device to transmit and will not ask another until it has received the data or timed out.

Ive used Modbus protocol over rs485, its very handy. There are libraries for arduino.

Ive used Modbus protocol over rs485,

Do you know of any tutorials with arduino example code ?