Go Down

Topic: Strange characters on serial monitor (Read 3312 times) previous topic - next topic

T_bee

Hi,

I am pretty new for Arduino, learning the basics. I was trying to do some very basic Hello world p, the code is below:


Code: [Select]
void setup()
{
  Serial.begin(9600);
             Serial.println("Hello world");
}

void loop()
{
}


But instaed of receiving the 'Hello world string' on the serial monitor, I receive some strange characters: "%,,/ 7/2,$!". I tried with different baud rates (setting both the arduino and the monitor to the same rate) but received this string always.
Strange thing, that it can print numbers, if I use
Code: [Select]
Serial.println(12)
then I get "12" on the serial monitor.

I am using Arduino UNO rom eBay with CH340G chip, and the 1.0.5. version of the Arduino software on Win7, but other seerial monitors (like PUTTY) gives the very sam result.

Does someone has any idea, what might cause this problem?

Thanks

T_bee

johnwasser

Do you always receive the SAME strange characters?  If so it is important to know what characters you receive.  Try this sketch and post the output:
Code: [Select]
void setup() {
  Serial.begin(9600);
}

void loop() {
    Serial.println("Hello world");
    delay(2000); // wait two seconds
}
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp

T_bee

Yes, it is always the same:

Code: [Select]
%,,/ 7/2,$
%,,/ 7/2,$
%,,/ 7/2,$
%,,/ 7/2,$
%,,/ 7/2,$
%,,/ 7/2,$

jverive

The only difference between

%,,/ 7/2,$

and

ello world

is that bit 6 is flipped from a 1 to a 0 (I don't know why the "h" isn't showing up - which would be shown as "{" with bit 6 flipped). Either your Arduino is flipping this bit, or the bit stream is getting corrupted somewhere along the way. Make sure that (in addition to baud rate being the same) the data formats are the same: usually 8 data bits, one start bit, and no stop bits with no parity.

T_bee

Where can I change those settings?

I've tried via Terminal, but there is no start bit, only stop bit setting:

jverive

Sorry - my earlier response was wrong. Typical serial communications are performed with 1 STOP bit and 0 START bits); it is also typical to use 8 DATA bits and NO parity bits. You will often see this as

8,N,1 - for 8 DATA, No parity, and 1 STOP bit

or similar notation. So just adjust those parameters available for you to set.


johnwasser

'H' doesn't show because it gets modified to a backspace: 0x48->0x08.  A lowercase 'h' would show as '{'.

I wonder if the system clock is off enough to cause a slight baud rate mismatch.  If the sample for Bit 6 is taken after the start of Bit 7 instead of the middle of Bit 6 it would cause Bit 6 to read as 0.  That's half a bit too fast after 6 bits or about 8% fast.  Try setting the Arduino to 9000 baud.  If that gets the right characters to a 9600-baud terminal we'll know that the problem is clock related.
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp

T_bee

Setting the Arduino to 9000 baud on the 9600 terminal I get the following strings:
Code: [Select]
ˆ¥¬¬¯ ·¯²¬¤
ˆ¥¬¬¯ ·¯²¬¤
%,,/ 7/2,$
%,,/ 7/2,$
ˆ¥¬¬¯ ·¯²¬¤
ˆ¥¬¬¯ ·¯²¬¤
%,,/ 7/2,$

jverive

For the "second" set of weird characters, you are seeing the effects of bit 7 being turned on, adding 64 (hex 80) to the ASCII code, so that the characters are now being decoded as "extended" ASCII characters (see one set of such characters here: http://www.ssec.wisc.edu/~tomw/java/unicode.html#x0080). It's hard to know what is causing these bits to flip, but you can try a couple of things:

You can try reducing your baud rate to 1200 and see if that fixes the problem. Another possibility is that your USB communications are getting messed up by the USB port or your USB cable, so try a different USB cable and/or try using a powered USB hub between your computer and Arduino.

T_bee

baud rate change unfortunately didn't help, I tried from 300 to 19200, different cable and, USB port on pc and powered HUB also didn't help.
Is it rather the device's problem, or my PCs problem? If I'd order another board, would it probably give the same result, or it might work properly?

jverive

Do you have another computer on which to try the Arduino? That might narrow down the problem.

I'm suspecting the issue is with the USB serial converter chip (CH340G) on your Arduino Uno (which is a clone and not an official Arduino Uno). Many people have had serial connection problems with the Arduino Uno clones using the CH340G instead of the FTDI part used on official Arduino Uno boards.

T_bee

I've tried it onw, it is the very same. So, probably the USB converter chip is wrong? If I get something like this then it would solve the problem them?
Also, it affects only the USB communication, so if I am using the controller in other projects later without PC connection, will it work properly?

jverive

I don't know how you'd connect up the FT232 board to your Uno clone, but I can tell you from experience that those boards can also be a pain! Many of them use counterfeit FTDI chips that work initially but fail later due to driver issues (Google "counterfeit FTDI" to find out more about this issue).

You can probably continue using your Uno clone without the serial monitor, but consider getting an official Arduino Uno. For some projects, debugging is a lot harder without the serial monitor.

Go Up