0

I wrote a simple serial program using Arduino Mega 2560, it is connected to COMPORT 10. Here is the program I Wrote,

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

void loop() 
{
  Serial.println("HELLO"); 
  delay(1000); //Send every one second           
}

Now, I tried to send this message "Hello" to TeraTerm (COMPORT 1, for this I just hooked up Tx and Rx to the Arduino's Rx0 and Tx0. Doing this I do receive message in my TeraTerm screen but the received message doesn't make sense, its receiving garbage. Its not the case of mismatch of baud rate I am using 9600 on both the side.

However I do receive message "HELLO" in the serial monitor. Is there something I am doing wrong that I am not receiving message on TeraTerm.

migrated from electronics.stackexchange.com Sep 4 '15 at 22:27

This question came from our site for electronics and electrical engineering professionals, students, and enthusiasts.

  • Possibly related: Common Serial Problems – Arsenal Sep 4 '15 at 8:10
  • I presume this works with the serial monitor in the Arduino IDE? – RYS Sep 4 '15 at 11:02
  • 2
    Where did you hooked up your tx rx? what is the device? Are you connecting you arduino to your pc using cable? Explain a little bit about your circuit! – CZAbhinav Sep 4 '15 at 11:38
  • Are you just plugging straight into a 9 pin D connector on the back of your computer, or are you using a USB to serial adapter of some form - if so, what is it (link)? – Majenko Sep 4 '15 at 22:46
  • What is TeraTerm? Can you post a link please? it is connected to COMPORT 10 ... COMPORT 1, for this I just hooked up Tx and Rx to the Arduino's Rx0 and Tx0. You've lost me here. You connected what to what? – Nick Gammon Sep 4 '15 at 23:37
1

... I just hooked up Tx and Rx to the Arduino's Rx0 and Tx0.

But neither device knows what voltage they are. You need to connect ground as well so that they have a common reference.

  • You mean the pin no 5 of the serial connector to the ground of the Arduino? – Electronic Curious Sep 4 '15 at 8:20
  • Whatever ground is to whatever ground is. – Ignacio Vazquez-Abrams Sep 4 '15 at 8:22
  • This still doesn't help, I am still receiving same kind of message, nothing changed :\ – Electronic Curious Sep 4 '15 at 8:30
  • These devices are already connected via USB. Apart from implementing some type of opto or galvanic isolation, not much else we can do, yeah? – RYS Sep 4 '15 at 11:15
0

Hello everyone thanks for your reply,

I found the problem :D and was also able to solve it.

I was directly connecting the Tx and Rx pin of Arduino to the Rx and Tx pin of DB9 connector on PC. Since, DB9 on the PC operates on higher voltage than the operating voltage of the Arduino which is 5V. This mis-match of the voltage was causing the problem, So in order to solve this i added a level shifter in between (MAX232) and now it works perfect.

Thanks everyone for replying.

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.