Pada artikel kali ini kita akan membahas mengenai modul mini data logger seperti gambar di bawah ini.

modul mini data logger ini biasa digunakan untuk merekam data baik dari sensor maupun data dari kontroller lainnya. Modul ini dilengkapi dengan slot sd card dan rtc untuk fungsi time-stamping yang menggunakan IC DS1307. Modul ini memiliki 8 pin i/O antara lain CS, MOSI, MISO,SCK,SCL,SDA,GND,and 5V pin. Untuk sd cardnya sendiri, modul ini support sd card dengan format FAT16 dan FAT32. Modul ini juga dilengkapi dengan baterai 3V tipe CR1220. Dimensi modul ini relatif kecil dengan ukuran lebih kurang 36.5mm x 33.6mm sehingga cocok digunakan dalam sistem yang compact.
Spesifikasi umum
1. Compatible dengan Arduino Uno, Duemilanove, Diecimila, Leonardo, Mega
2. Sudah terpasang regulator 3.3V
3. Terdapat Real-time Clock (RTC)
4. Interface SD Card support FAT16 dan FAT32. Terdapat circuit shifter untuk memproteksi SD Card dari kerusakan.
lalu bagaimana cara menggunakan/memprogramnya? simak tutorial di bawah ini ya.
Pada tutorial ini kita akan mencoba membaca data dari sensor temperatur menggunakan sensor DHT11 dan menyimpan pembacaan data sensor tersebut ke dalam SD card dalam bentuk TXT file menggunakan modul data logger ini.
Apa saja yang dibutuhkan?
- arduino nano
- modul mini data logger
- sensor DHT11
- wiring
- library arduino
- RTClib
- DHT sensor
- adafruit unified sensor
untuk file library nya bisa download disini ya Download library
Wiring


Program
Sebelum memprogram, pastikan kalian sudah memiliki/menginstal library yg akan digunakan ya…library bisa di download di link yang ada di atas.
Program yang akan kita buat nantinya akan seperti di bawah ini ya..

Penjelasan program
Untuk memudahkan dalam proses pengecekan program, setiap hasil dari proses akan ditampilkan pada serial monitor seperti gambar di atas ya
1. Status Pengecekan SD card, jika SD card berhasil terbaca di modul, maka status yang muncul adalah “SD card initialized”. Jika SD card tidak berhasil terbaca karena error atau SD card tidak di masukkan ke modul maka yang muncul adalah pesan “SD card initialization failed!”.
2. Data yang terbaca akan tersimpan pada file dengan nama “LOG008.TXT”. Jika sistem ter- reset / re-start data akan tersimpan pada nama “LOG009.TXT” , “LOG010.TXT” dan seterusnya.
3. Tanggal dan waktu yang terbaca/tersimpan pada modul RTC saat ini.
4. Opsi untuk mengganti tanggal dan waktu. Y untuk mengganti, dan N untuk tetap menggunakan data tanggal dan waktu seperti pada poin ke 3
5. Jika kalian ingin mengganti tanggal dan waktu, maka inputkan data dan waktu sesuai dengan format pada poin ke 5 ini. Jika format tidak sesuai, maka data waktu dan tanggal tidak akan tersimpan dan akan muncul notifikasi seperti pada poin ke 6
6. Notifikasi input data tanggal dan waktu tidak sesuai format
7. Jika berhasil mengganti format waktu dan tanggal maka akan muncul notifikasi seperti pada poin ke 7 ini yaitu “RTC updated!”
8. Sistem akan mulai membaca data sensor dan akan ditampilkan di serial monitor
9. Data sensor berhasil tersimpan di SD card dengan nama file yang tertera di poin ke 2
Video
Program
#include <Wire.h>
#include <RTClib.h>
#include <SPI.h>
#include <SD.h>
#include <DHT.h>
#define DHTPIN 2
#define DHTTYPE DHT11
#define CSPIN 10
DHT dht(DHTPIN, DHTTYPE);
RTC_DS1307 rtc;
File logFile;
char filename[13]; // 8.3 format: "LOG001.TXT"
void setup() {
Serial.begin(9600);
while (!Serial);
dht.begin();
Wire.begin();
if (!rtc.begin()) {
Serial.println("Couldn't find RTC");
while (1);
}
if (!SD.begin(CSPIN)) {
Serial.println("SD card initialization failed!");
while (1);
}
Serial.println("SD card initialized.");
createNewLogFile();
logFile = SD.open(filename, FILE_WRITE);
if (logFile) {
logFile.println("Date,Time,Temp,Humidity");
logFile.close();
Serial.print("Logging to: ");
Serial.println(filename);
} else {
Serial.println("Failed to create log file.");
while (1);
}
DateTime now = rtc.now();
printDateTime(now);
Serial.println("\nUpdate RTC time? (Y/N)");
while (true) {
if (Serial.available()) {
char response = Serial.read();
if (response == 'Y' || response == 'y') {
Serial.println("Enter: YYYY/MM/DD HH:MM:SS");
while (true) {
if (Serial.available()) {
char buffer[32];
byte len = Serial.readBytesUntil('\n', buffer, sizeof(buffer) - 1);
buffer[len] = '\0';
if (parseAndSetTime(buffer)) {
Serial.println("RTC updated!");
break;
} else {
Serial.println("Invalid. Try again:");
}
}
}
break;
} else if (response == 'N' || response == 'n') {
Serial.println("Using current RTC time.");
break;
}
}
}
}
void loop() {
DateTime now = rtc.now();
float h = dht.readHumidity();
float t = dht.readTemperature();
if (isnan(h) || isnan(t)) {
Serial.println("Failed to read from DHT!");
delay(5000);
return;
}
logFile = SD.open(filename, FILE_WRITE);
if (logFile) {
String data = String(now.year()) + "/" + String(now.month()) + "/" + String(now.day()) + " " +
String(now.hour()) + ":" + String(now.minute()) + ":" + String(now.second()) + ", " +
String(t) + " C, " + String(h) + " %";
logFile.println(data);
logFile.close();
Serial.println(data);
Serial.println("Data Saved");
} else {
Serial.println("Error opening file for writing.");
}
delay(5000);
}
void createNewLogFile() {
for (int i = 1; i <= 999; i++) {
sprintf(filename, "LOG%03d.TXT", i);
if (!SD.exists(filename)) {
return;
}
}
strcpy(filename, "LOG999.TXT");
}
bool parseAndSetTime(char* input) {
int y, m, d, hh, mm, ss;
if (sscanf(input, "%d/%d/%d %d:%d:%d", &y, &m, &d, &hh, &mm, &ss) == 6) {
rtc.adjust(DateTime(y, m, d, hh, mm, ss));
return true;
}
return false;
}
void printDateTime(const DateTime& dt) {
Serial.print(dt.year()); Serial.print('/');
Serial.print(dt.month()); Serial.print('/');
Serial.print(dt.day()); Serial.print(" ");
Serial.print(dt.hour()); Serial.print(':');
Serial.print(dt.minute()); Serial.print(':');
Serial.println(dt.second());
}
The login process is super quick and I haven’t faced any glitches so far. Great job on the optimization! 7sjilicomlogin
Fast transactions and a very secure feeling. It is hard to find sites this trustworthy these days. pkbitpkr is a total gem.
The variety of games available here is impressive. I spent the whole weekend exploring different tables and everything works perfectly. Highly recommended for PH players. Explore phjili98
The VIP bonuses here are actually worth it. I felt the difference in rewards compared to other sites. Give 25phwinvip a try if you want better perks.
I really appreciate the customer support here. They helped me fix my login issue in minutes. Five stars for jili123casinologin.
I was skeptical at first but the withdrawals are legit and quick. It’s refreshing to find a site like winxx705 that actually pays out.
Quick and easy access to my account. I appreciate how they keep the login process secure yet simple. Totally satisfied with naga777login.
The registration process was a breeze and I was playing in under two minutes. Everything is very professional and secure. Glad I found the ap999login portal.
This place feels like a high-end casino right from your living room. The graphics are top-notch and the bonuses are actually fair. Definitely spending my weekends at krwincasino.
Been playing here for a month now and it is honestly one of the best experiences I have had. The layout is very user friendly. Visit vnks168 for a top notch experience.
Super addictive games and the daily rewards keep me coming back. I have told all my friends to join phjilii already!
I’ve had some crazy wins here recently! The excitement is real and the atmosphere is just right for gaming. I’m addicted to x8888slot now.
Such a refreshing platform with a huge selection of slots. I had a lucky streak here last night and the win felt great. Check out phnn7770 for some action.
Downloading the game was a breeze and it runs perfectly on my phone. I am really enjoying the variety of games available. Go to 799pakgamedownload to grab the app.
Logging in is a breeze and I never face any glitches. It is the most stable app I have used so far. Just head over to bjbajiapplogin.
I rarely pass along links in comments, but for once I felt it was worth it. When surfing different resources recently, I came across [url=https://xox96-au.com]xox96[/url] — and I have to say it genuinely impressed me. The design is clean, the information is well-researched, and everything loads smoothly. I have already bookmarked it and will return later. If you’re interested in the same kind of subjects, my advice is take a peek — you probably won’t waste your time.
Finally found a link that actually works without any glitches. The login process is seamless. Cheers to brazino777login for the great service.
Super easy to navigate and the rewards system is actually rewarding. I love how simple it is to start playing. Download okplayslotapp
Great site with a very friendly vibe. I really appreciate the customer support and the easy navigation. Five stars for idmpo303 for making gaming so easy.
Solid platform with great customer support. I had a small issue with my deposit but they sorted it out in minutes. bdo444 is legit and trustworthy.
Login is super quick and the game variety is impressive. I spend most of my weekends on ph333comcasinologin now.
Best slot games I have found in the Philippines recently. The interface is very friendly for mobile users. Love phjilibet019!
I love the vibe of this site. It feels professional yet exciting. I’ve had a few big wins already at casinowinoui.
This place is a hidden gem! The jackpot hits are more frequent than other sites I have used. Check out phsz777asia now.
This site is a hidden gem. The graphics are crisp and the gameplay is lag-free. I am spending way too much time on pkpak33game lately.