Serial.begin(57600); results in actual 115200

When I use th following code, I'd expect the serial monitor has to be set to 57600 in order to see the serial prints. However, it only shows gibberish. Trying various baud rates I found that the text comes up clear in 115200! If I change the Serial.begin line to Serial.begin (115200) the 115200 setting on the serial monitor goes to gibberish again and I have to change the baud rate to 230400 in order to see the text. So confusing! Can anyone explain what's happening? Thanks!

void setup() {
// initialize digital pin LED_BUILTIN as an output.
Serial.begin(57600);
delay(10);
Serial.println();
Serial.println("Setup Complete");
pinMode(LED_BUILTIN, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
Serial.println("ON");
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
Serial.println("OFF");
delay(1000); // wait for a second
}

That would tend to indicate that you have your Board Setting set incorrectly, perhaps to an 8MHz mini when you actually have a 16MHz mini, or similar. (what kind of board do you have?)

Stupid me! Thanks! I had the wrong hardware selected.

It says on the board Arduino Nano V3 Gravitech US. I know it's a 3.3v board.

Works now!

Regards,
Hein

If you have the IDE setup for an 8Mhz device and you actually have a 16Mhz device you will get the symtoms you describe, the baud rate is twice as fast, since the clock speed is twice as fast.

But then you said 'I know it's a 3.3v board' which means it should not be used at 16Mhz.

srnet:
If you have the IDE setup for an 8Mhz device and you actually have a 16Mhz device you will get the symtoms you describe, the baud rate is twice as fast, since the clock speed is twice as fast.

But then you said 'I know it's a 3.3v board' which means it should not be used at 16Mhz.

Thanks I'm not certain what clock speed the cpu is, but I'm using the ATMega328P processor. The only alternative is ATmega168.

After selecting nano / ATmega328P, the board is working 100%.

But then you said 'I know it's a 3.3v board' which means it should not be used at 16Mhz.

"Should not" - but seems to happen a lot, and mostly seems to work.

westfw:
"Should not" - but seems to happen a lot, and mostly seems to work.

Sure, it mostly works, which directly implies that sometimes it does not.

I guess your attitude to deliberatly overclocking the processor depends on how lucky you feel.

I definitely do NOT want to overclock my Nano! I used another, incorrect board before which caused the overclock issue.

I only have the following two options available when selecting processors for the nano:

  • ATMega328P
  • ATmega168

I dont know if they are different frequencies, but the 328P works fine.