Hello guys in this tutorial we are going to see how to take arduino sensor data to excel sheet and plot it for analysis. So let’s get started. For this you will need a software Tera Term. Which will take Arduino data to excel sheet. You can take any sensor data with this software.

  1. Arduino
  2. Breadboard
  3. Jumper Wire
  4. 10K ohms Resistor
  5. DHT22 sensor.

For this tutorial we are going to make temperature go high with hot air of hair dryer and sensor data will be plotted in excel sheet. If you want to know more about temperature sensor with Arduino you can read tutorial click on the link. After downloading software Tera term. Install it. Now you can see its icon on desktop but before opening it go to Arduino IDE.

 Serial.println("Date & Time, Humidity %, Temperature *C, Temperature *F");

And add this line in setup function.

Download DHT library from Github OR you can download it from here because github library may change by the time or it may not work.

Download DHT-sensor-library-master.zip

Sketch:

#include “DHT.h”
#define DHTPIN 2 // what digital pin we’re connected to

// Uncomment whatever type you’re using!
//#define DHTTYPE DHT11 // DHT 11
#define DHTTYPE DHT22 // DHT 22 (AM2302), AM2321
//#define DHTTYPE DHT21 // DHT 21 (AM2301)
DHT dht(DHTPIN, DHTTYPE);

void setup() {
 Serial.begin(9600);
 Serial.println("Date & Time, Humidity %, Temperature *C, Temperature *F");
 dht.begin();
}

void loop() {
 // Wait a few seconds between measurements.
 delay(1000);
// Reading temperature or humidity takes about 250 milliseconds!
 // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
 float h = dht.readHumidity();
 // Read temperature as Celsius (the default)
 float t = dht.readTemperature();
 // Read temperature as Fahrenheit (isFahrenheit = true)
 float f = dht.readTemperature(true);

// Check if any reads failed and exit early (to try again).
 if (isnan(h) || isnan(t) || isnan(f)) {
 Serial.println("Failed to read from DHT sensor!");
 return;
 }
 Serial.print(",");
 Serial.print(h);
 Serial.print(",");
 Serial.print(t);
 Serial.print(",");
 Serial.println(f);
}
Explanation:

Depend upon your sketch you can decide how many numbers of columns you require.

 Serial.println("Date & Time, Humidity %, Temperature *C, Temperature *F");

We want 4 columns first column is for date & time. But make sure each column is separated with comma (,). Then second column is for humidity then temperature in Celsius & temperature in Fahrenheit. And also make sure it is printed in new line.

 Serial.print(",");
 Serial.print(h);
 Serial.print(",");
 Serial.print(t);
 Serial.print(",");

We are adding comma before humidity because first column is for date and time it will be generated by tera term software. So each data is separated by comma. Make sure it is in same line. In last line it is println.

Serial.println(f);

Now open the tera term software.

Select serial and port.

Go to file and click on log.

Check the box timestamp because we want date and time also. It will ask where we want to save this log file. I am saving it on desktop. Make sure you save it with .csv file. So it will create excel sheet. After saving log file press reset button on Arduino. Now I am making temperature go high by hot air of hair dryer. After taking readings you can close the tera term software.

Go to desktop and open file. Select all column and go to chart and plot all three data in one graph.

How to take Arduino sensor data to excel sheet and plot it for analysis.

You can plot only one data at a time just select two column and plot it.

one graph for arduino sesnor data to excel sheet

This data can be used for further analysis.

Till then keep learning keep.