FAT SD Card Data Logger

An area to discuss 8-bit PIC specific problems and examples

Moderator: Benj

Post Reply
George_B
Posts: 117
Joined: Wed Jul 04, 2012 11:21 pm
Location: Greece
Has thanked: 44 times
Been thanked: 17 times
Contact:

FAT SD Card Data Logger

Post by George_B »

Hello !


I would like to use the SD componet. I read in the forum a few topics for reading from and writing to sd card and based on the examples i implement a data logger with gps data.

The simulator working good. The created file in the PC does contain the correct data as i want to be desplayed.

The problem i am facing is with real hardaware and the file which is created by the MCU.

Attached is the program i am using to make the logs onto the SD card every 5 secs.

As you can see the data seems to be corrupted in real tests.

Is it something i am doing wrong?

Thanks in advance!

Regards
George
Attachments
FAT_Data_Logger_Simple_Slow.fcfx
(27.26 KiB) Downloaded 24 times
log1(real Test with hardware).txt
(220 Bytes) Downloaded 24 times
log1(Created in Simulation).txt
(246.41 KiB) Downloaded 22 times

George_B
Posts: 117
Joined: Wed Jul 04, 2012 11:21 pm
Location: Greece
Has thanked: 44 times
Been thanked: 17 times
Contact:

Re: FAT SD Card Data Logger

Post by George_B »

I just figure out that the problem has to do with the string variable in the program.

The string "filestring" could not hold the sum of all other strings that i wanted.

I made a small change in the structure of the program and now i am able to write the way i want in SD.

Here is the solution for me.

It looks like the string variable could not hold more than 20 characters even if i tried to increase its array inside the brackets [].


Hope that helps and someone else having the same issue.


Happy Easter and my best wishes to you all.


George
Attachments
FAT_Data_Logger_Simple_Slow.fcfx
(32 KiB) Downloaded 24 times

George_B
Posts: 117
Joined: Wed Jul 04, 2012 11:21 pm
Location: Greece
Has thanked: 44 times
Been thanked: 17 times
Contact:

Re: FAT SD Card Data Logger

Post by George_B »

Hi,

For a project it is required to log GPS positioning data in an SD card every few seconds.
I have a few GPS modules available for testings but i get correct and valid position only with L76X module using U-center software.

Unfortunately i can not read the module's data when i try to write a simple program in flowcode 7 with GPS component.
It seems that the current component for GPS in flowcode can not identify the data inside the incoming string.


I captured a few lines of data from GPS module L76X to show you the format of the data that the mcu is receiving.
samle.txt
(118.26 KiB) Downloaded 28 times
hope someone can help with this one.

Regards
George

User avatar
Benj
Matrix Staff
Posts: 15211
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4763 times
Been thanked: 4297 times
Contact:

Re: FAT SD Card Data Logger

Post by Benj »

Hi George,

Please can you post your flowcode project file and I'll have a look at this for you. The gps output should be fairly standard but i will check the file you sent to make sure.

George_B
Posts: 117
Joined: Wed Jul 04, 2012 11:21 pm
Location: Greece
Has thanked: 44 times
Been thanked: 17 times
Contact:

Re: FAT SD Card Data Logger

Post by George_B »

Hello Ben

note that this program works with anothe gps module that i have which unfortunately gives me totaly wrong coordinates in relation to when i am at that point.

I couldn't read data from the L76X GPS module(which gives me correct data) using the attached program.

Can you check and let me know the reason i can not read the L76X GPS module with the current GPS component?

Regards
George
Attachments
L76X GPS output data.txt
(118.29 KiB) Downloaded 20 times
FAT_Data_Logger_Simple_Slow.fcfx
(28.92 KiB) Downloaded 22 times

George_B
Posts: 117
Joined: Wed Jul 04, 2012 11:21 pm
Location: Greece
Has thanked: 44 times
Been thanked: 17 times
Contact:

Re: FAT SD Card Data Logger

Post by George_B »

Hello,

still i am trying to find a solution for gps module L76X but no success with the flowcode.


Would it be possible to check the attached txt file and see the reason that the flowcode component can not get the right information ?


Thanks in advance
George

User avatar
Benj
Matrix Staff
Posts: 15211
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4763 times
Been thanked: 4297 times
Contact:

Re: FAT SD Card Data Logger

Post by Benj »

Hi George,

What speed is you crystal on your board? If this doesn't match the setting in the Flowcode project options then this could be the cause of the problem.

Does it ever start logging with the L76X, i.e. tell you the data is accurate?

George_B
Posts: 117
Joined: Wed Jul 04, 2012 11:21 pm
Location: Greece
Has thanked: 44 times
Been thanked: 17 times
Contact:

Re: FAT SD Card Data Logger

Post by George_B »

Hello Ben,

The crystal speed is configures correctly in flowcode at 19.6608MHz.

If i use a different GPS module from another manufacturer the same program works fine but then i have accuracy issues.

I would like to build a device that it will track a route and keep a log with the gps position every 5 seconds.

I have managed to write in SD card successfully but i am stuck on this one..

I hope you can give me a hand

User avatar
Benj
Matrix Staff
Posts: 15211
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4763 times
Been thanked: 4297 times
Contact:

Re: FAT SD Card Data Logger

Post by Benj »

Hello,

What are you using as your power source for the GPS? Could it be that the current is too low and this is causing your first module to give unreliable data and your second module not to boot up at all?

With projects like this I have used Li-ion and Lipo cells with a lot of success. I've also used a 9V PP3 battery and a switch mode power supply to drop the voltage and boost the current.

George_B
Posts: 117
Joined: Wed Jul 04, 2012 11:21 pm
Location: Greece
Has thanked: 44 times
Been thanked: 17 times
Contact:

Re: FAT SD Card Data Logger

Post by George_B »

Hi,


I am using two Li-ion 3.7V in series and a switching step down (3A maX) to power the hardaware.

Have you ever tried to read the L76X GPS module with the current flowcode GPS component?

User avatar
Benj
Matrix Staff
Posts: 15211
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4763 times
Been thanked: 4297 times
Contact:

Re: FAT SD Card Data Logger

Post by Benj »

Hello,

I've found what might be causing the problem. The RMC message that contains the data validity flag is usually $GPRMC but in this case it is $GNRMC.

I've updated the component to allow for this and hopefully that should solve the problem for you. The other messages all seem to be ok so fingers crossed this allows the module to work.
GPS.fcpx
(160.94 KiB) Downloaded 1 time

George_B
Posts: 117
Joined: Wed Jul 04, 2012 11:21 pm
Location: Greece
Has thanked: 44 times
Been thanked: 17 times
Contact:

Re: FAT SD Card Data Logger

Post by George_B »

will let you know the results the soonest.


Finger crossed.



Many thanks!

Post Reply