Arduino Uno and L3GD20H Triple-Axis Gyro Programming Help

Hello everyone. I’m new to the forum and this is going to be my first post. Over the summer, I’ve been working on a personal research project using an Arduino Uno board and a L3GD20H Triple-Axis Gyro. I’ve done quite a few tutorials and feel comfortable with basic scripts at this point.

I’ve been Googling for some time now trying to find tutorials and example code for my particular gyro, but haven’t been very successful thus far. I’m hoping that I can find some help on this forum.

As the subject suggests and as I mentioned, I am trying to develop a program to collect data using an Arduino Uno and a L3GD20H Triple-Axis Gyro. The data sheet for the gyro I’m using can be found here:

L3GD20H Gyro Data Sheet

I currently have a basic script that reads the data from the gyro and prints it to the serial monitor. My script can be seen below:

/*******************************************************************
  gyroV2.ino
********************************************************************
  This program is designed to use the Adafruit L3GD20H gyroscope to 
  monitor and record angular acceleration along the 3 axis of 
  rotation.
********************************************************************
  Sensors use I2C communication protocol.
********************************************************************
  Original: May 23, 2016
  Modified: May 31, 2016
********************************************************************/

#include <Wire.h>
#include <Adafruit_L3GD20.h>

// Use I2C communication protocal
Adafruit_L3GD20 gyro;

void setup() {
  
  // set baud rate
  Serial.begin(9600);

  // initialize gyro; warn if not detected
  if (!gyro.begin(gyro.L3DS20_RANGE_250DPS))
  {
    Serial.println("Unable to initialize L3GD20H");
  }
  
}

void loop() {
  
  // read gyro data and print to serial monitor
  gyro.read();
  Serial.print(" "); Serial.print((int)gyro.data.x);   Serial.print(" ");
  Serial.print(" "); Serial.print((int)gyro.data.y);   Serial.print(" ");
  Serial.print(" "); Serial.println((int)gyro.data.z); Serial.print(" ");
  
  // delay between data points for stability
  delay(100);
  
}

For my application, I’m using the I2C communication method. The assembly and wiring of my Uno and gyro follow the setup found here:

Assembly and Wiring of Gyro

In short, I am supplying the gyro with 5V of power and have the SCL and SDA pins connected to the A4 and A5 analog ports on the Uno.

Question 1:
The end result of my project should be a stand-alone device that doesn’t require the Arduino IDE or other programming software to operate. To this end, I have been trying to determine the best way to save the collected gyro data into a usable file format so that it can be operated on in Excel or MATLAB. I found online some executable tools such as CoolTerm which can run in the background and save the serial monitor data into a text file after the program has been run. This works for a user that is experienced with it, but more desirable is something where the Arduino and gyro can simply be plugged in on any computer and the data automatically saved after the device has collected it.

What would be the best way to achieve this?

It would be great if I could develop code where the Arduino would automatically save the collected data into a formatted text file so that it could be opened and operated on in other programs.

Also worth mentioning is that I have downloaded the MATLAB hardware package for Arduino. I’ve been trying to play around with controlling the Uno from MATLAB, which could potentially make collecting, saving, and operating on data much easier, but haven’t gotten too far with that as it’s hard to find example code doing this. I know this isn’t a MATLAB forum, so I won’t ask specific questions regarding it here, but if anyone has experience doing something like this with MATLAB and Arduino, I’d love some pointers.

Question 2:
This is really more of a general question. As I’ve mentioned, I’m new to coding the Arduino and don’t claim to be an expert at coding (far from it). I’ve been reading and Googling as much as I can, but if anyone has websites or resources that have significantly improved their understanding of the Arduino Uno and/or gyroscopes, I’d love to have a look at them.

Thank you everyone for your time and help.