Arduino Uno Rx/Tx communication

Hi all

I have my Arduino Uno hooked up with USB cable to my computer, I uploaded the sketch.

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

void loop() {
  delay(1000);
  Serial.println("Test");
}

Once completed. I can see (i) Tx LED on Arduino board flashes, (ii) On serial monitor, I see the text Test being printed each second. Everything is expected.

Question #1:
Now, if I UNPLUG the USB cable and power the Arduino board using a battery. Do I assume the sketch still runs but text will print to the PIN0 Rx port? Should I expect some data coming out of PIN0 ?

Question #2:
If I throw in another Arduino Uno board and connect the Rx to Tx between them, such as

USB COM#5 → Arduino#1 Rx <-> Tx Arduino#2 → USB COM#10

Can I use the serial monitor on Arduino#2 to view what is coming from Arduino#1?

At the end of the day, all I want is to send some ASCII data out via Rx port.

Please help - Jay

Data sent by an Arduino on the serial line appear on the TXD pin (digital pin 1, PORTD bit 1). Those can be received by another Arduino, on line RXD (digital pin 0, PORTD bit 0), if you also connect the grounds together.

For the Arduino Uno, pin 0 is RX, it receives serial data from the computer. Pin 1 is TX, that transmits serial data to the computer.

Question #1:
When the USB is not connected, the TX will keep on going spitting out the text "Text".

Question #2:
I don't understand the question. It is possible to develop more than one sketch at the same time.
Try this:

  • Connect both Arduino boards.
  • Start the Arduino IDE, select the board and the serial port.
  • Start another instance of the Arduino IDE and select the other serial port.
  • Now both Arduino IDE work independant of each other, you can upload and test them while having the Arduino IDE side by side on your screen. You can open the Serial Monitor for each of them.
  1. Of course, but to Tx on pin 1. The Arduino has no idea the USB is connected or not It will just spit out it's data.

  2. If you connect the serial of two boards Rx (uno 1, COM5) to Tx (uno 2, COM10) you can send data from uno 2 to uno 1, and from com10 to uno 2. What you send from uno 1 to uno 2 will not show on the monitor. Also, connecting the uno's this way will break the abillty to send data via com5 to uno 1 when serial.begin() is called on the uno 2 (because this will pull the Rx pin of the uno 1 low hard).

At the end of the day, all I want is to send some ASCII data out via Rx port.

Below is some serial tx/rx test code I've used to send data from one arduino to another (using seperate open serial monitors on the same pc). Looking at an UNO schematic, the tx and rx LEDs appear to be part of the serial interface chip setup and will not be lit when the USB power is removed. The arduino tx/rx pins should continue to function for serial communication.

//zoomkat 3-5-12 simple delimited ',' string tx/rx 
//from serial port input (via serial monitor)
//and print result out serial port
//Connect the sending arduino rx pin to the receiving arduino rx pin. 
//Connect the arduino grounds together. 
//What is sent to the tx arduino is received on the rx arduino.
//Open serial monitor on both arduinos to test
//A diode between the slave tx and master rx is suggested 
//for isolation, with diode band attached to slave tx side. 
//

String readString;

void setup() {
  Serial.begin(9600);
  Serial.println("serial delimit test 1.0"); // so I can keep track of what is loaded
}

void loop() {

  //expect a string like wer,qwe rty,123 456,hyre kjhg,
  //or like hello world,who are you?,bye!,

  if (Serial.available())  {
    char c = Serial.read();  //gets one byte from serial buffer
    if (c == ',') {
      if (readString.length() >0) {
        Serial.print(readString); //prints string to serial port out
        Serial.println(','); //prints delimiting ","
        //do stuff with the captured readString 
        readString=""; //clears variable for new input
      }
    }  
    else {     
      readString += c; //makes the string readString
    }
  }
}