Logging Arduino Serial Output to CSV/Excel (Windows/Mac/Linux)
|
Written by Indrek Luuk
|
I have written a plug-in for Arduino IDE to save serial data as a CSV file that you can open in any spreadsheet application - like Microsoft Excel or LibreOffice.
Video Tutorial
In this video, I will show you how to install and use the plug-in.
Installation
Extract the zip file and copy the "ArduSpreadsheet" folder into your Arduino "tools" folder next to the Arduino "libraries" folder. If the "tools" folder doesn't exist, then you can create it yourself.
C:\Users\<username>\Documents\Arduino\tools
/Users/<username>/Documents/Arduino/tools
Now restart your Arduino IDE, and you should see "ArduSpreadsheet" under the "Tools" menu.
Arduino code
You can use the Arduino Serial library to send data for logging.
The baud rate parameter has to match with the selection in the ArduSpreadsheet window.
void setup() {
Serial.begin(9600);
}
- tab - '\t'
- comma - ','
- semicolon - ';'
You can indicate the end of the row by calling "Serial.println()" or printing out a newline symbol '\n'.
Example
int rowCount = 500;
int rowNumber = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
if (rowNumber < rowCount) {
Serial.print(++rowNumber);
Serial.print('\t');
if (rowNumber % 2 == 0) {
Serial.print("even\t");
} else {
Serial.print("odd\t");
}
Serial.println(random(16000), HEX);
}
}
The above code will produce this result:
Running ArduSpreadsheet as a stand-alone program
To run it as a stand-alone program, you need to install Java 1.8 or newer.
I have included execution scripts for Windows, Mac, and Linux (all they do is execute the Main method inside ArduSpreadsheet.jar).
On Windows
Double-click on the "Windows_ArduSpreadsheet.bat." You may get a warning that you are executing an unrecognized app.
Click on "More info" and then "Run anyway."
On Mac
To get it running on Mac, you first need to give execution privileges to the script file.
$ chmod a+x Mac_ArduSpreadsheet.command
Then double-click on the "Mac_ArduSpreadsheet.command."
Mac OS will warn that the application is from an unknown developer.
Open "System Preferences..." and then "Security & Privacy."
Click "Open Anyway" and then "Open"
Now you can Open ArduSpreasheet by double-clicking on the "Mac_ArduSpreadsheet.command."
On Linux
$ chmod a+x Linux_ArduSpreadsheet.sh
Now you should be able to run the application by either executing the script from the command line or double-clicking on the "Linux_ArduSpreadsheet.sh."