0

Is possible the communication between several Arduinos to one serial port in the PC ?

If I have ARD_A, ARD_B,... ARD_Z running with some code like this

void setup()
{
    Serial.begin(9600);
}

void loop()
{
    while (Serial.available() > 0)
    {
       String stringID = Serial.read()
       int nFound = stringID.indexOf("@ARD_01"); 
                    // ---> Id is unique for each arduino
       if ( nFound > 0 )
          Serial.print("this is @ARD_01 responding sending some data");
     }
}

And in the pc there is an exe sending a string:

"@ARD_01 I want your data" 
   process the data
"@ARD_02 I want your data" 
   process the data
"@ARD_03 I want your data" 
   process the data

1 Answer 1

2

Not directly, no. A PC's serial port - either a "real" one or a USB one, can only communicate with one device.

The Arduino, though, is a USB device, so you can just plug them all into a USB hub or a bunch of hubs - each one will get its own COM port. Managing all those COM ports can be kind of tricky though, especially when you have a lot of devices.

Another option, one that is more widely used when you want to communicate with a lot of slave devices from one master device is to use a multidrop network. RS-485 is the most popular of these. It allows you to connect many slave devices to one set of serial wires and the master sends instructions to a slave, and the slave may respond with data and information on request.

RS-485 requires special hardware to interface normal TTL level RS-232 (UART) ports to the bus.

You can read more about RS-485 here: https://en.wikipedia.org/wiki/RS-485

5
  • What If I say yes you can communicate with different Arduino on the same serial port by changing the baud rate for each Arduino :) with simple VB.net API
    – Narzan Q.
    Commented Sep 18, 2015 at 8:31
  • Then I reply with how do you isolate all the Arduino tx lines from each other so they can talk back to the pc? (btw, I know the answer just testing if you do)
    – Majenko
    Commented Sep 18, 2015 at 8:33
  • I didn't mean to test you or anything :) I just made that before with 2 arduinos by build a small vb.net API, 2 baud rate each one will receive the data from specific Arduino, if the other Arduino in different baud rate send data too, the API will ignore it simply because the data will not make any sense
    – Narzan Q.
    Commented Sep 18, 2015 at 8:39
  • 1
    It's not a question of not making sense, its a question of preventing physical damage to the arduinos. If one tx is high and the other tx is low you have an effective short circuit that can damage the tx pins of both arduinos. While it is possible to do it you have to know what you are doing, and if you know what you are doing you'll do it properly and use an industry standard solution.
    – Majenko
    Commented Sep 18, 2015 at 8:46
  • oh It's work but as what you have said, TX,RX pins will be damaged, Thanks for notify me for that :)
    – Narzan Q.
    Commented Sep 18, 2015 at 8:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.