Mega USB-TTL serial monitoring problem

Hi,
I am trying to monitor the data i send from a LUA script to my Arduino Mega, therefore i cannot use the default serial monitor since it will interfere with the communication.

So, i needed a second serial connection that's why i bought a USB-TTL cable which has a PL 2303 chipset and downloaded the driver which my computer (WIN 7 64 bit) named as COM 6.
The Mega is on COM 4 and the connection is as follows:

USB-TTL Cable Arduino Pin

Black (GND) GND (tried several GND pins)
Red (+5V) -
Green (TX) RX3 (Pin 15)
White (RX) TX3 (Pin 14)

The mega is connected via USB so i did not connect the +5V (though i tried connecting that as well).

What i am trying to test is to send a string from Arduino IDE serial port screen which is connected to COM 4 and try to capture it from COM 6 using PUTTY.

Putty Serial Configuration is:
Port: COM 6
Speed: 115200
Data bits: 8
Stop bits: 1
Parity: None
Flow Control: None

The code i use for this test is as follows:

String data="";
void setup() 
{
  Serial.begin(115200); //to capture data from Arduino's terminal
  Serial3.begin(115200); // to monitor data from Putty

}

void loop() {
  while (Serial.available()) {
    delay(3);  //delay to allow buffer to fill 
    if (Serial.available() >0) {
      char c = Serial.read();  //gets one byte from serial buffer
      data += c; // adds to string
    } 
  }
  if (data.length() >0) {
      sendData(data); 
      data="";
  }
}

void sendData(String data){
 // Serial.println(data); //to see it from Arduino's terminal
  Serial3.println(data); // send it to USB-TTL cable which is connected to COM 6 (Putty)
  delay(100);
}

Whenever i try to send something from Arduino's terminal RX and TX on the board blinks and it echoes on the Arduino's terminal but i receive nothing on the Putty side.

What could have gone wrong?
Thanks in advance.

grout:
Whenever i try to send something from Arduino’s terminal RX and TX on the board blinks and it echoes on the Arduino’s terminal but i receive nothing on the Putty side.

Connect the 5V pin on the TTL-USB converter to Arduino 5V. Not sure why you deemed that step unnecessary.

Thank you for your response. As i mentioned i already tried that. It is not working with +5v pined in as well.

Power_Broker:
Connect the 5V pin on the TTL-USB converter to Arduino 5V. Not sure why you deemed that step unnecessary.

That is not necessary unless you want to power the Mega from the TTL-USB converter. In this case it is being powered by the regular USB connector.

@grout, try using the second example in Serial Input Basics but modify it so it sends the output to Serial3. If that works then you know your hardware is working.

...R

Why so complicated?

void setup() {
  Serial.begin(115200);  // all input from here
  Serial3.begin(115200); // is echoed here
}
void loop() {
  if (Serial.available()) {
    Serial3.write(Serial.read());
  }
}

Whandall:
Why so complicated?

I assumed the OP would eventually want more than a dumb echo.

Of course (and I should have mentioned this earlier) it would probably be sensible to include some stuff in the Lua code that could display debug messages from the Arduino without needing any USB-TTL device.

...R

I assume that the LUA code runs on the PC, from the Arduino side it should just be serial.

To monitor the communication via the additional adapter could be done by connecting its rx pin to the line that should be watched.

Whandall:
Why so complicated?

void setup() {

Serial.begin(115200);  // all input from here
 Serial3.begin(115200); // is echoed here
}
void loop() {
 if (Serial.available()) {
   Serial3.write(Serial.read());
 }
}

Thank you Whandall. I tried the code but it is not displaying anything as well. I connected the USB-TTL adaptor's rx to tx and it is echoing. Any other ideas?

Robin2:
I assumed the OP would eventually want more than a dumb echo.

Of course (and I should have mentioned this earlier) it would probably be sensible to include some stuff in the Lua code that could display debug messages from the Arduino without needing any USB-TTL device.

...R

It is a good idea to monitor serial in the LUA code but since i need to see what is going on in the Mega without unnecessary traffic, monitoring via another serial would be better.

Leave aside the Lua - Arduino code for a moment. Can you get a simple Arduino program working that prints "Hello World" once per second on Serial3 (or Serial2 or Serial1).

I have never had problem communicating with my Arduinos using my USB-TTL cable - in fact it is generally easier than with the standard USB cable because the connection does not drop out when I disconnect it from the Arduino.

Are you sure you have the connections correct? Have you tried swapping Rx and Tx?

...R