I have an Arduino R3 Uno and I was wondering if I can log data to it using a computer's SD card slot, since I don't have an SD card shield. Any suggestions? Thanks!!!
1 Answer
I see that for the Arduino Uno serial port 0 is connected to an ATmega8U2 configured as a USB-to-TTL Serial chip. I'd normally approach this problem by sending the data over a serial link to the PC where it can be logged to disk (or to SD card if you like).
You'll probably want to read over the Arduino Serial class documentation properly to understand how to send your data over the serial port in the correct format, but the small example below should allow you to general test that communications are working, it will send a test string over the serial port around ten times per second.
On the PC side of things you'll want a serial terminal emulator program to receive the data. If you're running Windows RealTerm is probably a good choice, for Linux Minicom would be worth a look but I have used it less often. There are many to choose from that you may prefer down the track once you're up and running.
Assuming you're using RealTerm once installed shut down the Arduino development environment and start RealTerm with your Arduino attached and running the code below. Under the Port tab select a speed of 9600 baud and press the change button. If you get an error or nothing appears on the screen cycle through the list of options under the port drop-down list pressing change afterwards until you see "My test data" appearing on the screen. That process is to find the serial port number that's been allocated.
Once data is coming in you can move to the capture tab and you'll see the option to enter a filename and pressing "Start: Overwrite" or "Start: Append" will begin saving to a file. Now you can go back to your real application and modify it to send the data you wish to log over the serial port.
void setup()
{
Serial.begin(9600);
}
void loop()
{
Serial.write("My test data\r\n");
delay(100);
}
-
\$\begingroup\$ I have used the serial class before, and I am using Ubuntu (Linux), so I use Minicom and I can write to an SD card using my computer with the Minicom emulator? \$\endgroup\$ Commented Mar 24, 2013 at 13:53
-
\$\begingroup\$ Yes you should be able to, I had a quick look at the docs and you can press F for the logging options. \$\endgroup\$– PeterJCommented Mar 24, 2013 at 23:02