Site icon Circuit Ideas for You

Simple Micro SD Card Data Logging Circuit with Arduino UNO

Accurate data logging is very important in electronics and data work.

This project for Simple Micro SD Card Data Logging Circuit with Arduino UNO show how to use micro SD card, IC 7809 and LM35 sensor to make simple data logger.

It saves temperature data to SD card and later we can check data for things like environment check, experiments or for teaching.

Code:

#include <SPI.h>
#include <SD.h>

const int chipSelect = 10; // SD card select pin
const int tempPin = A0;

void setup() {
  Serial.begin(9600);
  Serial.println("Initializing SD card...");

  if (!SD.begin(chipSelect)) {
    Serial.println("Card failed, or not present");
    return;   

  }
  Serial.println("Card initialized.");   


  // Create a file on the SD card
  File dataFile;
  dataFile = SD.open("temperature.txt", FILE_WRITE);

  // Write a header to the file
  dataFile.println("Time, Temperature (Celsius)");
  dataFile.close();
}

void loop() {
  // Read the temperature from the LM35
  int sensorValue = analogRead(tempPin);
  float temperature = (sensorValue * 5.0) / 1023.0 * 100.0; // Adjust formula as needed

  // Get the current time
  DateTime now = DateTime.now();

  // Write the data to the file
  File dataFile;
  dataFile = SD.open("temperature.txt", FILE_WRITE);
  dataFile.print(now.hour());
  dataFile.print(":");
  dataFile.print(now.minute());
  dataFile.print(":");
  dataFile.print(now.second());
  dataFile.print(",");
  dataFile.println(temperature);   

  dataFile.close();

  // Print the data to the serial monitor
  Serial.print("Temperature: ");
  Serial.print(temperature);
  Serial.println(" degrees Celsius");

  delay(1000); // Delay for 1 second
}

Code Explanation:

Circuit Working:

Parts List:

ComponentQuantity
Arduino UNO1
Micro SD Card Module1
IC 7809 Voltage Regulator1
IC LM35 Temperature Sensor1

Arduino UNO is popular and flexible board for many electronics projects.

It works like main brain which connects with other parts and collect and control data.

Micro SD card is used for saving data which is easy to use and can store more.

LM35 sensor gives temperature.

In this project it saves temperature to SD card.

Voltage regulator gives steady 9V power.

It is important to give right power to parts for good work.

LM35 is accurate sensor and gives analog output as temperature.

It reads outside temperature and send to Arduino.

How to Build:

To build a Simple Micro SD Card Data Logging Circuit with Arduino UNO following are the steps for connections:

Conclusion:

This Simple Micro SD Card Data Logging Circuit with Arduino UNO is basic design.

We can make it better by storing data for long time, adding more sensors and by connecting with other systems for display or analysis

If we understand this project we can build custom data loggers for many uses.

References:

Sd card problems and data logging

Exit mobile version