Software serial strange behaviour

Hello
I am writing for the first time, I am no arduino expert. My Board is the Arduino Uno WiFi rev2 and I am using this with the DFRobot 6dof accelerometer.
I did the setup exactly as suggested in their guide

https://wiki.dfrobot.com/Serial_6_Axis_Accelerometer_SKU_SEN0386

The point is that on the serial monitor I get strange messages, which are not what i was expecting, see link above (I should get accelerometers reading)

Instead I get this:

14:23:19.989 -> ⸮⸮⸮⸮QC0@⸮⸮⸮⸮⸮⸮\F⸮⸮⸮⸮⸮C0@⸮⸮⸮⸮QC0@⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮C8Z⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮QC0@⸮⸮⸮⸮⸮QC0@⸮⸮⸮⸮⸮⸮C0 ⸮⸮⸮⸮⸮⸮C8

the code is this:


/*!
   @file getLightIntensity.ino
   @Set the frequency of data output by the sensor, read the acceleration, angular velocity, and angle of X, Y, and Z axes.
   @n Experimental phenomenon: when the sensor starts, it outputs data at the set frequency and the data will be displayed on serial monitor
   @copyright   Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)
   @licence     The MIT License (MIT)
   @author [huyujie](yujie.hu@dfrobot.com)
   @version  V1.0
   @date  2020-12-03
   @https://github.com/DFRobot
*/

#include <SoftwareSerial.h> 
#include <DFRobot_WT61PC.h>


//Use software serial port RX:10,TX:11
SoftwareSerial mySerial(10, 11);

DFRobot_WT61PC sensor(&mySerial);

void setup()
{
  //Use Serial as debugging serial port 
  Serial.begin(115200);
  //Use software serial port mySerial as communication seiral port 
  mySerial.begin(9600);
  //Revise the data output data frequncy of sensor FREQUENCY_0_1HZ for 0.1Hz, FREQUENCY_0_5HZ for 0.5Hz, FREQUENCY_1HZ for 1Hz, FREQUENCY_2HZ for 2Hz, 
  //                        FREQUENCY_5HZ for 5Hz, FREQUENCY_10HZ for 10Hz, FREQUENCY_20HZ for 20Hz, FREQUENCY_50HZ for 50Hz, 
  //                        FREQUENCY_100HZ for 100Hz, FREQUENCY_125HZ for 125Hz, FREQUENCY_200HZ for 200Hz.
  sensor.modifyFrequency(FREQUENCY_10HZ);
}


void loop()
{
  if (sensor.available()) {
    Serial.print("Acc\t"); Serial.print(sensor.Acc.X); Serial.print("\t"); Serial.print(sensor.Acc.Y); Serial.print("\t"); Serial.println(sensor.Acc.Z); //acceleration information of X,Y,Z
    Serial.print("Gyro\t"); Serial.print(sensor.Gyro.X); Serial.print("\t"); Serial.print(sensor.Gyro.Y); Serial.print("\t"); Serial.println(sensor.Gyro.Z); //angular velocity information of X,Y,Z
    Serial.print("Angle\t"); Serial.print(sensor.Angle.X); Serial.print("\t"); Serial.print(sensor.Angle.Y); Serial.print("\t"); Serial.println(sensor.Angle.Z); //angle information of X, Y, Z 
    Serial.println(" ");
  }
}

Any help appreciated, thanks

What baud rate do you have set on the serial monitor?

9600

That's the speed you're using to talk to the accelerometer. You need 115200 on the monitor.

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