Go Down

Topic: Reading microSD card directly from USB serial port (Read 10517 times) previous topic - next topic


Dec 06, 2012, 10:21 pm Last Edit: Dec 06, 2012, 11:20 pm by MrGlasspoole Reason: 1
I need something similar.
I want to log the data to the SD and then send it to a server (MySQL).

Most people have a server running at home or have web-space.
But what if your server is broken or down. So i want the stuff first on SD and then
upload it every 5 minutes.

I was playing around before a year but since that i had no time.
I have to windows bat files here i used but can't remember what i did exactly.
But if you have the Arduino running as server then it can be done.
Here is what i found in my old folder (bat files).
GNU Wget:
Code: [Select]
"C:\Program Files (x86)\GnuWin32\bin\wget.exe" -O F:\0\LOGGER01.CSV

And this one:
Code: [Select]
' Set your settings
strFileURL = ""
strSavePath = "F:\0\"

' Send an HTTP request for the file
Set objXMLHTTP = CreateObject("MSXML2.XMLHTTP")

objXMLHTTP.open "GET", strFileURL, false

' If the server responds with "OK"...
If objXMLHTTP.Status = 200 Then
   ' Create a stream object to write downloaded data to
   Set objADOStream = CreateObject("ADODB.Stream")
   objADOStream.Type = 1 'adTypeBinary

   objADOStream.Write objXMLHTTP.ResponseBody
   objADOStream.Position = 0

   ' Create an empty file on disk
   Set objFso = Createobject("Scripting.FileSystemObject")
   ' Make sure we don't have any name collision...
   If objFso.Fileexists(strSavePath) Then objFSO.DeleteFile strSavePath
   Set objFso = Nothing

   ' Write the stream data to file
   objADOStream.SaveToFile strSavePath
   Set objADOStream = Nothing
End if

Set objXMLHTTP = Nothing

Sure not USB but you can copy the stuff to your PC.


I really do not see the problem here, but maybe that is just me.
The Arduino can read the SD card and send data to the serial port. A PC can receive data from the serial port.

Write a program (Visual basic even or pascal) that sends a 'send'  command (ctrl-s or whatever you like) to the arduini whereupun the arduino responds with reading the sd card and sending the bytes to the serial port. Your PC program then must be awaiting that data and do something with it (write it to disk, as bytes or as data directly in a CSV or database file). When the Arduino is done, he sends a code that the PC understands as 'done'

I have done something similar long time ago with an 8052 and Clipper on a PC. The 8052 upon command dumped its data memory to the serial port and the PC stored that in a clipper file.

Piece of cake.


I am thinking with the new Arduino Yún it might be possible, though you would have to make the code.
There is still some good in this world, and it's worth fighting for.

Go Up