Looking for help with OpenLog uSD data logger?

fireactionplan

New Member
Hi everyone,

This is my first time posting anything as I am a newbie when it comes to picaxe, but I have read through all of the forum posts on this topic for help with this and have tried various iterations of code that has been suggested there but still cannot get this to work, and apparently it's an easy way to log to a uSD according to many? Well not to me.

I am almost finished my project but am relying on this to complete it to log my required data, so would really appreciate the help.

I am using a 40x2 chip with the OpenLog uSD module. I have connected the OpenLog to the pic from RXI to pin C.6 (hserout), TXI to pin C.7(hserin) and connected VCC to 5VDC and the GND and BLK pins to 0V.

I placed the CONFIG.TXT file on the card before use (9600,26,3,0,1,1,0).

And I have written some code to try and get it working, based on the parameters i need before merging it with my main code:

Code:
[color=Black]DEMO_FIGURES:[/color]
[color=Blue]LET [/color][color=Purple]B0[/color][color=DarkCyan]=[/color][color=Navy]0                [/color][color=Green]'USER - CAPTAIN[/color]
[color=Blue]LET [/color][color=Purple]B1[/color][color=DarkCyan]=[/color][color=Navy]1[/color]
[color=Blue]LET [/color][color=Purple]B40[/color][color=DarkCyan]=[/color][color=Navy]1               [/color][color=Green]'TIME HH:MM:SS[/color]
[color=Blue]LET [/color][color=Purple]B41[/color][color=DarkCyan]=[/color][color=Navy]3[/color]
[color=Blue]LET [/color][color=Purple]B38[/color][color=DarkCyan]=[/color][color=Navy]2[/color]
[color=Blue]LET [/color][color=Purple]B39[/color][color=DarkCyan]=[/color][color=Navy]0[/color]
[color=Blue]LET [/color][color=Purple]B48[/color][color=DarkCyan]=[/color][color=Navy]5[/color]
[color=Blue]LET [/color][color=Purple]B49[/color][color=DarkCyan]=[/color][color=Navy]9[/color]
[color=Blue]LET [/color][color=Purple]B42[/color][color=DarkCyan]=[/color][color=Navy]1               [/color][color=Green]'DATE DD/MM/YY[/color]
[color=Blue]LET [/color][color=Purple]B43[/color][color=DarkCyan]=[/color][color=Navy]9[/color]
[color=Blue]LET [/color][color=Purple]B44[/color][color=DarkCyan]=[/color][color=Navy]0[/color]
[color=Blue]LET [/color][color=Purple]B45[/color][color=DarkCyan]=[/color][color=Navy]2[/color]
[color=Blue]LET [/color][color=Purple]B46[/color][color=DarkCyan]=[/color][color=Navy]1[/color]
[color=Blue]LET [/color][color=Purple]B47[/color][color=DarkCyan]=[/color][color=Navy]8[/color]
[color=Blue]LET [/color][color=Purple]B16[/color][color=DarkCyan]=[/color][color=Navy]0               [/color][color=Green]'ALCOHOL X.XX MG/L[/color]
[color=Blue]LET [/color][color=Purple]B17[/color][color=DarkCyan]=[/color][color=Navy]5[/color]
[color=Blue]LET [/color][color=Purple]B18[/color][color=DarkCyan]=[/color][color=Navy]6[/color]
[color=Blue]LET [/color][color=Purple]B19[/color][color=DarkCyan]=[/color][color=Navy]1               [/color][color=Green]'HIGH FLAG (1/0)
      
'USE POKE AND PEEK IN FINAL CODE          [/color]
[color=Blue]PAUSE [/color][color=Navy]1000
            [/color]
[color=Black]DL_INIT:[/color]
[color=Blue]SETFREQ M8
SYMBOL [/color][color=Black]CTZ[/color][color=DarkCyan]=[/color][color=Navy]26           [/color][color=Green]' SET COMMANDS[/color]
[color=Blue]SYMBOL [/color][color=Black]COM[/color][color=DarkCyan]=[/color][color=Navy]44[/color]
[color=Blue]PAUSE [/color][color=Navy]100[/color]
[color=Blue]HIGH C.7
PAUSE [/color][color=Navy]500[/color]
[color=Blue]SEROUT C.6[/color][color=Black], [/color][color=Blue]T9600_8[/color][color=Black], [/color][color=Blue]([/color][color=Black]CTZ,CTZ,CTZ[/color][color=Blue])              [/color][color=Green]'FORCE COMMAND MODE FOR DATA LOGGER
'PAUSE 100
'SERIN C.7, N4800, (">")                              'WAIT FOR COMMAND PROMPT
'SEROUT C.7, T9600_8, ("NEW BAAMS.CSV",CR)                  'CREATES NEW BAAMS FILE[/color]
[color=Blue]PAUSE [/color][color=Navy]1000[/color]
[color=Blue]SEROUT C.6[/color][color=Black], [/color][color=Blue]T9600_8[/color][color=Black], [/color][color=Blue]([/color][color=Red]"APPEND BAAMS.CSV"[/color][color=Black],[/color][color=Blue]CR)          [/color][color=Green]'INSTRUCTION TO APPEND .CSV FILE. NEW DATA IS APPENDED TO END OF FILE. CHANGE BAAMS TO DATAFILE IF REQUIRED[/color]
[color=Blue]PAUSE [/color][color=Navy]2000[/color]
[color=Blue]SEROUT C.6[/color][color=Black], [/color][color=Blue]T9600_8[/color][color=Black], [/color][color=Blue](CR[/color][color=Black],[/color][color=Blue]LF[/color][color=Black],[/color][color=Red]"NEW SAMPLE PROVIDED"[/color][color=Black],[/color][color=Blue]CR[/color][color=Black],[/color][color=Blue]LF)          [/color][color=Green]' CREATE CSV COLUMN HEADINGS[/color]
[color=Blue]SEROUT C.6[/color][color=Black], [/color][color=Blue]T9600_8[/color][color=Black], [/color][color=Blue]([/color][color=Red]"USER"[/color][color=Black], COM, [/color][color=Red]"TIME"[/color][color=Black], COM, [/color][color=Red]"DATE"[/color][color=Black], COM, [/color][color=Red]"BREATH ALCOHOL mg/L"[/color][color=Black], COM, [/color][color=Red]"HIGH FLAG"[/color][color=Black], [/color][color=Blue]CR[/color][color=Black],[/color][color=Blue]LF) 
PAUSE [/color][color=Navy]100[/color]

[color=Black]DL_LOGGING:[/color]
[color=Blue]LOW D.5
PAUSE [/color][color=Navy]100[/color]
[color=Blue]SEROUT C.6[/color][color=Black], [/color][color=Blue]T9600_8[/color][color=Black], [/color][color=Blue]([/color][color=Black]#[/color][color=Purple]B0[/color][color=Black],#[/color][color=Purple]B1[/color][color=Black],COM,#[/color][color=Purple]B40[/color][color=Black],#[/color][color=Purple]B41[/color][color=Black],[/color][color=Red]":"[/color][color=Black],#[/color][color=Purple]B38[/color][color=Black],#[/color][color=Purple]B39[/color][color=Black],[/color][color=Red]":"[/color][color=Black],#[/color][color=Purple]B48[/color][color=Black],#[/color][color=Purple]B49[/color][color=Black],COM,#[/color][color=Purple]B42[/color][color=Black],#[/color][color=Purple]B43[/color][color=Black],[/color][color=Red]"/"[/color][color=Black],#[/color][color=Purple]B44[/color][color=Black],#[/color][color=Purple]B45[/color][color=Black],[/color][color=Red]"/"[/color][color=Black],#[/color][color=Purple]B46[/color][color=Black],#[/color][color=Purple]B47[/color][color=Black],COM,#[/color][color=Purple]B16[/color][color=Black],[/color][color=Red]"."[/color][color=Black],#[/color][color=Purple]B17[/color][color=Black],#[/color][color=Purple]B18[/color][color=Black],COM,#[/color][color=Purple]B19[/color][color=Black],[/color][color=Blue]CR[/color][color=Black],[/color][color=Blue]LF)
PAUSE [/color][color=Navy]2000[/color]
[color=Blue]HIGH D.5                [/color][color=Green]'LED TO SHOW DATA LOGGED[/color]
[color=Blue]PAUSE [/color][color=Navy]3000[/color]
[color=Blue]GOTO [/color][color=Black]DL_LOGGING[/color]

I have also tried swapping C.6 and C.7 in my code, and also switching the wires but with no luck either. My .CSV file is not being generated on the card at all.

I can get an output to the picaxe terminal, and all of my data is appearing there and can export that .CSV to excell to display the values. But I just cannot get the uSD card module to work.

There are 2 LED's on the module (green and blue) but they do not seem to light up at all, and I have checked with a multimeter that the module is receiving 5V which it is. Perhaps this is just a faulty unit?

If anyone has any suggestions on where I might have went wrong, or can point me in the right direction that would be great. As I mentioned, I am very new to picaxe but have been picking it up very fast and making good progress, until I hit this wall!

Thanks in advance

Ross
 

The bear

Senior Member
Welcome to the forum.

Have you seen this thread?

Environmental uSD card data logger, by Jeremy Harris on 17-02-2012

Regards, bear...
 

fireactionplan

New Member
Hi Bear,

Thanks for getting back to me and for the welcome. Yes I have seen Jeremy's post and actually used some of his code to get me started, and studied it to see where I might have went wrong, but I still can't figure it out.

I have also tried using some help I found here:

http://www.picaxeforum.co.uk/showthread.php?23893-Air-quality-monitor-and-logger

http://www.picaxeforum.co.uk/showthread.php?28188-OpenLog-control-characters&highlight=openlog
http://cyclurba.fr/forum/512764/datalogger-picaxe-08m2-horloge-rtc-openlog-mesurer-1-tension.html?from=1&discussionID=13845&messageID=297786&rubriqueID=64&pageprec=
and of course Jeremy's which is very well documented
http://www.picaxeforum.co.uk/showthread.php?20551-Environmental-uSD-card-data-logger

I just can't seem to figure out where I've went wrong.

Thanks

Ross
 

hippy

Technical Support
Staff member
I am not familiar with OpenLog but there are quite a few threads on the forum about it. Perhaps one of those might supply some assistance.

I would try and find some documentation to see if you can discover what the LEDs mean and figure out what state they should be in. It may be worth starting with something simpler with your code. Just writing a simpler "Hello" to a file and getting that working first, maybe try reading an existing file.

Increase all the PAUSE times to 10 seconds perhaps to ensure it is ready when you are writing.

As you are using C.6 for serial with a Txxxx baud rate, set C.6 high at the very start of the program to avoid the first character sent being corrupted.
 

fireactionplan

New Member
I am not familiar with OpenLog but there are quite a few threads on the forum about it. Perhaps one of those might supply some assistance.

I would try and find some documentation to see if you can discover what the LEDs mean and figure out what state they should be in. It may be worth starting with something simpler with your code. Just writing a simpler "Hello" to a file and getting that working first, maybe try reading an existing file.

Increase all the PAUSE times to 10 seconds perhaps to ensure it is ready when you are writing.

As you are using C.6 for serial with a Txxxx baud rate, set C.6 high at the very start of the program to avoid the first character sent being corrupted.

Hi Hippy,

I had looked into the LED's before. LED 1 will flash every time a new character is received and is a good indication of the serial comms working and should flash frequently during operation, LED 2 is used for the SPI interface and probably flashes too fast to see. So I should at least see LED 1 blink every now and then.

I have tried reading an existing file with no luck, and as mentioned I can see my data using the picaxe terminal, just not on the card.

I already have a high C.6 a few commands from the top (although it says C.7, i just hadn't updated this since my last tinkering), I will try move it to the very top and see if that helps.

I will also try and increase the pauses to see if that makes any difference.

Thanks

Ross
 
Top