Fermion: Serial Data Logger Wiki - DFRobot

Introduction

Compared to the previous Fermion: MicroSD Card Module for Arduino (Breakout), this Fermion: Serial Data Logger can store data more conveniently, and supports direct data printing through serial port without additional codes. Fermion: Serial Data Logger supports 32GB TF card, making it suitable for long-time data storage. The device comes with a USB function, which means you can directly connect it to a PC computer to read the stored files without using a card reader. Meanwhile, with the onboard LED indicator, data writing status can be viewed visually. And the SAVE pin makes it easier to store data into separate files.

The upgraded V2.0 version compared to V1.0 version:

For First Time Use

  1. Format the SD card
  2. 1 Press the "Win+R" keys and then enter "diskpart" to enter the command prompt interface
  3. 2 Enter “list disk” to display the storage list
  4. 3 Enter “select disk X” (X is the disk number of the SD card) to select the disk
  5. 4 Enter “clean” to clear the disk partition information
  6. 5 Enter “convert mbr” to convert the disk to MBR format
  7. 6 Enter “create partition primary” to create a partition
  8. 7 Enter “select partition 1” to select the created partition
  9. 8 Enter “format fs=fat32 quick” to quickly format the disk to FAT32
  10. Power on the module through the power supply of the UART interface for more than 2 seconds, so that the module automatically generates the CONFIG.TXT file.
  11. Check whether the CONFIG.TXT file is generated normally. You can modify the module parameters by modifying CONFIG.TXT.
  12. Connect the module to the main control serial port to store data normally.

Configuration file parameters Baud: Serial communication baud rate selection (00 corresponds to 2400 baud rate, 01 corresponds to 4800 baud rate). The module baud rate must match the baud rate of the main control serial port printing in order to store data normally.

FileNum: The file sequence number for the next new file (FileNum=0099, the next generated file name will be FILE0099.txt). The file sequence number automatically increments. If the file already exists, it will overwrite the current file.

FileFormat: File storage format, 0-TXT, 1-CSV.

Time: Automatically create files on schedule, 0-Do not create files on schedule, N-Create files every N minutes to store data [N: 0~10080 (one week)].

Note

  1. Don't send data to the module serial port before CONFIG.TXT file is generated.
  2. Don't connect the USB and serial ports at the same time.
  3. Connect the PC through USB. It is recommended to eject the USB flash drive before removing the module.

Features

Applications

Specification

Pinout

Num Silkprint Description
1 VCC Power VCC
2 GND Power GND
3 RX UART Receive
4 TX UART Transmit
5 S SAVE pin/button, save the current file, and create a new file to store the following data, save data at low level.

SD LED indicator is the one for data interaction between module and storage. It blinks when data is being written or a new file is being created.

Tutorial

Requirements

Connection Diagram

Sample Code 1 - Write Data

Write data to the module through Serial.print, save a file every once in a while.

#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);
}

Sample Code 2 - Write data in CSV format

NOTE: In the config.txt file, set FileFormat to 1

#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);
}

FAQ

Q&A Some general Arduino Problems/FAQ/Tips
Q The CONFIG.TXT file isn't automatically generated when the module is powered on.
A Check whether the USB host is used to power the module first, and then check whether the file system for storage is FAT32.
Q The SD indicator is not lit when data is rapidly written to the module.
A The SD card has write endurance cycles of 100 thousand times. In order to ensure the SD life, write to SD card once about 50ms or 512 bytes after the module writes to data.
Q When will the module enter USB flash drive mode? When to enter data storing mode?
A When a USB host is used to connect the module, the module enters the USB flash drive mode, at the time data can't be stored in the module and the CONFIG.TXT file and new blank files will not be automatically generated when the module is powered on. In other cases, the module enters the data storing mode, and the CONFIG.TXT file and new blank files will be generated automatically if the module doesn't have a CONFIG.TXT file.
Q What can I do if a file cannot be deleted?
A Please format the storage first, and then refer to the methods in "For First Time Use".
A For any questions, advice or cool ideas to share, please visit the DFRobot Forum.

More Documents