Pages

Sunday, 23 November 2014

Data Logger Sheild Compatible for Arduino



Quick Overview:
The data logger is a reliable, well-rounded and versatile design. It is easily expandable with wireless interface like Xbee and Bluetooth. Can be used for saving data to files on any FAT16 or FAT32 formatted SD card, to be read by any plotting, spreadsheet or analysis program. The included Real Time Clock timestamps all your data with the current time, so that you know precisely what happened when.



Data Logger Sheild Compatible for Arduino I/O Connections:








Data Logger Sheild Compatible for Arduino Features:


  • SD card interface works with FAT16 or FAT32 formatted cards. 3.3v level shifter circuitry prevents damage to your SD card.
  • Real time clock (RTC) keeps the time going even when the Arduino is unplugged. The battery backup lasts for years.
  • 3.3V voltage level converter for memory card,  reliably runs SD cards that require a lot of power to run.
  • Optional Bluetooth and Xbee interface.
  • High quality PCB FR4 Grade with FPT Certified.


Data Logger Sheild Compatible for Arduino Documents and Codes:


/*
* Project name:
Data Logger Sheild Compatible for Arduino
* Copyright
(c) Researchdesignlab.com
* Description:
* Test configuration:
MCU: ATMEGA328
Dev.Board: Arduino uno
Oscillator: 16 MHz
Software: Arduino
*/
/*
WHEN THE XBEE RECIVE THE DATA 
'S' = DATA LOGGER START STORING DATA TO SD CARD 
'P' = PAUSE THE STORING DATA TO SD CARD
'R' = READ THE DATA FROM THE SD CARD AND TRANSIMIT THROUGH XBEE
*/
#include <Wire.h> 
#include "RTClib.h" 
#include <SD.h>

RTC_DS1307 RTC;
File myFile;

int Serial_value = 0; // value read from the xbee
const int analogInPin = A0; // Analog input pin that the potentiometer is attached to
int sensorValue = 0;
int START_STORE = 0;
void setup() 
{
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
Serial.println(" Wireless Xbee Data Logger Sheild ");
Wire.begin(); 
RTC.begin(); 
RTC.adjust(DateTime("Jun 20 2014","17:11:45")); //INIT of Time and Date


pinMode(10, OUTPUT);

if (!SD.begin(10)) {
Serial.println("initialization failed!");
return;
}
Serial.println("initialization done."); 
myFile = SD.open("RDL.txt", FILE_WRITE); //creating open RDL.text file
}
void loop() 
{
if (Serial.available()) //check If data is received form xbee 
{
Serial_value=Serial.read(); // read the received data form xbee 
if(Serial_value=='S'){ //Xbee value is equal to 'S' 
myFile = SD.open("RDL.txt", FILE_WRITE);
if (myFile) { //Enable data logger to store data in SD card
START_STORE=1;
Serial.println("Enable data logger to store data ");
}
else
Serial.println("Error opening RDL.txt");


else if(Serial_value=='P'){ //Xbee value is equal to 'P' 
START_STORE=0; //Disable data logger to store data in SD card
myFile.close();
Serial.println("Disable data logger to store data ");
}
else if(Serial_value=='R'){ //Xbee value is equal to 'F' 

Serial.println("Read store data of data logger");
delay(1000);
myFile = SD.open("RDL.txt");
if (myFile) {
Serial.println("RDL.txt : ");

// read from the file until there's nothing else in it:
while (myFile.available()) {
Serial.write(myFile.read());
}

myFile.close();

else {
// if the file didn't open, print an error:
Serial.println("Error opening RDL.txt");


}

}




if(START_STORE==1)
{
DateTime now = RTC.now();


myFile.print("DATE : "); 
myFile.print(now.year(), DEC); 
myFile.print('/'); 
myFile.print(now.month(), DEC); 
myFile.print('/'); 
myFile.print(now.day(), DEC); 
myFile.print(' '); 
myFile.print(" TIME : ");
myFile.print(now.hour(), DEC); 
myFile.print(':'); 
myFile.print(now.minute(), DEC); 
myFile.print(':'); 
myFile.print(now.second(), DEC); 
sensorValue = analogRead(analogInPin); 
myFile.print(" AN0 = " ); 
myFile.print(sensorValue); 
myFile.println(); 
delay(1000);

}

}

For Tutorials & Schematics : CLICK HERE