Can a DS1307 RTC be used as EEPROM

I know that the DS1307 has EEPROM area to store time information. But, can it be used to save user data (i.e. SI units vs. English units, general user settings... )?

The data sheet says:-

56-Byte, Battery-Backed, Nonvolatile (NV) RAM for Data Storage

So while it is not EEPROM it can be used like it.

Note when the battery is removed you loose it.

stievenart:
I know that the DS1307 has EEPROM area to store time information. But, can it be used to save user data (i.e. SI units vs. English units, general user settings... )?

Grumpy_Mike:
The data sheet says:-So while it is not EEPROM it can be used like it.

Note when the battery is removed you loose it.

Okay, thanks for setting up my next question... How do you write data to a DS1307 in EEPROM mode?

in EEPROM mode?

No such thing as I said.

The data sheet has all the answers.

Selected highlights:-

The RAM registers are located in address locations 08h to 3Fh.

So that is where you write to.
See Figure 5. Data Write—Slave Receiver Mode
You write the address followed by the data, if more than one data byte is sent each successive bytes goes in the next address location.

For reading back see Figure 6. Data Read—Slave Transmitter Mode. Which is the same in reverse, send the address to read and successive reads give you the data contents.

I found an example that does all the heavy lifting:

// Example of using the non-volatile RAM storage on the DS1307.
// You can write up to 56 bytes from address 0 to 55.
// Data will be persisted as long as the DS1307 has battery power.

#include <Wire.h>
#include "RTClib.h"

#if defined(ARDUINO_ARCH_SAMD)
// for Zero, output on USB Serial console, remove line below if using programming port to program the Zero!
   #define Serial SerialUSB
#endif

RTC_DS1307 rtc;

void printnvram(uint8_t address) {
  Serial.print("Address 0x");
  Serial.print(address, HEX);
  Serial.print(" = 0x");
  Serial.println(rtc.readnvram(address), HEX); 
}

void setup () {

#ifndef ESP8266
  while (!Serial); // for Leonardo/Micro/Zero
#endif
  Serial.begin(57600);
  rtc.begin();

  // Print old RAM contents on startup.
  Serial.println("Current NVRAM values:");
  for (int i = 0; i < 6; ++i) {
     printnvram(i);
  }

  // Write some bytes to non-volatile RAM storage.
  // NOTE: You can only read and write from addresses 0 to 55 (i.e. 56 byte values).
  Serial.println("Writing NVRAM values.");
  // Example writing one byte at a time:
  rtc.writenvram(0, 0xFE);
  rtc.writenvram(1, 0xED);
  // Example writing multiple bytes:
  uint8_t writeData[4] = { 0xBE, 0xEF, 0x01, 0x02 };
  rtc.writenvram(2, writeData, 4);
  
  // Read bytes from non-volatile RAM storage.
  Serial.println("Reading NVRAM values:");
  // Example reading one byte at a time.
  Serial.println(rtc.readnvram(0), HEX);
  Serial.println(rtc.readnvram(1), HEX);
  // Example reading multiple bytes:
  uint8_t readData[4] = {0};
  rtc.readnvram(readData, 4, 2);
  Serial.println(readData[0], HEX);
  Serial.println(readData[1], HEX);
  Serial.println(readData[2], HEX);
  Serial.println(readData[3], HEX);
  
}

void loop () {
  // Do nothing in the loop.
}

A lot of DS1307 RTC modules also include an onboard AT24C32 32Kbit, (4KB), EEPROM.
Like this one:- RTC I2C DS1307 AT24C32 Real Time Clock Module For Arduino

There's info on accessing that EEPROM here:- Arduino DS1307 with AT24C32 - #4 by RandallR - Networking, Protocols, and Devices - Arduino Forum

OldSteve:
A lot of DS1307 RTC modules also include an onboard AT24C32 32Kbit, (4KB), EEPROM.
Like this one:- RTC I2C DS1307 AT24C32 Real Time Clock Module For Arduino

There's info on accessing that EEPROM here:- Arduino DS1307 with AT24C32 - #4 by RandallR - Networking, Protocols, and Devices - Arduino Forum

They are found on the DS3231 boards also.

2016-04-22_20-09-01.jpg

LarryD:
They are found on the DS3231 boards also.

2016-04-22_20-09-01.jpg

Yeah, right, I should have mentioned that. (I have some DS3231 modules with AT24C32 chips here.)
Thanks for adding the extra info, Larry.
(I figured it was worth mentioning the onboard EEPROM that's on many modules for people doing a search and finding this thread in the future.)

Edit: And I'm surprised that the DS1307 datasheet describes the 56-bytes of RAM as "NV". Non-volatile RAM usually means that memory is retained when the power is removed.
Non-volatile random-access memory

Well, if you take away the backup battery you also lose the time. So the NVRAM is as non-volatile as the time itself is.

CrossRoads:
Well, if you take away the backup battery you also lose the time. So the NVRAM is as non-volatile as the time itself is.

It's not NVRAM. Remove all power and the data is lost.

OldSteve:
It's not NVRAM. Remove all power and the data is lost.

A point I made in reply#1