Go Down

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

MrGlasspoole

#15
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" http://192.168.0.80/LOGGER01.CSV -O F:\0\LOGGER01.CSV

And this one:
Code: [Select]
' Set your settings
strFileURL = "http://192.168.0.80/LOGGER00.CSV"
strSavePath = "F:\0\"

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

objXMLHTTP.open "GET", strFileURL, false
objXMLHTTP.send()

' 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.Open
   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
   objADOStream.Close
   Set objADOStream = Nothing
End if

Set objXMLHTTP = Nothing


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

ed1000

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.


2007jingz

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.

ERROR-301

is it not possable to have the base code or sketch on sd or usb storage and activate it through the bootloader?
if you can ake arduino read from a text file there must be a way to hack the bootloader to read lines into the code even though the bootloader should be read only. after all you only need the comand lines in theory right. and does anyone know where i can find the bootloader code? thanks in advance.

ERROR-301

is it not possable to have the base code or sketch on sd or usb storage and activate it through the bootloader?
if you can ake arduino read from a text file there must be a way to hack the bootloader to read lines into the code even though the bootloader should be read only. after all you only need the comand lines in theory right. and does anyone know where i can find the bootloader code? thanks in advance.

oh and does anyone know how to build your own sd shield? ive had a thought about mass storage id like to try :)

Go Up