6

When I send data to an Arduino Uno via the serial monitor, the serial data goes down the same USB cable used to program the Arduino. So there must be a device on the Arduino board like a FTDI or USB-capable AVR that drives the RXD pin of the Arduino. So my question is: When I want two Arduino boards to communicate with each other over serial, many tutorials say just connect RX and TX on one Arduino to TX to RX on the other. So how come the device on the board that normally drives the RXD pin doesn't "fight" the other Arduino that is also now driving the RXD line?

New contributor
Neil Stockbridge is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

2 Answers 2

6

The Atmega16U2 that does the USB communications is connected to Rx and Tx via 1k resistors, so when communicating with another Arduino it "overpowers" the USB interface. See image:

Arduino Uno USB interface


By the way, note that the Tx and Rx LEDs are connected to the Atmega16U2, not the Atmega328P, so they do not light when doing Arduino-to-Arduino communications.


Measuring with an empty sketch on my Uno, the current between Tx and Gnd was 0.14 mA, not 5 mA. So that suggests that the Atmega16U2 sets the pins to high-impedance when not actually receiving data from the USB interface.

It's logical it would do that, because the 5 mA you mention (in a comment) could be a nuisance if you wanted to use that pin for something else.

4
  • Awesome, thanks! You were both very quick. So does this mean that it is safe to power the Arduinos via the USB even when they are wired for serial communications with another Arduino? And that the ATmega16U2 and the other Arduino will fight, but only with ~5mA? yesterday
  • 1
    Yes, I think that's done all the time. However, and this is important, because the Arduino-to-Arduino connection will overpower the USB interface, you will have trouble programming it (the one you are trying to program) while they are connected.
    – Nick Gammon
    yesterday
  • 1
    It's also possible, although I'm not certain, that the USB chip would set the pins to high-impedance when not actually in use. In fact, I just measured on my Uno, the current between Tx and Gnd was 0.14 mA, not 5 mA. It's logical it would do that, because the 5 mA you mention could be a nuisance if you wanted to use that pin for something else.
    – Nick Gammon
    yesterday
  • @NeilStockbridge So those 1k resistors are probably there as a precaution against you trying to reprogram the chip while it is connected to something else.
    – Nick Gammon
    yesterday
3

If we take a look at this portion of the Arduino Uno schematic (whole schematic is located here):

enter image description here

... we see there are two 1K Ohm (1,000 Ohms) resistors (labeled RN4A and RN4B) between the USB to serial conversion chip on the left to the Atmel processor at center right. These allow the Rx (Receive) and Tx (Transmit) pins to be back driven by an externally connected device.

6
  • Beat me by a few seconds! :)
    – Nick Gammon
    yesterday
  • ... you are a hard person to beat in these circles!
    – st2000
    yesterday
  • That must be an old schematic, as the Uno now has a Atmega328P not an Atmega8. However the principle is the same.
    – Nick Gammon
    yesterday
  • Hmmm, it came right off of arduino.cc's web site. Oooh, that's what they meant by "Reference Design".
    – st2000
    yesterday
  • 1
    Mine has "Rev 3" on it, so you must have found an earlier revision. It's still a reference design though.
    – Nick Gammon
    yesterday

Your Answer

Neil Stockbridge is a new contributor. Be nice, and check out our Code of Conduct.

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

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