Large scale data logging - RS232 to USB disk

matherp

Senior Member
I've Just purchased a UART USB Flash Disk W/R Controller from Sure Electronics on ebay. This is a great little device that does all the interfacing to either an SD disk or USB disk depending on which version you buy. I've tested it on a 8Gb microSD in a USB adapter.

The RS232 command interface is slightly quirky but very easy to use (DOS like). To write a log file "FOPEN file.nam", then "FWRITE" to start logging, everything then sent is logged to the file until you send the STOPFLAG which by default is "+++++"
Then you need to close the file with FCLOSE

The device supports FAT16 or FAT32 and the files are then easy to read on a PC. I'm formatting them as .CSV so they can be read directly in excel

Hope this is of use

Best Regards

Peter
 

GreenLeader

Senior Member
Looks interesting. Can you post some code to show how it works?
What happens if you don't close the file? - eg if you are busy logging and you lose power - do you lose the whole file?
What are the advantages of this over the picaxe Vdrive2?
 

lewisg

Senior Member
This looks like a great project but unless you want to spend time developing a logger I don't see an advantage over OpenLog. Same for vDisk...

To log using OpenLog the PICAXE code is minimal:
Code:
pause 100                                                         'let things "settle"
high C.1                                                          'init logger pin
pause 100

start:
  serout C.1, t2400,("time", 9, "rawCur", 9, "rawVolt", 13,10)    'make a nice header

do

  'do stuff
  
  serout C.1, t2400,(#time, 9, #rawCur, 9, #rawvolt, 13,10)       'log data

loop
The code above makes a nice log like this on a SD card:
Code:
time	rawCur	rawVolt
5	510	809
10	509	858
15	509	268
20	509	86
25	509	682
30	509	890
35	509	927
40	509	934
45	509	935
The preparation of a FAT16 or FAT32 SD card (SDHD up to 16G) is putting a file named CONFIG.TXT on the card containing this line:
Code:
2400,26,3,0
Micro card units are $25 at SparkFun.

Full size card units are $25 at seeedstudio.

I have yet to corrupt data with power cycles, removing the card (from a running project while the write data LED is off) or with flakey connections. OpenLog just works so you can get on with your task. I can't imagine any easier way to log a LOT of data. 26 days of the example above made a 3.3MB file.

Whatever you do, don't use CSV files. They are the work of the devil. Use something human readable like tab separated or columnar tables using spaces so a quick scroll can verify correct data placement. I import a LOT of data every year from many sources and CSV files cause lots of headaches and rework.
 
Last edited:

MFB

Senior Member
I'll second that for the OpenLog. Low cost and VERY easy to use with the PICAXE. Its been totally reliable when used on my RC aircraft logger.
 

GreenLeader

Senior Member
It does look really good. Might get one to try out. How fast have you guys run it? I think I would need to run at 115200 baud for my project.
 
Top