help, entering data to SpkFun OpenLog, via Arduino

Need help, entering data to SpkFun OpenLog, via Arduino Pro?

Command Set
Upon power up, in default ‘NewLog’ mode, OpenLog will output '12<'[in a terminal PC program] (note the less than sign) at which time you can start throwing characters at it. Those characters will be recorded to LOG###.txt. You can press Ctrl+z at any time and OpenLog will exit record mode and drop into command mode. Command mode is signified with a ‘>’ (greater than) sign. You can then enter the following command :[Basic Commands]

I’ve got my SparkFun OpenLog to operate using hyperterminal, and am able to enter the basic commands(via hyperterm.)

This is all well and good, but now I need to use the OpenLog to log data via my Arduino Pro.
Can someone give me a hint as to how to move data to the OpenLog via arduino,( both are equipped with an atmega328)?

  1. I’ve created an arduino sketch, which I thought would send data to OpenLog, AND DOWNLOADED SKETCH TO ARDUINO PRO.
  2. Connected the OpenLog to arduino’s ‘serial port’ as per directions, pushed SD card into place, hit reset on arduino.
    3)OpenLog LEDs blink and wink as if something is happening.
  3. When I look at card files, I see that new files are being created, as they should, and even a file that I created is there. However nothing has been recorded in the files.
#include <stdio.h>
char buffsec[50];

int tyme = 0;
#define rxPin 0
#define txPin 1
int val =0;
int txval = 0;
// set up a new serial port

void setup()  {
  // define pin modes for tx, rx:
  pinMode(rxPin, INPUT);
  pinMode(txPin, OUTPUT);

void loop() {
  while (millis() <= 1000){
    tyme = millis();
    sprintf(buffsec, "%u",tyme);  
    byte buffer2[] ={buffsec[0],buffsec[1],buffsec[2],13,9 };
    int i;
    for (i = 0; i < 5; i = i + 1) {


That arduino sketch will Serial.print tyme(time in milliseconds) at the serial port(COM4), but nothing shows up on the SD card.

Does the OpenLog’s 328 need to be programmed to accept the data? Or something?


No real answers, but a couple of questions.

millis returns an unsigned long, but you are storing the value in an int.

Then, you are using the u format to convert the signed value to a string. Does it work any better if tyme is an unsigned long?

What is the purpose of buffer2?

The TX and RX pins have explicit modes. I don't think you need to (or should) be setting them, in setup.

Finally, don't you need to open a file on the SD card, somewhere, before trying to write to it?

I see that SparkFun is sold out on those gizmo's. Does that mean everybody that bought an OpenLog has got them up and running, and I'm the only person that can't figure it out? :( :-[

Tough getting answers on this one. There's gotta be a simple procedure, but I'm doing something wrong.

Ignore the previous sketches that I provided, they don't work.


I don’t have an openlog device, but I do have their “LogoMatic” which is a different implementation of a similar concept.

I have a couple of easy things to try (I don’t mean any insult by these though).

First - is the SD card formatted so that the opnelog can store data on it?

Second - have you tried swapping the wires you have going from your Arduino TX & RX lines to the OpenLog TX & RX lines? It’s very easy to get the TX & RX flipped around (TX from Arduino should goto RX on the OpenLog, and vice-vera with RX).

Third - are you sure there is a common ground between the openlog and the Arduino? (Does the GND line connect between the two.)

If those don’t works try this:

Let’s try a really simply program to print ASCII text, instead of variables to a debug serial (which you can read on your PC), and at the same time send it to the OpenLog.

Connect the following pins:
OpenLog VCC to Arduino 5V
OpenLog GND to Arduino Gnd
OpenLog TXO to Arduino Pin 2
OpenLog RXI to Arduino Pin 3
(Leave Arduino Pins 0 and 1 disconnected)

Now program the following code (to the Arduino - not the Openlog):

#include <NewSoftSerial.h>

NewSoftSerial mySerial =  NewSoftSerial(2, 3);

void setup() {
       // Openlog RXI pin -> Ard 3, Openlog TXO -> Ard 2

void loop() {
  Serial.println("This is a test line of text.");
  mySerial.println("This is a test line of text.");
  delay(5000);    // wait 5 seconds

After you compile and upload the code to the Arduino, open the Serial Monitor from the Arduino IDE. You should see it repeating the phrase “This is a test line of text.” once every five seconds.

If so, turn off power after a few repeats and check the data on the SD card.

If not, verify the data pins from the Arduino to the OpenLog.

Post Results.

Thanks, 33Warlord.

I followed your sketch and modified it so that it will operate from the regular serial port of my Arduino pro, but not every time. One has to play some tricks with it in order to get it started.

I’ve used this sketch a few times now

unsigned long tme = 0;
unsigned long ret = 0;
int length = 6; //not used

void setup() {

void loop() {
//while (millis() <= 20000) // not in use yet, collects dat, can be changed
tme = millis();
if (tme - ret >= 1000){ //results in 1-sec readings
int secs = tme/1000;
Serial.print ("secs = ");
Serial.println (secs);
ret = tme;

//Serial.println(“This is a test line of text.”);
//delay(2000); // wait 5 seconds

/Connect the following pins:
OpenLog VCC to Arduino 5V
OpenLog GND to Arduino Gnd
OpenLog TXO to Arduino dPin 0(RX)
OpenLog RXI to Arduino DPin 1(TX)
OpenLog grn to Arduino Serial pin RST(GRN)

I used your sketch at first, but I wanted to see if the OpenLog would record numbers, in this case time in seconds. However, it still requires some tricky starting maneuvers.

This, or another, sketch needs to be loaded on the arduino pro. Since the OpenLog connects directly to the same arduino pins that the USB conversion programmer does. The programmer needs to be disconnected, then OpenLog connects directly to the same arduino pins(tx & rx are inherently switched) Power is connected to arduino first, then OpenLog connected the pins without the card inserted, reset arduino, insert card. reset arduino, take card out reinsert card etc, you have to play a few diddling games until it appears to be running. Its a little complicated. Sometimes it runs sometimes it doesn’t. >:( :-/ :-?

Use softserial

Thanks, aspire.

I've had other problems with OpenLog since my original post, but with help from Sparkfun and others, I've gotten it to run OK. I can, now, use it for my purposes.

Thanks. I'll look into softserial. :)

Have been trying to get Open Log working for over a week now, and could use any advice out there…

Updated Open Log to newest Firmware V2.1, running Arduino 0018 and am trying to connect Open Log to an Arduino Pro Mini 328 5V 16Hz. Have tried a direct connection via the FTDI cable, and can get to the command prompt, few files etc. without any troubles. Open Log does create the Config.txt file, and log files on power up as well. When connected to a serial port on the PC via the FTDI cable, Open Log does record the information from the serial port.

The problem is: when I connect to the Arduino Pro using Soft Serial, the log files are created, but they are empty. I am using the example code from this post:

#include <NewSoftSerial.h>

NewSoftSerial mySerial =  NewSoftSerial(2, 3);

void setup() {
       // Openlog RXI pin -> Ard 3, Openlog TXO -> Ard 2

void loop() {
  Serial.println("This is a test line of text.");
  mySerial.println("This is a test line of text.");
  delay(5000);    // wait 5 seconds

Is the pin configuration on the Mini maybe the problem? Any help would be greatly appreciated.

Well, it's been a couple of months since my last post, and I still haven't managed to get OpenLog + Arduino Pro Mini to work in any type of consistent manner. I have since updated to Arduino 0021, and am going to give the newest OpenLog firmware v2.3 a try...

Going through the multi-step connection voodoo mentioned in the previous post seems to be true for me as well, but in over 100+ attempts of all types, I have only been able to successfully log data a grand total of 3 times!

If there is a fix for the OpenLog where it just creates empty files without logging any data in them (at least 97%+) of the time, I would appreciate it!

I also recently purchased the OpenLog from SparkFun. I can not get it to write ANY files. The LED flashes like it's receiving data but I see NO files. I've tried plugging it into a Duemilano and the Mini 328.

I even created the CONFIG.txt file mentioned in the docs. I even performed the "Reset back to factory settings" option . (I accidently downloaded a sketch to it once.) Did I wipe out the firmware with this sketch? Of course, It wasn't working before I did that download.. :(

What's the idea of powering up the OpenLog without the SD card, and then putting it in and restarting it?

I checked the card on my PC and it said the card was formatted with "FAT"... I have GND, 5V pins , TX, RX pins defined as suggested previously..

Any thoughts? Thanks.