Arduino Data Logger Project – Very Easy

Arduino Data Logger Project – Very Easy


Dear friends welcome back! Today we build a datalogger. Let’s start! This project reads the
temperature every few minutes and store the data in a micro SD card it is the simplest possible datalogger. It consists of an Arduino Nano, this one here a DS3231 Real time clock module, this one here, and an SD card module. This module here. The DS3231 RTC has a temperature sensor embedded so we don’t need any other components except from those two modules. The cost of the project is very low. 3 Euros for the Arduino Nano, 2 Euros for the SD card module and about 1,5 Euros for the Real Time clock. So the total cost is around 6,5 Euros. Let’s now see how to connect those modules together in order to build this simple datalogger. I have removed all the wires in order to
show you how to connect the modules. for details about each module please check our previous tutorials. We have prepared detailed tutorials for each module. So let’s start by connecting the power on each module. Vcc is connected, Vcc from each module goes to breadboard Vcc, and we have connected the breadboard Vcc to Vin on the Arduino Nano. We have connected all the Grounds to the breadboard Ground. Now, let’s connect the Real Time Clock. Pin SCL from the Real Time Clock goes to analog pin 5 on the Arduino Nano. Pin SDA from the Real Time Clock goes to analog pin 4 on the Arduino Nano. Now let’s connect the SD card module. Pin MISO goes to digital pin 12 on Arduino nano. Pin MOSI goes to digital pin 11. Pin SCK goes to digital pin 13. And lastly pin CS goes to digital pin 10. Now we are ready to connect power to the breadboard. I have connected this power bank to the breadboard and now are ready to log data.Now let’s go to the computer and see how to program this project. This is the code the project. In order to better understand how it
works watch the tutorials DS3231 real-time clock and the SD card much module. Also note that we are using Arduino IDE 1.6 .1 the latest
version available today. This code won’t work on
the Arduino IDE previous than the 1.6 so update your Arduino to the latest
version if you want to use this code. We are using the rodan library for the real time clock today. The first time that we upload the program to the Arduino we have to set time if it is now already set. So we have to uncomment this line here and enter the correct time and date. So the first argument, this argument here is the year, the month, the day of the
month, day of the week, fourth day, time in hours, minutes and seconds. We upload the program once, we
run it on Arduino and it sets time. Then we comment this line here and we upload it again. If we upload the program to Arduino and open the Serial Monitor we can see that the program produces a line of data every second. This line includes that ID of the entry, the date the time and the temperature. That line is then stored in the micro SD card. You
can change the time that Arduino creates a new enrty by changing this variable here. The interval which represents time in milliseconds so If we want Arduino to enter an entry in the file every minute we have to make the interval 60,000 like this. If we now upload the program to Arduino it will store an entry every minute. I run this program outside for 24 hours and I stored temperature every five minutes. So I had my interval set to 300000 milliseconds. Before we place that datalogger outside in order to log data, let’s calculate how long it can last on batteries. The current draw now is around 30mA. So, with this power bank it stay on for around three days.
Most of the power is consumed by those two LEDs that are lit all the time. If we remove them, we can reduce the power consumption and log data for more days. This time I am going to log data for only one day. So this power bank is more than enough. Let’s do it. After 24 hours we have this
file stored in the SD card. It contains almost 300 entries. Each value in every entry is separated by a comma so it is very easy to import this file to Excel and plot the data. Let’s see. We open a blank workboon in Excel and we click on the Data tab. The we select “From Text” and from there we select the file that Arduino created. We open that file and we say that it
is of course the delimited and it is delimited by commas as we
saw before, and we press finish. Then we import all the data in the existing workbook and as you can see all the data are now in an Excel file. Very easy. Now all we have to do is to plot the
data. We select the two columns that we are
interested in time and temperature by holding
control down and we go to insert tab and we insert a chart. That’s it! As you can see this is an easy and
low-cost project. We will add more sensor to it in the future and we will try to increase its battery
life with various techniques So stay tuned! If you want to support our
channel press the like button or subscribe to our
channel in order to the future videos. If you have any project
that you would like to build in the future post them in the comments
below… and see you soon!