Weird characters on serial monitor Arduino

I was measuring my mpu 6050 with Nano in the serial monitor it is showing wrong characters that i don't understand please help me

Hello, do yourself a favour and please read How to get the best out of this forum and modify your post accordingly (including code tags and necessary documentation for your ask).

And your code is ??? Don't forget to use code tags when posting code.

Your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advise on) your project :wink: See About the Installation & Troubleshooting category.

from the title, the library and start of the code visible in the screen grab, this is likely this example

@itsmedmc - did you modify that code? tell us about the wiring and your config too.

(when I see example code using a long of an unsigned long for millis() related stuff, this is usually a hint that the developer of the example is not so good with Arduino stuff and I would not use the library. but before blaming the library, I would try as well on the 1.8.x IDE and not with 2.0 just to ensure this is not due to another Serial monitor bug.)

This is the code no modification done got this from --> Examples--> MPU6050 -> GetAllData
Connected,
SCL to A5
SDA to A4
VCC TO +5
GND TO GND

#include <MPU6050_tockn.h>
#include <Wire.h>
MPU6050 mpu6050(Wire);
long timer = 0;
void setup() {
Serial.begin(9600);
Wire.begin();
mpu6050.begin();
mpu6050.calcGyroOffsets(true);
}
void loop() {
mpu6050.update();
if(millis() - timer > 1000){

Serial.println("=======================================================");
Serial.print("temp : ");Serial.println(mpu6050.getTemp());
Serial.print("accX : ");Serial.print(mpu6050.getAccX());
Serial.print("\taccY : ");Serial.print(mpu6050.getAccY());

Serial.print("\taccZ : ");Serial.println(mpu6050.getAccZ());
Serial.print("gyroX : ");Serial.print(mpu6050.getGyroX());
Serial.print("\tgyroY : ");Serial.print(mpu6050.getGyroY());
Serial.print("\tgyroZ : ");Serial.println(mpu6050.getGyroZ());

Serial.print("accAngleX : ");Serial.print(mpu6050.getAccAngleX());

Serial.print("\taccAngleY : ");Serial.println(mpu6050.getAccAngleY());

Serial.print("gyroAngleX : ");Serial.print(mpu6050.getGyroAngleX());

Serial.print("\tgyroAngleY : ");Serial.print(mpu6050.getGyroAngleY());

Serial.print("\tgyroAngleZ : ");Serial.println(mpu6050.getGyroAngleZ());



Serial.print("angleX : ");Serial.print(mpu6050.getAngleX());

Serial.print("\tangleY : ");Serial.print(mpu6050.getAngleY());

Serial.print("\tangleZ : ");Serial.println(mpu6050.getAngleZ());

Serial.println("=======================================================\n");
timer = millis();

}

}

Ran the code Done compilation & uploading after opening serial monitor it said wait for 3 seconds after that cant able to see the x y z axis data weird character were showing up !

The code is not uploading in 1.8 but in this 2.0 build it is uploading with no errors!

@J-M-L , @sterretje don't waste your time with this guy. If he ignores you, ignore him.

➜ please read How to get the best out of this forum

So, please edit your post, select the code part and press the </> icon in the tool bar to mark it as code. It's barely readable as it stands. (also make sure you indented the code in the IDE before copying, that's done by pressing ctrlT on a PC or cmdT on a Mac)


the code does compile fine for me, for a UNO, in IDE 1.8.19

Can't see the loop function of your code. So, can't really understand what should be shown in the serial monitor.

yeah - seems indeed a lost cause.
moving on.

Hi @itsmedmc.

I just tried the sketch out in Arduino IDE 2.0.0-rc5 and didn't have any problem with Serial Monitor.

You mentioned "1.8", so I will guess that you also have Arduino IDE 1.8.x installed. Please try this:

  1. Use Arduino IDE 2.0.0-rc5 to upload the sketch, as you did before.
  2. Select File > Quit from the Arduino IDE 2.0.0-rc5 menus.
  3. Start Arduino IDE 1.8.x.
  4. Select the port of your Nano board from the Tools > Port menu in the Arduino IDE 1.8.x menus.
  5. Select Tools > Serial Monitor from the Arduino IDE 1.8.x menus.

Do you see the same "weird characters" behavior in the Arduino IDE 1.8.x Serial Monitor?

This experiment will tell us whether the problem is specific to the Arduino IDE 2.x Serial Monitor (there are a couple of known bugs with it that might cause this type of problem), or a universal problem with the serial output from the Nano board.

In 1.8 it wont upload like it was showing COM Port busy for like 20Min after restarting also it was not working in 2.0 build it will upload to board but in the serial monitor cant read anything!

Please just follow my instructions. I explicitly instructed you to use Arduino IDE 2.0.0-rc5 for the upload, so the fact that you can't upload in Arduino IDE 1.8.x is completely irrelevant.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.