Title('Room Temperature','fontsize',13,'fontweight','bold') :(matchIndex(i)+length(humidityDelimiter))+widthOfTempdata-1)) LoggedHumidity(i) = str2num(loadedText((matchIndex(i)+length(humidityDelimiter)). MatchIndex = strfind(loadedText, humidityDelimiter) HumidityDelimiter = 'H:' %This appears before each temperature reading % Loop Through and Store Found Humidity Readings :(matchIndex(i)+length(temperatureDelimiter))+widthOfTempdata-1)) LoggedTemps(i) = str2num(loadedText((matchIndex(i)+length(temperatureDelimiter)). % Loop Through and Store Found Temperatue Readings MatchIndex = strfind(loadedText, temperatureDelimiter) % Find Indicies Where TemperatureDelimiter Exists In Loaded String TemperatureDelimiter = '%T:' %This appears before each temperature reading WidthOfTempdata = 2 %eg arduino prints T: 22*C, we are interested in the 22 so that is 2 digits These will then be extracted and plotted. % it appears like this "H:63%T:22*C" so we will look for the "%T:" to indicate that the next two digits FREEMAT TRANSFER FUNCTIONS SERIAL% which was printed to the serial port like this "H: 63 % T: 22 *C". Originally I had temperature and humidity logging % When a text file is loaded the spaces are removed. 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.ĭownload the MATLAB/FreeMat script and data file to plot data logged by an Arduino here. Plotting Data (MATLAB/FreeMat)įor more information about the plotting software click on either MATLAB or FreeMat. FREEMAT TRANSFER FUNCTIONS UPDATEWe will update this tutorial showing this functionality shortly. This can then be directly imported using Matlab and FreeMat’s built in CSVRead function. Simply send comma separated text to the message logger which will log to its own file ignoring all other serial data. MegunoLink Pro’s message logging feature makes this even easier. MegunoLink will then begin to write any serial data it receives to the text file. To begin logging click the logging tool icon. Enter the filename and path for a textfile that you want to store the data in. Once a serial connection has been established in MegunoLink add a Log to File visualiser. The same process can be used in Matlab too. MegunoLink stored the data in a text file and now we will plot it with FreeMat. In this example, an Arduino was set-up to measure temperature and humidity, sending the measurements to a host computer every minute. 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. Matlab and FreeMat are helpful tools for further processing the stored data. MegunoLink’s data logging tool can be used to save serial data sent by your Arduino to a text file.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |