Professional Documents
Culture Documents
AND CONTROL
Experiment No. 4: Data Logger using Arduino
OBJECTIVES
COMPONENTS/EQUIPMENT
Computer/Laptop (with Arduino IDE)
RTC DS3231
SD Card Module
Breadboard
Male to Female DuPont Wire
Male to Male DuPont Wire
INTRODUCTION/DISCUSSION
The DS3231 can keep track of seconds, minutes, hours, days, dates, months, and
years. For months with fewer than 31 days, it automatically adjusts the date at the end
of the month, including leap year corrections (valid up to 2100). It can work in either a
12-hour or 24-hour format and has an AM/PM indicator. It also has two time-of-day
alarms that can be programmed.
SD cards are widely used in various applications, such as data logging, data visualization,
and many more. Micro SD Card Adapter modules make it easier for us to access these
SD cards with ease. The Micro SD Card Adapter module is an easy-to-use module with
an SPI interface and an on-board 3.3V voltage regulator to provide proper supply to the
SD card.
PROCEDURES
CODE:
#include <EduIntro.h>
#include <Wire.h>
#include <ds3231.h>
#include <SPI.h>
#include <SD.h>
struct ts t;
void setup()
Serial.begin(9600);
Wire.begin();
DS3231_init(DS3231_CONTROL_ADDR);
t.hour = 11;
t.min = 05;
t.sec = 0;
t.mday = 23;
t.mon=12;
t.year=2022;
DS3231_set(t);
while (!Serial){
if (!SD.begin(10)){
while(1);
void loop(){
dht11.update();
DS3231_get(&t);
if (dataFile){
dataFile.print("Date : ");
dataFile.print(t.mday);
dataFile.print("/");
dataFile.print(t.mon);
dataFile.print("/");
dataFile.print(t.year);
dataFile.print(t.hour);
dataFile.print(t.min);
dataFile.print(".");
dataFile.print(t.sec);
dataFile.print(" : ");
dataFile.print("H: ");
dataFile.print(H);
dataFile.print("\tC: ");
dataFile.println(C);
dataFile.close();
Serial.print("Date : ");
Serial.print(t.mday);
Serial.print("/");
Serial.print(t.mon);
Serial.print("/");
Serial.print(t.year);
Serial.print(t.hour);
Serial.print(":");
Serial.print(t.min);
Serial.print(".");
Serial.print(t.sec);
Serial.print("H: ");
Serial.print(H);
Serial.print("\tC: ");
Serial.println(C);
else{
RTC DS3231
5-12 NC No Connection
13 GND Ground
SD CARD MODULE
GND Ground
CONCLUSION
At the end of this experiment we were able to design a data logger a device
that save data from time to time. We use RTC (Real Time Clock). Details like the second,
minute, hour, day of the week, day of the month, month, and year—including the leap
year clarification provided by the module. Another intriguing feature is that it may run in
either a 12 or 24-hour mode. Data logging, data visualization, and many more
applications utilize SD cards or Micro SD cards often. We can access these SD cards
where we can store our data with simplicity thanks to Micro SD Card Adapter modules.
The Micro SD Card Adapter module is a user-friendly device with an SPI interface and
an internal 3.3V voltage regulator to supply the SD card with the appropriate power.
Data logger technology is evolving more quickly than ever. A device that
captures data but also has access to wireless communications for event warning,
automatic data reporting, and remote control is replacing the classic model of a stand-
alone data logger. Data loggers are starting to offer web sites for real-time readings,
email alarms, and FTP daily findings directly to users or into databases. There has been a
recent movement toward switching from proprietary items with commercial software to
hardware and software that are open source.