Contents

Aaron Klapheck

% ReadDAQPhotoTemp.m
% Read Excel file 23-Aug-08
clear, clc, home
fprintf('The date and time: %s \n', datestr(now))
The date and time: 23-Aug-2008 17:04:46 

Program Information

% Purpose
% The purpose of this program is to take information from a Parallax Basic
% Stamp, by way of the StampDAQ program, and analyze it using MATLAB.

% Execution
% How this works is that information from the Basic Stamp can be saved in
% an Excel document which can be read by MATLAB. This program is especially
% designed to work as a kind of data acquisition (DAQ) interface. Sensor
% data from the Basic Stamp can be sent to the StampDAQ program by either
% being saved in the EEPROM on the Basic Stamp and then "dumping" the
% information into StampDAQ all at once or by sending this information
% to StampDAQ as it is being recorded by the Basic Stamp. This program
% is designed to work exclusively on the former. The reason this program
% works especially for the latter is because time information is not
% important only the location of the Boe-Bot where the readings are taking
% place.

% Users
% For those who wish to use this code for their own data measurements the
% following information may prove useful. The parts of this code that would
% change depending on the information that one is trying to interpret are
% followed by a marking; marking: **(may need to change)**.

Read the Excel File

% Read the xls file that contains the data and store the numerical and
% non-numerical parts in data and text respectively
[data, text] = xlsread('Boe-BotPhotoTemp1');

Error Checking

% Double check data size.
fprintf('The size of data = %4.0f x %1.0f \n \n', size(data))

% The following lines are used so that the fprintf commands will work.
text1 = cell2mat(text(1,1)); %Stores name for type of sensor data stored
text2 = cell2mat(text(1,2)); %Stores name for type of sensor data stored
text3 = cell2mat(text(1,3)); %Stores name for type of sensor data stored
% **(may need to change, add or delete text#)**

% These two lines are used to display all the data and labels each data
% column. The number of data columns depends on number of each type of
% measurement used.
fprintf('%s \t %s \t %s\n', text1, text2, text3) %**(may need to change)**
fprintf('%6.0f \t \t %5.0f \t \t %4.0f \n', data') %**(may need to change)**
The size of data =   90 x 3 
 
 Location 	  PRRight 	  Temp(C)
     1 	 	    18 	 	   22 
     1 	 	    18 	 	   22 
     1 	 	    18 	 	   22 
     1 	 	    18 	 	   22 
     1 	 	    18 	 	   22 
     1 	 	    18 	 	   22 
     1 	 	    18 	 	   22 
     1 	 	    18 	 	   22 
     1 	 	    18 	 	   22 
     1 	 	    18 	 	   22 
     1 	 	    18 	 	   22 
     1 	 	    18 	 	   22 
     1 	 	    18 	 	   22 
     1 	 	    18 	 	   22 
     1 	 	    18 	 	   22 
     1 	 	    18 	 	   22 
     1 	 	    18 	 	   22 
     1 	 	    18 	 	   22 
     1 	 	    18 	 	   22 
     1 	 	    18 	 	   22 
     1 	 	    18 	 	   22 
     1 	 	    18 	 	   22 
     1 	 	    18 	 	   22 
     1 	 	    18 	 	   22 
     1 	 	    18 	 	   22 
     1 	 	    18 	 	   22 
     1 	 	    18 	 	   22 
     1 	 	    18 	 	   22 
     1 	 	    18 	 	   22 
     1 	 	    18 	 	   22 
     2 	 	   115 	 	   22 
     2 	 	   116 	 	   22 
     2 	 	   113 	 	   22 
     2 	 	   112 	 	   22 
     2 	 	   110 	 	   22 
     2 	 	   110 	 	   21 
     2 	 	   110 	 	   22 
     2 	 	   111 	 	   21 
     2 	 	   111 	 	   22 
     2 	 	   111 	 	   21 
     2 	 	   111 	 	   21 
     2 	 	   110 	 	   21 
     2 	 	   110 	 	   21 
     2 	 	   110 	 	   21 
     2 	 	   111 	 	   21 
     2 	 	   111 	 	   22 
     2 	 	   110 	 	   21 
     2 	 	   111 	 	   21 
     2 	 	   110 	 	   21 
     2 	 	   110 	 	   21 
     2 	 	   110 	 	   21 
     2 	 	   110 	 	   21 
     2 	 	   110 	 	   21 
     2 	 	   110 	 	   21 
     2 	 	   110 	 	   21 
     2 	 	   110 	 	   21 
     2 	 	   111 	 	   21 
     2 	 	   112 	 	   21 
     2 	 	   111 	 	   21 
     2 	 	   111 	 	   21 
     3 	 	    19 	 	   24 
     3 	 	    19 	 	   24 
     3 	 	    20 	 	   24 
     3 	 	    21 	 	   24 
     3 	 	    20 	 	   24 
     3 	 	    60 	 	   24 
     3 	 	    20 	 	   24 
     3 	 	    79 	 	   24 
     3 	 	    22 	 	   24 
     3 	 	    22 	 	   25 
     3 	 	    95 	 	   25 
     3 	 	    20 	 	   25 
     3 	 	    20 	 	   25 
     3 	 	    80 	 	   25 
     3 	 	    21 	 	   25 
     3 	 	    21 	 	   25 
     3 	 	    91 	 	   25 
     3 	 	    22 	 	   25 
     3 	 	    20 	 	   25 
     3 	 	    21 	 	   25 
     3 	 	    27 	 	   25 
     3 	 	    21 	 	   25 
     3 	 	    20 	 	   25 
     3 	 	    26 	 	   25 
     3 	 	    29 	 	   25 
     3 	 	    21 	 	   25 
     3 	 	    21 	 	   25 
     3 	 	    26 	 	   25 
     3 	 	    21 	 	   25 
     3 	 	    21 	 	   25 

Plot the Photoresister Data

% This module is designed to plot the time vs. light intinsity information.

% Because time information was not given we can assume that the readings
% are taken to be about one second appart.
t = [1:1:30];

% Set up photoresistor values for each location in seperate matricies.
PRRight = 200 - data(:,2);
PhotoResistorLoc1 = PRRight(1:30,1);
PhotoResistorLoc2 = PRRight(31:60,1);
PhotoResistorLoc3 = PRRight(61:90,1);


plot(t, PhotoResistorLoc1, '.', t, PhotoResistorLoc2, 'o', t, PhotoResistorLoc3, 'x'), ...
    xlabel('Time (sec)'), ylabel('Light Intinsity'), grid, ...
    legend('location 1', 'location 2', 'location 3','Location','Best'), ...
    title('Light Values Over Time in Three Locations')

Plot the Temperature Data

% This module is designed to plot the time vs. temperature information.

% Set up temperature values for each location in seperate matricies.
Temp = data(:,3);
TempLoc1 = Temp(1:30,1);
TempLoc2 = Temp(31:60,1);
TempLoc3 = Temp(61:90,1);


plot(t, TempLoc1, '.', t, TempLoc2, 'o', t, TempLoc3, 'x'), ...
    xlabel('Time (sec)'), ylabel('Temperature (C)'), grid, ...
    legend('location 1', 'location 2', 'location 3','Location','Best'), ...
    title('Temperature Over Time in Three Locations')