1

Suppose one connected two of the Arduino Uno boards through Rx and Tx pins. Then, if one or both of the Arduino boards were connected to computer, and possibly opened up Serial Monitors, will Tx and Rx pin still be working? i.e. will Arduino still communicate through Rx and Tx pin when it's communicating to computer? If not how to make them working while connect to computer?

1
  • The USB FTDI chip is connected to the TX/RX pins. So serial may not work the way you expect. – Dougie Jan 27 '20 at 7:45
4

Suppose one connected two of the Arduino Uno boards through Rx and Tx pins.

I assume you will connect the TX of one Arduino to the RX of the other one and vice versa, which is the right way to connect them. As theSealion explained in his answer, you shouldn't connect two TX Pins together.

if one or both of the Arduino boards were connected to computer, and possibly opened up Serial Monitors

If you do that, the Arduino won't even notice.

Well, to be more accurate... there is a small chip on the Uno, near the USB connector, labeled “MEGA16U2”. This chip is used as a USB/serial converter, and it will notice when you connect the USB link and when you open the port. However, the main chip (the big PDIP28), which is the microcontroller that runs your sketch, will neither know nor care.

will Tx and Rx pin still be working?

Absolutely.

will Arduino still communicate through Rx and Tx pin when it's communicating to computer?

The RX will not communicate with the computer. What will happen is:

  • Whatever your Arduino writes to its serial port will be received by both the other Arduino and the serial monitor.
  • Whatever you send through the serial monitor will be lost.
  • When you Serial.read(), you will get whatever was set by the other Arduino.

The reason of this behavior is a 1 kΩ resistor that sits between the Mega16U2's TX and the main microcontroller's RX. When you connect this RX to the other Arduino's TX, which is low impedance (≈ 25 Ω), that TX will “win”: a low impedance output overwhelms a high impedance one.

2

how to make [two Arduinos communicating with each other] working while connect to computer?

There are a variety of ways for 2 Arduinos to directly communicate with each other while one or both are communicating with the Serial Monitor of a laptop computer over USB.

  • Use a UART for the Arduinos to communicate that is independent of the USB connection. (See https://www.arduino.cc/reference/en/language/functions/communication/serial/ )

    • Several Arduino-compatible boards such as the Arduino Mega 2560, Arduino Due, Arduino Uno Wifi Rev.2, etc. have 4 hardware UARTs; the pins of Serial1 (note the "1") could be used to communicate with another Arduino without interfering with the Serial (without a "1") UART communication over USB to a laptop. (Alas, the Arduino Uno has only 1 hardware UART).
    • The ATmega32u4-based Arduino Micro and Arduino Leonardo and ATmega32u4-based Arduino derivatives such as FLORA and many of the ARM-based Arduino derivatives such as the Teensy series have a USB interface that doesn't use any of the UART pins; so the pins of Serial1 (note the "1") could be used to communicate with another Arduino without interfering with the Serial (without a "1") non-UART communication over USB to a laptop. (Alas, the Arduino Uno has a USB interface that does use its only hardware UART pins).
    • Even the Arduino Uno, which has only 1 hardware UART whose pins are hard-wired to the USB interface chip, can bit-bang a slow simulation of a UART on other pins. See What's the difference between all the Software Serial Libraries? Which one is Arduino Nano compatible? .
  • Rather than try to simulate a UART in software (the timing is kind of tricky), it may be easier/faster to use some other less time-sensitive ways of communicating between Arduino Unos or other Arduinos, such as

1

I got exactly the same problem! I was using the Arduino Uno board with an Jtag ICE mkii for debugging which was working nice. As I begann to use the UART it was a heavy mess. The transmitting from Arduino to an external TTL-USB adapter was working but not in the other direction. I played hours before I saw this thread and that gave me the idea for looking into the shematic -> Bang! I saw the two resistors. Lesson learned: Do not use the Arduino hardware without the rest of the tools! Thought it was a good idea to use the hardware for rapid development. Now it costs me more time that I thought...

0

You should't connect two TX Pins together. The Arduino has some protection resistors but even it is not recommended to connect two output pins.

The only save way to use the RX / TX pins directly is to remove the protection resistors (RN4A and RN4B in the reference design) or at least the RN4A and use only one connection at a time. It doesn't help if you do not use the PC connection or doesn't open the Serial Monitor since the pins is still an output.

(Multiple RX Pins are no problem since they are inputs)

(And of course I know it could work with multiple TX pins together most of the time, but I would recommend it)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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