Skip to main content
36 votes

How to read and write EEPROM in ESP8266

While EEPROM.read and EEPROM.write are valid methods, it's like mopping the floor with a toothbrush. Use EEPROM.put and EEPROM.get instead. For example: #include <EEPROM.h> void setup() { ...
codechimp's user avatar
  • 461
10 votes
Accepted

Can you access the EEPROM of an ATtiny with Arduino Code?

The Arduino EEPROM library is compatible with the ATTiny range of AVR microcontrollers as the library itself is built on the standard Atmel AVR avr/eeprom.h 'library' so it is compatible with all the ...
RSM's user avatar
  • 1,457
9 votes

EEPROM bytes preset to 255 while programming

In flash and eeprom memory an erased value is 255. It's all about how flash memory works. If you want something other than 255 in there you will have to write something other than 255 in there.
Majenko's user avatar
  • 105k
8 votes

Run code once after programming

This is a X->Y problem. Here is a solution for X: Bit 3 of high fuse of the ATmega328p controls if EEPROM memory is preserved through the chip erase. You can change the high fuse setting in boards....
Juraj's user avatar
  • 18.1k
7 votes

How do you write to a free location on an external EEPROM?

You can divide EEPROM space into entries and provide each entry with a single "used" bit. You could use a separate byte to store it, or reuse a bit from a byte which is not completely used ...
Dmitry Grigoryev's user avatar
7 votes

How to increase life of EEPROM?

The other answer mentioned some general ideas; here are a couple of more-specific notes. • You can direct your writes of single bytes through a routine that reads the EEPROM cell before writing to it,...
James Waldby - jwpat7's user avatar
7 votes

How to save a float variable to the EEPROM?

Since your floating point value always uses only 1 digit after the comma, why not multiply it by 10 and put it in an integer? For a value up to 15.0 (resulting in 150 int), you can use a simple byte ...
Michel Keijzers's user avatar
7 votes
Accepted

EEPROM.get returns bad data

You are saving a String object in EEPROM, which is useless. A string object does not store the contents of your string. Instead, it just stores: the memory address where the actual contents (the ...
Edgar Bonet's user avatar
  • 43.1k
7 votes
Accepted

How can I read the data stored in EEPROM although is powered OFF based on the simple code I wrote?

increase is a global variable and will implicitly initialized with the value zero. Then you are reading the EEPROM data into the variable storagedata in setup(). And then in loop() you are increasing ...
chrisl's user avatar
  • 16.3k
6 votes
Accepted

How can configuration values be stored on an ESP8266?

Thanks to Jaromanda X and Juraj for the SPIFFS recommendation. I was able to use this block of SPIFFS code as an example and safely store settings in my project outside of the compiled source. To ...
travis's user avatar
  • 201
6 votes

Which EEPROM has a long lifecycle?

You can cycle through all the addresses in the EEPROM like a ring buffer. You'll need to reserve a bit so you can binary search for the head of the buffer during startup. You can also reduce how ...
ratchet freak's user avatar
6 votes

Spiffs vs Eeprom on esp8266

On the ESP8266 there's very little to choose from between the two. It all really boils down to what you want to store and how you best want to access it. EEPROM emulation is ideal for small bits of ...
Majenko's user avatar
  • 105k
5 votes
Accepted

EEPROM - Storing Static Data

Some things I noticed in your code: You are writing everything to the same address (is that intentional?) You are only writing the first 6 six bytes of your arrays (I am pretty sure that is ...
DarthRubik's user avatar
5 votes
Accepted

What is the best way to get more RAM for a sound buffer?

A simple SPI SRAM chip. Available up to 128KB, such as the 23LC1024: http://www.microchip.com/wwwproducts/en/23LC1024
Majenko's user avatar
  • 105k
5 votes

EEPROM put and get not working on ESP8266 (NodeMCU)

The ESP8266 doesn't have any EEPROM. Instead it emulates it using Flash. In order not to wear out your flash you have to "commit" changes to the flash once they have been queued for writing - ...
Majenko's user avatar
  • 105k
5 votes
Accepted

How to increase life of EEPROM?

I can think of a few: don't power it on unless you have to; don't write to it unless you have to; write as little data to you as you can - compress the data; only write to it during brown out or ...
dannyf's user avatar
  • 2,770
5 votes

EEPROM - Arduino

(1) How many locations are there in EEPROM? (For ARDUINO UNO & MEGA) Read the datasheet for the chip on the board. It tells you how many bytes or kilobytes the chip has for EEPROM. For instance ...
Majenko's user avatar
  • 105k
5 votes

Is it possible to use extra AVR Flash memory as non-volatile EEPROM-like Flash memory storage?

Yes you can. This Arduino IDE add on lets you make calls to code store in the bootload of memory so you can make changes to the flash memory. https://majek.sh/en/writing-to-internal-flash-on-arduino/ ...
CrossRoads's user avatar
  • 2,415
5 votes
Accepted

Is it possible to use extra AVR Flash memory as non-volatile EEPROM-like Flash memory storage?

The answer is "yes, you can use extra AVR Flash memory as non-volatile EEPROM-like Flash memory storage, very similar to an STM32 microcontroller." One of these days I'm going to write an Arduino ...
Gabriel Staples's user avatar
5 votes
Accepted

Write faster on AT24C32

after writing a value to EEPROM, and terminating the I2C connection with a STOP, the EEPROM enters a self writing mode to write what you have sent to it, to it's internal memory. (you don't actually ...
Tirdad Sadri Nejad's user avatar
5 votes

How can I read the data stored in EEPROM although is powered OFF based on the simple code I wrote?

The problem is that you fail to initialize increase during setup(). The variable is undefined when the code enters the loop() function, even regardless of whether this is the first boot or not. You ...
PMF's user avatar
  • 1,296
5 votes
Accepted

What is wrong with the way I write and or read the EEPROM adresses?

You forgot to call Serial.begin() in setup(). As a side note, your if tests are useless. The compiler warns me that: comparison is always true due to limited range of data type For reference: the ...
Edgar Bonet's user avatar
  • 43.1k
4 votes

Is using malloc() and free() a really bad idea on Arduino?

Is it a really bad idea to use malloc() and free() with Arduino? The short answer is yes. Below are the reasons why: It is all about understanding what an MPU is and how to program within the ...
Mikael Patel's user avatar
  • 7,969
4 votes

What is the real lifetime of EEPROM?

The magic solution - if you dont want to code what Cybergibbons said about reading before writing, is the EEPROM.update() function. It does exactly that: EEPROM.update(address, value); will only ...
Jorge's user avatar
  • 41
4 votes
Accepted

Set EEPROM from PC before program

The simplest way would be to have two sketches. One that will store all the strings into EEPROM. After that you can upload the second actual sketch that uses the values stored in EEPROM. You ...
Gerben's user avatar
  • 11.3k
4 votes

EEPROM bytes preset to 255 while programming

You need to set EESAVE fuse When the ATmega chip is programmed the memory is erased just before the new code is uploaded. Under normal circumstances the eeprom memory is erased as well as the program ...
Cano64's user avatar
  • 280
4 votes

How do I erase internal EEPROM on a Arduino Pro Mini

You are clearing 28 decimal bytes, but your address range is 28 hex bytes, or 40 bytes of data. Hence, the last 12 characters are untouched.
KC Tucker's user avatar
  • 396
4 votes
Accepted

Read float and long from external EEPROM chip

1510543923 is stored as: 01011010 00001001 00010010 00110011 This is known as “big endian”, or “MSB first”, because the most significant byte (MSB, here 01011010) comes first. I recommend against ...
Edgar Bonet's user avatar
  • 43.1k

Only top scored, non community-wiki answers of a minimum length are eligible