using sparkfun 9DoF IMU to collect gyro & accelerometer data in real time - help with editing Sparkfun source code 9dof app to store sensor data in excel?

3 visualizaciones (últimos 30 días)
new to matlab - have searched ad nauseum and don't find what i'm looking for. sensor is working/appropriately connected; we see a stream of live data. anyone with experience or code to log real time data from this IMU into an excel file?
also of note: we are not using an arduino board - have found lots of documentation which would help if we were, but we want to store data from the sparkfun IMU directly
thanks in advance!

Respuestas (1)

Riya
Riya el 31 de Oct. de 2023
Hello Isidora Beach,
As per my understanding, you want help with editing Sparkfun source code 9dof app to store sensor data in excel.
Please note to log real-time data from the Sparkfun 9DoF IMU directly into an Excel file without using an Arduino board, you can modify the Sparkfun source code. Here's a general approach to help you get started:
1. Open the Sparkfun 9DoF IMU source code in your preferred text editor or MATLAB.
2. Locate the section of code where the live sensor data is being read.
3. Add code to create and open an Excel file for writing. You can use the `xlswrite` function in MATLAB to achieve this. Here's an example:
% Create a new Excel file
filename = 'sensor_data.xlsx';
sheet = 1;
% Write headers to the Excel file
headers = {'Time', 'GyroX', 'GyroY', 'GyroZ', 'AccelX', 'AccelY', 'AccelZ'};
xlswrite(filename, headers, sheet, 'A1');
% Append sensor data to the Excel file
data = [timestamp, gyroX, gyroY, gyroZ, accelX, accelY, accelZ];
xlswrite(filename, data, sheet, 'A2');
4. Replace the variables `timestamp`, `gyroX`, `gyroY`, `gyroZ`, `accelX`, `accelY`, and `accelZ` with the actual variables containing the sensor data.
5. Make sure to update the file path and sheet number according to your requirements.
Remember to include the necessary MATLAB functions for writing to Excel files. You may need to install the "Excel" package if it's not already installed. You can do this by going to the "APPS" tab in MATLAB and selecting "Get More Apps".
Once you have modified the source code and added the necessary Excel writing code, save the file and run it to log the real-time data from the Sparkfun 9DoF IMU directly into the Excel file.
Please note that this is a general guideline, and you may need to adapt it to your specific code and requirements. You can provide more details to get more tailored solution.
I hope it helps.
Thanks
Riya

Categorías

Más información sobre Data Export to MATLAB en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by