Example for Arduino-Write Data in CSV Format
Last revision 2026/01/14
This article provides a step-by-step guide on how to write data in CSV format using Arduino and a Serial Data Logger, complete with hardware requirements, connection diagrams, sample code, and running results to help hobbyists and enthusiasts effectively log data.
Hardware Preparation
- DFRduino UNO R3 x 1
- Gravity: Serial Data Logger x 1
- M-M/F-M/F-F Jumper wires
Software Preparation
In the config.txt file, set FileFormat to 1
Connection Diagram

Sample Code
#define SPIN 6 //Connect to the module Pin S, trigger to save files at low level
uint16_t i = 0;
void setup(void)
{
Serial.begin(9600);
delay(2000); //To aviod data lost, delay a period of time to wait for the module to start
pinMode(SPIN, OUTPUT);
digitalWrite(SPIN, HIGH);
}
void loop(void)
{
Serial.println(String(i));
i++;
if((i % 10) == 0){
digitalWrite(SPIN, LOW);
delay(500);
digitalWrite(SPIN, HIGH);
}
delay(300);
}
Running Results

Was this article helpful?
