HOME > > ELECTRONICS MAIN PAGE    
ARDUINO MAIN PAGE

OpenLog from Sparkfun

Easy add-on SD storage card option

Established product, and only $16 (+p&p), Nov 2018

(file name: ec3openlog-intro.htm)

A lot could be said about this product. And I probably will write more pages eventually, and take some of the rough edges off this one. But it is "complete" for the message I want to bring to you.

(Image of Sparkfun Openlog device)

But before you look at the Sparkfun hookup guide, or before I "start", let me just say...

If you Keep It Simple, this is ALREADY great!

I soldered 3 wires to my OpenLog.

I connected the OpenLog's Vcc to my Arduino's Vcc. (Power from Arduino to OpenLog. And their Grounds. And the OpenLog's RXI to a digital output of my Arduino.

Wrote the little program I will show you shortly. Ran it... and my Arduino wrote a text file to the SD card in the OpenLog.

I was using a 5v Arduino. I'm told the OpenLog plays just as nicely with a 3v3 system.

The program you need, to see it in basic operation...

//OpenLogBasicDemo18Oct
//See "WelcomeMsg()" for version ID and h/w expectations

#include <SoftwareSerial.h>;

const byte pSerialToOpenLog=6;
SoftwareSerial SerialToOpenLog(7,pSerialToOpenLog);//RX/TX

unsigned long ulCycles=0;

void setup() {
Serial.begin(9600);//To initialize channel to ordinary
//   serial monitor:
delay(20);
WelcomeMsg();

SerialToOpenLog.begin(9600);
delay(20);

}// end of setup()

void loop() {
  int iCyclesToWait=4;
  int iCyclesAtDone=ulCycles;//.. plus...
  iCyclesToWait=iCyclesToWait+random(3);
  iCyclesAtDone=ulCycles+iCyclesToWait;

  while (ulCycles<iCyclesAtDone)
  {
    Serial.print('x');
    ulCycles++;
    delay(500);
  }

  Serial.println("");
  Serial.println("While.. completed, writing to SD");

      SerialToOpenLog.print("At ");
      SerialToOpenLog.print(millis());
      SerialToOpenLog.print(" milliseconds, ulCycles=");
      SerialToOpenLog.println(ulCycles);

  Serial.println("... Write to SD done.");
}//end of loop()

void WelcomeMsg()
{
   Serial.println("OpenLogBasicDemo18Oct");
   Serial.println("vers 30 Oct 18");
   Serial.println("");
   Serial.print("Needs a Sparkfun OpenLog on pin ");
   Serial.println(pSerialToOpenLog);
   Serial.println("");
   Serial.println("Writes 'stuff' to it.");
   Serial.println("Useful stuff? No. But enough");
   Serial.println("to test that all is well.");
   Serial.println("");
   Serial.println("(Turn off, put SD card in a reader,");
   Serial.println("check for files. Files there? Readable?");
   Serial.println("Then OpenLog worked!");
   Serial.println("");
   Serial.println("I would GUESS you chould format SD card");
   Serial.println("before using it.");
   Serial.println("");
   Serial.println("You can run the program multiple times.");
   Serial.println("That will give rise to multiple files.");
   Serial.println("");
}// end of WelcomeMessage()

The result: On the SD card, a file called LOG0000.txt, holding...

At 5434 milliseconds, ulCycles=10
At 8472 milliseconds, ulCycles=16
At 11510 milliseconds, ulCycles=22
At 14050 milliseconds, ulCycles=27
At 17088 milliseconds, ulCycles=33
At 19128 milliseconds, ulCycles=37
At 22167 milliseconds, ulCycles=43
At 25205 milliseconds, ulCycles=49
At 27745 milliseconds, ulCycles=54
At 29784 milliseconds, ulCycles=58
At 32823 milliseconds, ulCycles=64

(There was a little... 40 characters?... gibberish at the start. What do you want for such a CRUDE program driving the device? I doubt very much that the gibberish was the OpenLog's fault. In any case, it is easy enough to edit off, if you don't want to bother fixing the program.)

Reset the Arduino without clearing the SD card first, and the new data will go to a new file.... LOG00001.txt. And so on, if you reset over and over.

You CAN do MORE...

You can do oh so much more. Read data from an SD card. Store things to specific, name- chosen- by- you files. Work at higher data rates.

But first you have to buy one. (That's the Sparkfun page for OpenLog. There's more on how you can use it... lots more!... there.) And when you have, "out of the box", you can use it to capture anything you can send from the Arduino as a serial stream.

It does NOT come with a microSD card. Any moderately sized microSD card should work. (512 MB and up.. but not to the stratosphere... see device specs.)

You should consider formatting the card with sdcard.org's formatter, available (free) from the sdcard.org site. (Formats with FAT32).

There's a discussion of why you should do that, not just use your "ordinary" formatter, in the Arduino forums of Arduino.cc.

Doing more for less...

I came to using SD cards with microprocessors via the "log data" route.

Another route, less demanding: Use an memory card to hold a config file. If, for instance, you are creating a IoT device which will connect to a LAN, an Arduserver, for instance, you can hard-code the device's IP address, and log on creds into the device. But wouldn't it be neat to have "generic" code, that didn't need touching if the device were moved to a different network?

This could be achieved by putting the IP address, log on creds, etc into a "config" file, storing that on a memory card, and telling the microprocessor to refer to that for the necessary details are needed.

In a simple scenario, the file would be created on a big computer, and then the memory card used "read only" on the microprocessor system.

In a fancier scenario, there might be parameters that could be supplied, changed by the user while the device was running, and written to the memory card, to carry those settings across power cycles.

An OpenLog can handle either! But it is an elephant gun, if that's "all" you want. (OpenLog can deal with an incoming serial data stream, create and fill files, etc. Not needed for simple config file management.)

I haven't tested the following, but have every confidence that they would be Just Fine for config file wants... or similar things!...

Reminder: OpenLog is happy to work under 5v or 3v3. The data stream can be 3v3 or 5v based.

Hobbytronics.co.uk offers...

Hobbytronics Breakout Board for microSD Flash Drive (part number MICROSD-BASIC, £4.20 (incl VAT)+p&p). You would only use this device on a 3v3 system. (The memory cards operate at 3v3, so that makes creating the breakout easier, if you can be happy with just 3v3.) For "how to use this", see that information as written up for the next device, the "...with Logic Conversion" board. They both work the same way, they are different mainly in the "extras" on the other board to allow use on a 5v system.

MicroSD Breakout Board Regulated with Logic Conversion V2 (part number SDCARD-REG2, £7.20 (incl VAT)+p&p). This is similar to the previous, but with "extra bits" so that you can use it with a 5v system. Use is straightforward, and explained at the Hobbytronics site. Communications with the SD card are via an SPI interface, using the standard libraries if you are using this with an Arduino. (Four digital lines needed.) There's an on-board regulator to provide for the needed 3v3, with a little spare capacity, if you want to draw some current from it for other 3v3 devices in your system.

Sparkfun.com offers...

SparkFun microSD Transflash Breakout (part number BOB-00544, $4.50+p&p). You would only use this device on a 3v3 system. (The memory cards operate at 3v3, so that makes creating the breakout easier, if you can be happy with just 3v3.) Sparkfun offer one of their excellent hookup guides for this... (though the links to reach it aren't perfect, 11/18!).

SparkFun microSD Transflash Breakout (part number DEV-13743, $5.50+p&p). This is similar to the previous, but with "extra bits" so that you can use it with a 5v system. Use is straightforward, and explained at the Hobbytronics site. Communications with the SD card are via an SPI interface, using the standard libraries if you are using this with an Arduino. (No more than 4 digital lines needed... read the hookup guide carefully... it says you need three, but I suspect that at you must leave the 4th line associated with SPI alone while using the device.).

Whether you buy the Hobbytronics or Sparkfun versions... I would suggest that you read BOTH hookup guides. There are things to be learned from each in connection with these very similar alternatives.

(The same considerations about media and formatting as were discussed in the previous section still apply. (Size and formatting.))



   Search this site                 powered by FreeFind
 
Site Map    What's New    Search


Ad from page's editor: Yes.. I do enjoy compiling these things for you... hope they are helpful. However.. this doesn't pay my bills!!! If you find this stuff useful, (and you run an MS-DOS or Windows PC) please visit my freeware and shareware page, Sheepdog Software (tm), download something, and circulate it for me? At least (please) send an 'I liked the parallel port use page, and I'm from (country/ state)' email? (No... I don't do spam.) Links on your page to this page would also be appreciated!
Click here to visit editor's freeware, shareware page.

Don't forget to check out the programs for controlling the state of the parallel port at my shareware site. There are two free programs there... one for toggling bits, the other for using the computer as a timer via the parallel port.


Here is how you can contact this page's editor.
Click here to go up to general page about electronics by editor of this page.
Click here to go up to general page about electronic projects by editor of this page.
Why does this page have a script that loads a tiny graphic? I have my web traffic monitored for me by eXTReMe tracker. They offer a free tracker. If you want to try it, check out eXTReMe's site. The Google panels and the search panel are also script based.

Valid HTML 4.01 Transitional Page tested for compliance with INDUSTRY (not MS-only) standards, using the free, publicly accessible validator at validator.w3.org. Mostly passes. There were two "unknown attributes" in Google+ button code, and two further "wrong" things in the Google Translate code. Sigh.


....... P a g e . . . E n d s .....