Pages: [1] 2   Go Down
Author Topic: Simple Program To Access & Store Data in MicroSD card  (Read 3283 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Full Member
***
Karma: 0
Posts: 103
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hello. i'm newbie in arduino. however, it is a compulsory for me to use arduino as part of final year project as it is a university requirement. I'm glad if somebody can give me some links or maybe program.. a working program. to store and acess data in memory card. for information. i'm taking bachelor in medical electronics. i'll use a sensor to detect physiological parameter & then store it in microSD memory card. it is for self monitoring. maybe about a week. daily measurement. so, once a week, the patient will take the data (reading) to the doctor. it supposed to enhance the treatment procedure. With all, regards. Thank you.
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 549
Posts: 46090
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
it is a compulsory for me to use arduino as part of final year project as it is a university requirement.
I'm pretty sure that using it as a decoration is not within the scope of the university requirements.

Learning to program the device IS in scope. Learning to define requirements that CAN be implemented IS in scope.

The Arduino IDE ships with a library that can read from and write to an SD card. It comes with examples that show how to do just that.

Modifying an example to store or retrieve the data that are interested is not that big a deal.

No, we won't do your work for you. This is supposed to be a learning experience for you. Learning how to post "do my homework for me" on the Arduino forum is not the kind of learning that the university expects of you.
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 103
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I'm pretty sure that using it as a decoration is not within the scope of the university requirements.

haha.. it is a compulsory for my course in my university to use arduino because the head of section already got approval from the dean to make it compulsory for final year student to use arduino for final year project. haha..

Quote
No, we won't do your work for you. This is supposed to be a learning experience for you. Learning how to post "do my homework for me" on the Arduino forum is not the kind of learning that the university expects of you.

i'm not asking you guys to do my homework. but like my lecturer told me.. arduino is an open source. you can download the program & then just adjust it. he just told me that to find the sample program only. that's why i want to have a look a simple program that a function of data access & storage within the microSD memory card. with all, regards.
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 103
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

finally found the sample program... inside the arduino itself... i didn't realize it until i download the sdfat library.. by the way, what is the different between SD library & SDfat library? can i read & write data into microSD memory card by using SD library for this mircoSD Shield? or it is compulsory to use SDfat library for this shield? with all, regards.

http://www.sparkfun.com/tutorials/172

Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 103
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have a C# application that creates a nice graph of the data that the Arduino sends it, and stores it in a database. If you are interested in a copy, PM me.

dear sir. if you don't mind. may i get that c# application that creates the graph. so that i can create a graph from the files inside the memory card. with all, regards. thank you very much sir for giving me some ideas before this. thank you.
Logged

0
Offline Offline
Edison Member
*
Karma: 44
Posts: 1473
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You don't need to download SdFat to write a microSD.  The Arduino SD.h library is a wrapper for an old version of SdFat.  THE Wrapper's purpose is to present an Arduino style API. 

SD.h has a number of bugs that have been fixed in newer versions of SdFat but few users have problems

SdFat has evolve to be more like C++ iostreams and supports inserts, <<, and extractors, >>.
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 103
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You don't need to download SdFat to write a microSD.

what does your mean here? i'm sorry.. i don't have yet mircSD shield.. yet, i unable to try it. i just do a survey first. to determine whether it is reliable to me to do my project using it. if then, what is the purpose of SDfat, sir? like u said, i don't need to download SDfat to write a microSD. with all, regards.
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 103
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You don't need to download SdFat to write a microSD.  The Arduino SD.h library is a wrapper for an old version of SdFat.  THE Wrapper's purpose is to present an Arduino style API. 

SD.h has a number of bugs that have been fixed in newer versions of SdFat but few users have problems

SdFat has evolve to be more like C++ iostreams and supports inserts, <<, and extractors, >>.

* SdFatWrite.pde (2.15 KB - downloaded 16 times.)

* SdFat Write 2.bmp (893.61 KB, 1219x250 - viewed 25 times.)
* SdFatRead.pde (1.63 KB - downloaded 8 times.)

* SdFat Read 2.bmp (879.31 KB, 1219x246 - viewed 22 times.)
Logged

0
Offline Offline
Edison Member
*
Karma: 44
Posts: 1473
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Are you using sdfatlib20111205.zip?

Also it is best to install contributed libraries like this:
Quote
Contributed Libraries

If you're using one of these libraries, you need to install it first. To do so, download the library and unzip it. It should be in a folder of its own, and will typically contain at least two files, one with a .h suffix and one with a .cpp suffix. Open your Arduino sketchbook folder. If there is already a folder there called libraries, place the library folder in there. If not, create a folder called libraries in the sketchbook folder, and drop the library folder in there. Then re-start the Arduino programming environment, and you should see your new library in the Sketch > Import Library menu.
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 103
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Are you using sdfatlib20111205.zip?

i'm using sdfat library. from sparks fun. below is the download link..

http://www.sparkfun.com/tutorial/microSD_Shield/SdFat.zip
Logged

0
Offline Offline
Edison Member
*
Karma: 44
Posts: 1473
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Get the correct library for Arduino 1.0 here http://code.google.com/p/sdfatlib/downloads/list and install it in the proper place as described above or as described here http://www.arduino.cc/en/Reference/Libraries.
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 103
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Get the correct library for Arduino 1.0 here http://code.google.com/p/sdfatlib/downloads/list and install it in the proper place as described above or as described here http://www.arduino.cc/en/Reference/Libraries.

it works... thank you sir.. now... i can have a fun with this. once again, thank you very much.
Logged

Cape Cod Mass USA
Offline Offline
Newbie
*
Karma: 0
Posts: 35
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I too am a Arduino newbie writing my first SD datalogger, though I have done a little C and assembler programming.

What is a good way to STOP logging?  The examples I see such as SdFat\examples\AnalogLogger\AnalogLogger.pde seem to log forever until power goes away or you yank the SD card out of the socket.  It seems to me that pulling the SD card out in the middle of a write could be bad.

I would expect to send a ^c or something to tell the Arduino to stop logging and close the file.  But none of the examples do this and the Arduino language doesn't even seem to have a Stop command.  Am I being paranoid about file corruption.  How do Arduino programmers usually exit loop()?
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 103
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What is a good way to STOP logging?  The examples I see such as SdFat\examples\AnalogLogger\AnalogLogger.pde seem to log forever until power goes away or you yank the SD card out of the socket.  It seems to me that pulling the SD card out in the middle of a write could be bad.

I would expect to send a ^c or something to tell the Arduino to stop logging and close the file.  But none of the examples do this and the Arduino language doesn't even seem to have a Stop command.  Am I being paranoid about file corruption.  How do Arduino programmers usually exit loop()?

haha.. i never thought about that. yup. how to send command so that arduino stop logging and close the file. for your information. i've never done programming before. i'm wrote a command by referring the example inside the arduino iteself. but not SDfat. i used the example of SD library only. i have a look a example of SDfat. due to lack of knowledge of c-language, i cannot understand it very well.

about the stop command. i think it has. because i have a look my senior arduino programming, his project take a reading of sensor about 30 seconds intervals for about 5 minutes. however, my senior already graduated. i'll try to reach him tommorrow. if i got a news, i'll tell you. with all, regards. 
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 549
Posts: 46090
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
How do Arduino programmers usually exit loop()?
You don't. You can create an infinite loop, so that loop() never ends, but that is not the same as exiting loop.

Quote
I would expect to send a ^c or something to tell the Arduino to stop logging and close the file.
Your Arduino has a keyboard attached? Mine doesn't. How will you send this Ctrl-C?

You could have the Arduino read serial data, and if it sees "Hey, that's enough. You can stop now", it could close the file. (Of course, the input does NEED to be that complex...)

Usually, the file is opened, some data written and the file is closed. So, it is generally safe to reset the Arduino at any time, or to power it down.

If you are buffering a bunch of data, and writing the buffer to a file, you could light an LED when the file was open, and turn the LED off when the file is closed. Don't disturb the Arduino when the LED is lit, or you risk loosing data.

There are many ways to be smarter than the problem.
Logged

Pages: [1] 2   Go Up
Jump to: