Friday, March 21, 2008

Data logging

I try to data log with Do son chip and Micro SD card.


First I try to make and save data at SD card from potentiometer.



I can save data easily at computer by processing, but it seem not the exactly same data at Arduino.

It looked like a kind of BYTE , HEX problem.




After I saved a file used processing, I couldn't nothing to do with.

I try to save at SD card, but I failed to save.

I used all of sample code at class wiki.


Those are result files


All of text files are meaningless.


http://itp.nyu.edu/physcomp/sensors/Code/4dSystemsByte

from this code.


1. http://itp.nyu.edu/~sk2745/sensor/3.TXT

2. http://itp.nyu.edu/~sk2745/sensor/1.TXT



Arduino
Code.
//-------------------------------
byte fileCounter = 5 ;
byte sensorCounter = 0;
boolean done = false;
void setup(){
pinMode(11,OUTPUT);
Serial.begin(19200);
// have device warm up
delay(1000);
// send two Carraige Returns to AutoSet Baudrate
Serial.print('\r',BYTE);
Serial.print('\r',BYTE);
delay(1000);
Serial.print('q',BYTE);
Serial.print('\r',BYTE);
delay(1000);
setupFile();
delay(1000);
}
void loop(){
if(!done){
if(sensorCounter <>
byte analog = analogRead(0) / 4;
Serial.print("w #1 2"); // send 2 bytes (one is the sensor number,one is the \n for reading later)
Serial.print('\r',BYTE);
delay(1000);
Serial.print(analog,BYTE);
Serial.print('\n',BYTE);
Serial.print('\r',BYTE);
sensorCounter++;
} else {
digitalWrite(11,HIGH);
done = true;
}
}
delay(1000);
}
void setupFile(){
Serial.print("ow A:\\DATA");
Serial.print(fileCounter,DEC);
Serial.print(".TXT");
Serial.print('\r',BYTE); // CR to send message
}
//------------------------------------------------------------------------


from this code.


3. http://itp.nyu.edu/~sk2745/sensor/DATA3.TXT

4. http://itp.nyu.edu/~sk2745/sensor/DATA5.TXT




Problem
1: How to save exactly right serial data to computer and micro SD card

2: How to read data inside micro SD card

3: Is it possible to use Arduino as a serial to usb device?

No comments: