Example Code for Arduino-Read & Write SRAM
Last revision 2025/12/08
Run this routine to read and write RAM data in the RTC module.
Hardware Preparation
- DFR0216-2 DFRduino UNO R3 with IO Expansion Shield and USB Cable A-B x 1
- DFR0998 Fermion: SD3031 RTC Module x 1
- FIT0916-FF DuPont Wires x4
Software Preparation
- Download Arduino IDE: Click to download Arduino IDE
- Download the DFRobot_SD3031 library: DFRobot_SD3031 library
- About how to install the library?
Wiring Diagram

| Sensor Side | Pin Name | MCU Side | Pin Name |
|---|---|---|---|
| Fermion: SD3031 RTC Module | VCC | UNO R3 | 3.3V |
| Fermion: SD3031 RTC Module | GND | UNO R3 | GND |
| Fermion: SD3031 RTC Module | SDA | UNO R3 | SDA |
| Fermion: SD3031 RTC Module | SCL | UNO R3 | SCL |
Sample Code
/*!
* @file getTimeAndTemperature.ino
* @brief Run this routine to read and write RAM data in the RTC module
* @copyright Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)
* @license The MIT License (MIT)
* @author [TangJie]([email protected])
* @version V1.0.0
* @date 2022-07-27
* @url https://github.com/DFRobot/DFRobot_SD3031
*/
#include "DFRobot_SD3031.h"
DFRobot_SD3031 rtc;
void setup()
{
uint8_t data= 0;
Serial.begin(115200);
/*Wait for the chip to be initialized completely, and then exit*/
while(rtc.begin() != 0){
Serial.println("Failed to init chip, please check if the chip connection is fine. ");
delay(1000);
}
rtc.writeSRAM(0x2D,2);//Address Range 0x2c~0x71
delay(1000);
data = rtc.readSRAM(0x2D);
Serial.print("data:");
Serial.println(data);
delay(100);
rtc.clearSRAM(0x2D);
delay(100);
data = rtc.readSRAM(0x2D);
Serial.print("data:");
Serial.println(data);
}
void loop()
{
delay(1000);
}
Result
The data read from the serial port output.

Was this article helpful?
