0% found this document useful (0 votes)
22 views5 pages

SD Card Module and Datalogging

Uploaded by

luceromarialle
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views5 pages

SD Card Module and Datalogging

Uploaded by

luceromarialle
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

SD Card Module and

Datalogging
VCC pin provides power to the
module and should be connected to
the Arduino’s 5V pin.

GND is a ground pin.

MISO (Master In Slave Out) is the SPI


output from the microSD card
module.

MOSI (Master Out Slave In) is the SPI


input to the microSD card module.

SCK (Serial Clock) pin accepts clock


pulses from the master (an Arduino in
our case) to synchronize data
transmission.

CS (Chip Select) pin is a control pin


that is used to select one (or a set) of
slave devices on the SPI bus.
Wiring the MicroSD Card Module

Arduino Pin DHT11 Pin


Vcc 5V
GND GND
Data 6
As shown in the circuit diagram, the
connections are very simple since all the
components are used as modules, we can
directly connect them on a breadboard. The
SD card module is connected to the Arduino
through the SPI communication. The SPI pins
on the Arduino are pins 10, 11, 12, and 13. The
connections are further classified in the table
below:
#include <SPI.h> //Library for SPI communication (Pre-Loaded into Arduino)
#include <SD.h> //Library for SD card (Pre-Loaded into Arduino)
#include "DHT.h"
#define DHTTYPE DHT11 // DHT 11
uint8_t DHTPin = 6;
DHT dht(DHTPin, DHTTYPE);
float Temperature;
float Humidity;
const int chipSelect = 10; //SD card CS pin connected to pin 4 of Arduino
void setup()
{
// Setup Serial connection
Serial.begin(9600);
pinMode(DHTPin, INPUT);
dht.begin();
Initialize_SDcard();
}
void loop()
{
Write_SDcard();
Read_TempHum();
delay(5000); //Wait for 5 seconds before writing the next data
}
void Read_TempHum()
{
Temperature = dht.readTemperature();
Humidity = dht.readHumidity();
Serial.print("Temperature = ");
Serial.println(Temperature);
Serial.print("Humidity = ");
Serial.println(Humidity);
// delay(1000);
}
void Initialize_SDcard()

You might also like