MegunoLink’s data logging tool can be used to save serial data sent by your Arduino to a text file. Matlab and FreeMat are helpful tools for further processing the stored data. This could be a simple as plotting your results (if you don’t want to use the built-in plotting tool) or a more complex data analysis.
500px-MatlabTutorial

In this example, an Arduino was set-up to measure temperature and humidity, sending the measurements to a host computer every minute. MegunoLink stored the data in a text file and now we will plot it with FreeMat. The same process can be used in Matlab too.

 

Logging Serial Data

Once a serial connection has been established in MegunoLink add a Log to File visualiser. Enter the filename and path for a textfile that you want to store the data in. To begin logging click the logging tool icon. MegunoLink will then begin to write any serial data it receives to the text file.

MegunoLink Pro’s message logging feature makes this even easier. Simply send comma separated text to the message logger which will log to its own file ignoring all other serial data. This can then be directly imported using Matlab and FreeMat’s built in CSVRead function. We will update this tutorial showing this functionality shortly.

Plotting Data (MATLAB/FreeMat)

For more information about the plotting software click on either MATLAB or FreeMat. MATLAB is a commercial application (student versions are often available at a reduced rate for non-commercial use) but FreeMat is completly free and can be immediately downloaded from FreeMat’s website here.

Download the MATLAB/FreeMat script and data file to plot data logged by an Arduino here.

Recommended Posts

Leave a Comment

Start typing and press Enter to search