Saving Data From an Arduino on a PC using GoBetwino

Make it to the Right and Larger Audience


Saving Data From an Arduino on a PC using GoBetwino

This post provides an outline on how to setup and interface and Arduino Mega with a PC using GoBetwino ( We will use GoBetwino to save data in an Excel file from measurements on two analog pins on the Arduino Mega. We will also integrate a timer interrupt for flashing the LED on pin 13 as an “alive LED”.


There are two primary commands used by GoBetwino sent from the Arduino on the Serial port – SENDK and SPXL. SENDK is already configured in GoBetwino, but SPXL must be setup on the application. After opening GoBetwino, open the Serial port tab and check the serial port and baud rate. The code provided for this example sets the baud rate to 9600 bits/second, but that can be changed in software by changing “Serial.begin(baud rate);” in the code to the desired baud rate. Ensure the serial port is set correctly in accordance with the device manager identification of the Arduino Mega. A screenshot of the device manager is shown below.

Device Manager


The corresponding serial port configuration is shown below.

Serial Port Configure

By default the Arduino interfaces serially using 8-N-1 parameters (8 data bits, no parity, and 1 stop bit). This is setup is shown in GoBetwino above.


Before setting up the SPXL command, we need to create a blank Excel file. For this example we will create “valpontTest.xslx” in the following path: “C:\gobetwino\valpont\valpontTest.xlsx”.


Once the blank Excel document is completed, we we need to setup the SPXL command. From the GoBetwino application, click commands -> New command. Select SPRID from the command type dropdown. Name the command “SPXL” and choose the program path. For this example, we will choose the path to be “C:\gobetwino\valpont\valpontTest.xlsx”. The “cmd. line args.” input can be left blank. The program path can be changed by selecting “edit command” from the commands tab as shown below.

Add command

Now that GoBetwino has been set up, the code is ready to be loaded on the Arduino. Ensure GoBetwino is closed before loading the code onto the Arduino. Loading the code onto the Arduino using the same serial port as GoBetwino so there will be interference unless GoBetwino is closed.


After the code is done uploading, open GoBetwino. The commands through GoBetwino should be seen under “Status messages” of the application as shown below. The first command should be “#S|SPXL|[]#” and subsequent commands should be “#S|SENDK|[0&XXX {TAB} YYY{DOWN} {LEFT} ]#” where XXX and YYY represent the values measured from the two analog pins.

The command output should always be “0” as shown above, indicating that there were no issues. As the program runs, you should see excel open on the monitor of your PC and update each cell and save the file after each loop as shown below.

While the code is running, an alive LED is used to visually show the program is running. This is done using the TimerOne library. This library provides an easy way to initialize a timer interrupt. Initialize the timer with “Timer1.initialize(time in microseconds)”. To define the interrupt service routine, use “Timer1.attachInterrupt(ISR name)”. This initializes the interrupt service routine (called “timerISR” in the example code). Every 50000 microseconds the program will execute the interrupt service routine. Here we are able to turn on and off the LED on pin 13. In order to provide a quick flash with an extended delay, we keep the LED off for 20 cycles of the interrupt service routine and turn it on for just one cycle after 20 cycles of 50000 microsecond delays have occurred.

Author brief is empty


1 Comment
  1. tonicho 3 years ago

    g’mornin’ Crawford,
    any ideas how I might pass data from an analytical balance (ShimadzuAUX320) to Excel? (Instead of from an Arduino). I have been using “WindowsDirect” through a serial cable, but readings are restricted to about one a second and I’m hoping for nearer 10 per second.


Contact Us

Thanks for helping us better serve the community. You can make a suggestion, report a bug, a misconduct, or any other issue. We'll get back to you using your private message ASAP.



Forgot your details?