0% found this document useful (0 votes)
28 views

How To Save Arduino Serial Data in TXT, CSV and Excel File Without Using Data Logger Shield - Vidyasagar Academy Akola

Taken from a website. Useful info. Thanks for the contributor

Uploaded by

putmy
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views

How To Save Arduino Serial Data in TXT, CSV and Excel File Without Using Data Logger Shield - Vidyasagar Academy Akola

Taken from a website. Useful info. Thanks for the contributor

Uploaded by

putmy
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

6/20/24, 11:52 AM How to save Arduino Serial data in TXT, CSV and Excel file without using data

t using data logger shield? - Vidyasagar Academy Akola

Click here to register for summer batches of robotics. Click here for details of courses.

₹0.00

RESEARCH & EXTENSION HOW & WHY

How to save Arduino Serial data in TXT, CSV


and Excel file without using data logger
shield?
RESEARCH & EXTENSION
HOW TO SAVE ARDUINO SERIAL DATA IN TXT, CSV AND EXCEL FILE WITHOUT USING DATA LOGGER SHIELD?

DATTARAJ VIDYASAGAR FEBRUARY 8, 2023 JANUARY 4, 2024

This entry is part 2 of 4 in the series How & Why

How & Why


How to use Arrays in Arduino coding?
How to save Arduino Serial data in TXT, CSV and Excel file without using data logger shield?
What to do if the theme editor option in WordPress dashboard disappeared?
How analog pin works & how PWM signal is obtained in Arduino UNO/Nano?

The use of data logger shield in Arduino is rather critical and everyone may not have
the data logger shield readily available to create the log of readings in Arduino.

So this article explains how to save Arduino Serial data in TXT, CSV and Excel file
without using data logger shield?

https://vsa.edu.in/how-to-save-arduino-serial-data-in-txt-csv-and-excel-file-without-using-data-logger-shield/?nsl-notice=1 1/13
6/20/24, 11:52 AM How to save Arduino Serial data in TXT, CSV and Excel file without using data logger shield? - Vidyasagar Academy Akola

Also refer our Arduino Tips & Tricks and Arduino Tested Projects. Download all
Library Files and Fritzing Parts file for better study with Arduino.

Now suppose we have create log of real time temperature and humidity, using DHT11
sensor with Arduino. For that we will use a simple code, as follows.

Contents [ show ]

Simple Arduino code


To understand the process of saving Arduino Serial data in txt, csv and Excel file, we
will use a simple Arduino code which uses Serial.print() commands. Let us see the
code first.

/*
* Code for the article:
* How to save Arduino Serial data
* in TXT, CSV and Excel file
* without using data logger shield?
* Vidyasagar Academy, Akola
* www.vsa.edu.in
*/

#include <dht.h>

int output=7; // connect output pin of DHT11 to pin-7


int readdata; // DHT data to store
int Temperature; // variable to store temperature value
int Humidity; // variable to store humidity value

dht DHT; // creating DHT object

void setup()
{

https://vsa.edu.in/how-to-save-arduino-serial-data-in-txt-csv-and-excel-file-without-using-data-logger-shield/?nsl-notice=1 2/13
6/20/24, 11:52 AM How to save Arduino Serial data in TXT, CSV and Excel file without using data logger shield? - Vidyasagar Academy Akola

Serial.begin(9600);
}

void loop()
{
readdata = DHT.read11(output);

Temperature = DHT.temperature; // reading temperature


Humidity = DHT.humidity; // reading humidity

Serial.print(Temperature);
Serial.print(",");
Serial.println(Humidity);

delay(1000); // create reading log at every second


}

Note: To run this code in Arduino IDE you will need DHT library. You can download it
from this link. To add the downloaded zipped file, open Arduino IDE and click on
“Sketch” menu. Then go to “Include Library” and then click on “Add .Zip Library, as
shown below.

It is important to note the following piece of code used to print the Serial data. This is
because we have to import the Serial data with comma delimited values in Excel file.

Serial.print(Temperature);
Serial.print(",");
https://vsa.edu.in/how-to-save-arduino-serial-data-in-txt-csv-and-excel-file-without-using-data-logger-shield/?nsl-notice=1 3/13
6/20/24, 11:52 AM How to save Arduino Serial data in TXT, CSV and Excel file without using data logger shield? - Vidyasagar Academy Akola

Serial.println(Humidity);

The first line in above code prints the “Temperature” value and the second line puts a
comma (,) after the Temperature value.

Then the third line prints “Humidity” value. Since we used Serial.println() in this third
line, due to carriage return, the next two values will be printed in next line and so on…

Download Data logging software


Now that you are ready with the code, follow these steps for data logging –

1. Download CoolTerm data logger software from this link (File size: 20MB).
2. After downloading, unzip the file and copy the folder inside the zip file on your
PC.
3. Open the folder and right click on CoolTerm.exe icon and create desktop
shortcut on your PC.

4. Now connect your Arduino board through data cable to your PC and upload the
code in Arduino UNO or Arduino nano.
5. Do not open Serial Monitor or Serial Plotter. Just note down the COM port to
which your Arduino is connected to. In my case, it is connected to COM3 port.
6. Now open CoolTerm application.
7. Click on “Options” menu and then click on “Port”. This field should show you the
COM port number to which your Arduino is connected to. Then click OK. Here I
am using the Baudrate as 9600.

https://vsa.edu.in/how-to-save-arduino-serial-data-in-txt-csv-and-excel-file-without-using-data-logger-shield/?nsl-notice=1 4/13
6/20/24, 11:52 AM How to save Arduino Serial data in TXT, CSV and Excel file without using data logger shield? - Vidyasagar Academy Akola

8. Click on “Connections” in menu, go to “Capture to Text/Binary File” and click on


“Start”, as shown below.

https://vsa.edu.in/how-to-save-arduino-serial-data-in-txt-csv-and-excel-file-without-using-data-logger-shield/?nsl-notice=1 5/13
6/20/24, 11:52 AM How to save Arduino Serial data in TXT, CSV and Excel file without using data logger shield? - Vidyasagar Academy Akola

9. Now a new window will open where you have write the name of the file.
10. Finally click on “Connect” button of CoolTerm application to start recording the
data entries in the text file, as shown below.

11. Once you have sufficient data entries, click on “Connections”, go to “Capture to
Text/Binary File” and click on “Stop”.
12. Then click on “Disconnect” button.
13. This will complete data logging process.

https://vsa.edu.in/how-to-save-arduino-serial-data-in-txt-csv-and-excel-file-without-using-data-logger-shield/?nsl-notice=1 6/13
6/20/24, 11:52 AM How to save Arduino Serial data in TXT, CSV and Excel file without using data logger shield? - Vidyasagar Academy Akola

Import TXT file in Excel


1. You must have the txt file, generated by CoolTerm either on desktop or in a
folder.

2. Now open Microsoft Excel and click “Open” in its menu. Then click on “All files”
in bottom right corner as shown below and select “Text Files (*.prn, *.txt, *.csv)”.

3. Now it will show you your text file generated by CoolTerm. Select the file and
click “Open”.
4. This will open text import wizard.
5. Select “Delimited” button and then click “Next”.
6. Now as shown below, deselect “Tab” option and select “Comma” option, then
click “Next”.

https://vsa.edu.in/how-to-save-arduino-serial-data-in-txt-csv-and-excel-file-without-using-data-logger-shield/?nsl-notice=1 7/13
6/20/24, 11:52 AM How to save Arduino Serial data in TXT, CSV and Excel file without using data logger shield? - Vidyasagar Academy Akola

7. Finally click “Finish” and now your TXT file will be converted into two columns in
Microsoft Excel table, as shown below.

How to create graph of the data entries?


https://vsa.edu.in/how-to-save-arduino-serial-data-in-txt-csv-and-excel-file-without-using-data-logger-shield/?nsl-notice=1 8/13
6/20/24, 11:52 AM How to save Arduino Serial data in TXT, CSV and Excel file without using data logger shield? - Vidyasagar Academy Akola

1. Since your data entries are imported into MS Excel in two columns, you can
now create graph of the entries.
2. Insert one row above the data entries and give headings to the two columns as
Temperature and Humidity, as shown below.
3. For that click on “Insert” menu and then select “Line” graph option.

4. Instantly the graph will be displayed as follows.

Still More simple solution…

https://vsa.edu.in/how-to-save-arduino-serial-data-in-txt-csv-and-excel-file-without-using-data-logger-shield/?nsl-notice=1 9/13
6/20/24, 11:52 AM How to save Arduino Serial data in TXT, CSV and Excel file without using data logger shield? - Vidyasagar Academy Akola

Just ignore all above methods and let us see the simplest possible method, as given
below.

1. Run the code of Temperature and Humidity sensor, given above.


2. Then open the Serial Monitor in Arduino IDE.
3. You will see the readings like this –

27, 22
27, 22
28, 20
27, 23
29, 20
30, 21
29, 20
28, 20
28, 21
29, 20
29, 20

4. Now copy these readings from Serial Monitor and paste them in
a filename.txt file.
5. Then import this .txt file in MS Excel.
6. Create a header row and give labels to the two quantities like Temperature &
Humidity.
7. The click on “Data” tab in MS Excel and import your .txt file with “Comma
delimited” style, as shown below.

8. Then click on “Insert” tab in MS Excel and create graph.

That’s it…! You did it…!

https://vsa.edu.in/how-to-save-arduino-serial-data-in-txt-csv-and-excel-file-without-using-data-logger-shield/?nsl-notice=1 10/13
6/20/24, 11:52 AM How to save Arduino Serial data in TXT, CSV and Excel file without using data logger shield? - Vidyasagar Academy Akola

Tags

# arduino data logger # use excel to produce graph

Share on your network!

Dattaraj Vidyasagar

Author on this website. He is veteran of Core Electronics since


last 35+ years. ATL Mentor of Change, Niti Ayog, Govt. of India,
Google Certified Educator, International Robotics Trainer and
author of 17 books on electronics, robotics, programming
languages and web designing... ➤➤

PREVIOUS POST
NEXT POST
How analog pin works & how
AR-B8: Servo Motor Basic
PWM signal is obtained in
Code
Arduino UNO/Nano?

Leave a Reply
Logged in as waste mail. Edit your profile. Log out? Required fields are marked *

https://vsa.edu.in/how-to-save-arduino-serial-data-in-txt-csv-and-excel-file-without-using-data-logger-shield/?nsl-notice=1 11/13
6/20/24, 11:52 AM How to save Arduino Serial data in TXT, CSV and Excel file without using data logger shield? - Vidyasagar Academy Akola

Add Comment *

Notify me via e-mail if anyone answers my comment.

Post Comment

Search

Search

Searching for Courses?

We offer electronics, robotics and web designing courses. Read more,


download syllabus and know fees structure.

Courses

Custom Website Development

Want to design custom & low cost website? We build beautiful Personal
Websites and Educational Websites with .edu domain. Contact us with your
requirements.

Contact

https://vsa.edu.in/how-to-save-arduino-serial-data-in-txt-csv-and-excel-file-without-using-data-logger-shield/?nsl-notice=1 12/13
6/20/24, 11:52 AM How to save Arduino Serial data in TXT, CSV and Excel file without using data logger shield? - Vidyasagar Academy Akola

Contact Info About

Address: About Us

Near 12-Jyotirling Temple, Behind Our Courses

Samyak Library, Ranpise Nagar, Achievements

Akola 444001, M.S. India Activities


Robotics Workshops
Mobile: Events
+91 99 60 991 991 Vidyasagar Academy Forum
Contact
Email:
[email protected] Contact online
Appointments
Opening Hours:
FAQ
8AM - 7PM
Disclaimer Statement

Students Corner XII Electronics & CS

Downloads All about XII Electronics


Learn Basic Electronics XII Electronics Study Material
Basic Electronic Circuits XII Electronics Download PDF Notes
Arduino Basic Circuits XII Electronics Download Syllabus
Advanced Arduino Projects XII Standard CS Complete Notes
Arduino Useful Downloads XII Standard CS Downloads
Programming Languages
Web Dev
Internship Program Visitors this Year
Research & Extension

Copyright © 2024 - Vidyasagar Academy, All rights reserved. Designed by: Prof. Dattaraj
Vidyasagar

https://vsa.edu.in/how-to-save-arduino-serial-data-in-txt-csv-and-excel-file-without-using-data-logger-shield/?nsl-notice=1 13/13

You might also like