Advice on controlling multiple UART Serial devices at one....

Hi, I'm planning a project and was looking for some advice. New to Arduino and assessing if its the right solution...

I need to send and receive rs232 serial commands to a collection of devices. Either send the same command to all, and get a response back from all, or send a command to just one and get the response back.

I am writing a python app that will allow a user to select 1 or all devices, select the command and then send it and see the response.

Would an Arduino be able to support this - I saw the Mega has 4 UARTs. So this could hook up 4 devices, and then also connect the Arduino over usb to the computer?

I was thinking of a very simple program on the board that simply proxies the Serial command to the devices, but the first argument indicated which device, or all, to send it to.

The Arduino would then strip this first argument, and send the rest of the command to the device, or each device in turn. On response of one, or wait for all, it would append this first argument to the response and return it back to the computer.

Does this sound feasible? Or am I barking up the wrong tree!

Any pointers on where to look for more info on this kind of design would be much appreciated....

Regards

M

If you are bound to UARTs, because the devices require that, you don't have many options. Otherwise I2C (or Ethernet...) would allow to connect all devices to a single bus.

It may be possible to build a multiplexer, that allows to receive (and transmit?) data from a specific device, using a single UART.

I need to send and receive rs232 serial commands to a collection of devices.

What devices? How many? Why RS232?

Sending and receiving commands like you describe is possible. Serial input basics is a good tutorial on serial communication.

mattb: I was thinking of a very simple program on the board that simply proxies the Serial command to the devices, but the first argument indicated which device, or all, to send it to.

The Arduino would then strip this first argument, and send the rest of the command to the device, or each device in turn. On response of one, or wait for all, it would append this first argument to the response and return it back to the computer.

That should be possible.

You need to provide more information about what you want to connect the Arduino to, and how many of them.

You can connect several slave UARTs to a single Master Tx line to send data to all of the slaves at the same time. You can include a ID as part of the message so each slave can distinguish which messages are intended for it.

Receiving is a little more complex as you need to add diodes on each slave Tx line going to the master (so the slaves don't interfere with each other) and a pullup resistor on the master's Rx line. Also, of course, you need a system to ensure that only one slave talks at any one time - but that is not difficult to arrange.

...R