The SparkFun OpenLog is an open-source data logger that works over a simple serial connection and supports microSD cards up to 32GB. It is designed to be a straightforward way to log data from sensors, serial devices, or any data source for that matter. The OpenLog provides a simple solution for adding storage to your project and can be used in applications such as weather stations, motion analysis, and event logging systems.
Pin # | Name | Description |
---|---|---|
1 | GND | Ground connection |
2 | VCC | Power supply (3.3V to 12V) |
3 | RXI | Serial Receive Input |
4 | TXO | Serial Transmit Output |
5 | GRN | A signal to indicate logging status (optional use) |
config.txt
file on the microSD card.config.txt
file for proper settings.#include <SoftwareSerial.h>
SoftwareSerial openLog(2, 3); // RX, TX
void setup() {
// Start the serial communication
Serial.begin(9600);
openLog.begin(9600); // Match the OpenLog's default baud rate
Serial.println("Initializing OpenLog");
// Send a command to OpenLog to start a new log file
openLog.print("new logFile.txt\r");
}
void loop() {
// Example data to log
String data = "Temperature: " + String(analogRead(A0));
// Write data to the OpenLog
openLog.println(data);
// Wait for a second before logging next data point
delay(1000);
}
Note: The above code assumes that the OpenLog is connected to digital pins 2 and 3 on the Arduino UNO. Adjust the SoftwareSerial
pins in the code if you use different pins. Remember to keep the code comments concise and within the 80 character line length limit.