examples/MPU6050/README.md
This project demonstrates how to use Serial Studio to visualize motion and orientation data from an MPU6050 accelerometer and gyroscope sensor connected to an Arduino. The Arduino program reads processed acceleration, gyroscope, and temperature data from the MPU6050 sensor and sends it to Serial Studio via serial communication for real-time display on widgets, such as a g-meter or an attitude indicator.
Compatibility: This project is compatible with any MPU6050 module connected via I2C communication. Adjust connections as needed if using a different Arduino board, such as the Uno or Nano.
To get started, you will need an MPU6050 sensor module and an Arduino. Connect the SDA and SCL pins of the MPU6050 to the corresponding A4 (SDA) and A5 (SCL) pins on the Arduino. The code initializes the MPU6050 and configures it with specific accelerometer and gyroscope ranges to ensure accurate data output.
For boards like the Uno or Nano, make sure the default I2C pins are used for communication.
MPU6050.ino)Begin by installing the Adafruit MPU6050 and Adafruit Sensor libraries:
Once the libraries are installed, open the MPU6050.ino sketch, connect the MPU6050 sensor, and upload the code to your Arduino. The MPU6050 data will be transmitted as a data frame, formatted with specific delimiters:
$): Indicates the start of a data frame.;): Marks the end of the frame.,): Separates individual data fields (acceleration, gyroscope, temperature).The data frame looks like this:
$accel_x,accel_y,accel_z,gyro_x,gyro_y,gyro_z,temperature;
Note:
accel_x, accel_y, accel_z are in m/s².gyro_x, gyro_y, gyro_z are in deg/s. Serial Studio automatically integrates these values to obtain pitch, yaw, and roll angles in degrees for the attitude indicator (AI) widget.To visualize the data, Serial Studio needs to be configured to parse the incoming sensor data correctly:
Download and Install Serial Studio:
Visit Serial Studio's official website to download and install the software.
Open Serial Studio and Import MPU6050.ssproj:
Launch Serial Studio and load the MPU6050.ssproj file included in this project using the Project Editor. This file contains all necessary configurations for interpreting the data transmitted by the Arduino.
Set up Serial Studio to interpret the MPU6050 data by configuring the following settings in a new project:
$;,This setup instructs Serial Studio on how to parse the data sent by the Arduino. Once configured, you can add widgets to display real-time acceleration and gyroscope data, as well as temperature. These widgets are useful for observing orientation and movement, and the temperature data can be recorded in a CSV file for later analysis.
After setting up Serial Studio:
$), End Sequence (;), and Separator (,) are correctly set in Serial Studio's project settings.