File Logging
Last updated
Was this helpful?
Last updated
Was this helpful?
CSV stands for "Comma Separated Values," and as the name suggests, it is a file format where data is separated by commas. This makes it easy to import and export data between different software programs.
CSV files can be created using spreadsheet software, such as Microsoft Excel or Google Sheets, and can contain rows and columns of data. Each row represents a record, and each column represents a field of data. For example, you could have a CSV file that lists the names, ages, and favorite colors of a group of people.
Why are CSV files important? Well, they are commonly used in many industries, including finance, healthcare, and research, to store and analyze large amounts of data. Being able to work with CSV files is a valuable skill that can help you in many future endeavors, whether it be for school projects or in your future career.
In the next lesson, we will go over how to create and work with CSV files in more detail, with the goal being that you can save data from the Scout.
The File logger sprite constructs the CSV File by first writing the header values, using this block of code.
This block outputs a row such as,
“Month,Date,Hour,Minute,Second,Epoch,Distance”
Next, the row values are written, which contain the current sensor values.
This outputs a row with data such as,
“5,9,15,46,40,8316452800,54”
When the program runs, pressing “f” will initiate a download as specified by this code block
The full program is located here.
Example of the data in the CSV can be view by opening the file in a text editor, or word processing application.
Example of file contents opened in a text editor.
Example file opened in Microsoft Excel
Now that you have these values, you can use them to calculate the Velocity and Acceleration
Calculate velocity using the following formula:
Velocity = (Distance2 - Distance1) / (Time2 - Time1)
This formula calculates the average velocity between two consecutive distance measurements. Repeat this calculation for each pair of distance and time values to obtain a series of velocity values.
Calculate acceleration using the following formula:
Acceleration = (Velocity2 - Velocity1) / (Time2 - Time1)
This formula calculates the average acceleration between two consecutive velocity measurements. Repeat this calculation for each pair of velocity and time values to obtain a series of acceleration values.
Note: If your distance values are recorded at regular time intervals (e.g., every second), you can assume a constant time interval between measurements. In such cases, you can omit the time intervals and use a fixed time interval value in the calculations.
Use excel, to calculate the acceleration and distance values plot them on a graph. Here is a sample video showing this process, ().