# EEPROM write / read - often

**URL:** <https://forum.arduino.cc/t/eeprom-write-read-often/387714>\
**Category:** Programming\
**Created:** [May 23, 2016, 5:43pm UTC](https://forum.arduino.cc/t/eeprom-write-read-often/387714 "2016-05-23T17:43:17Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![lonas](https://avatars.discourse-cdn.com/v4/letter/l/c5a1d2/32.png) [@lonas](https://forum.arduino.cc/u/lonas)\
**Post date:** [May 23, 2016, 5:43pm UTC](https://forum.arduino.cc/t/eeprom-write-read-often/387714/1 "2016-05-23T17:43:17Z")

</div>

Hi,  
can some one advice is this is good/bad idea to hold 30 relay states in EEPROM ?  
I would like to use relay which remember his state even when power is down - but because of this I will not know in which state relay was after arudino restart.

---

<div class="post-metadata">

**Author:** ![UKHeliBob](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/ukhelibob/32/215663_2.png) [@UKHeliBob](https://forum.arduino.cc/u/UKHeliBob)\
**Post date:** [May 23, 2016, 6:00pm UTC](https://forum.arduino.cc/t/eeprom-write-read-often/387714/2 "2016-05-23T18:00:23Z")

</div>

How frequently do the relay states change ?  
How often is the Arduino expected to power down ?

I believe that relays are available that latch mechanically in either position so their state is not affected by loss of power. Depending on the number of contacts available and the application it would be possible to query the relays for their current state on startup of the Arduino.

---

<div class="post-metadata">

**Author:** ![lonas](https://avatars.discourse-cdn.com/v4/letter/l/c5a1d2/32.png) [@lonas](https://forum.arduino.cc/u/lonas)\
**Post date:** [May 23, 2016, 8:06pm UTC](https://forum.arduino.cc/t/eeprom-write-read-often/387714/3 "2016-05-23T20:06:55Z")

</div>

Relay changes quite a lot - every time You have turn on/off light.  
I think EEPROM have some restriction for cycles number.

There are relays which are not loosing state when loss power (You just trigger relay change with L or H signal) but I have not found similar relay which I can query for state ?

---

<div class="post-metadata">

**Author:** ![KeithRB](https://avatars.discourse-cdn.com/v4/letter/k/74df32/32.png) [@KeithRB](https://forum.arduino.cc/u/KeithRB)\
**Post date:** [May 23, 2016, 8:20pm UTC](https://forum.arduino.cc/t/eeprom-write-read-often/387714/4 "2016-05-23T20:20:16Z")

</div>

The EEPROM is millions of cycles. For most human-scale uses (like light switches) it should be fine. What you don't want to to is write to it every time you go through loop.

(BTW, reads are fine. Writes are what wear it out.)

---

<div class="post-metadata">

**Author:** ![UKHeliBob](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/ukhelibob/32/215663_2.png) [@UKHeliBob](https://forum.arduino.cc/u/UKHeliBob)\
**Post date:** [May 23, 2016, 8:25pm UTC](https://forum.arduino.cc/t/eeprom-write-read-often/387714/5 "2016-05-23T20:25:20Z")

</div>

> I have not found similar relay which I can query for state ?

You just need the relay to be double pole so that you can use the second pole to feed back the current state.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 23, 2016, 8:26pm UTC](https://forum.arduino.cc/t/eeprom-write-read-often/387714/6 "2016-05-23T20:26:20Z")

</div>

> can some one advice is this is good/bad idea to hold 30 relay states in EEPROM ?

Four bytes of EEPROM.  
Yup, no big deal.  
You normally have about half as much EEPROM as RAM.

---

<div class="post-metadata">

**Author:** ![lonas](https://avatars.discourse-cdn.com/v4/letter/l/c5a1d2/32.png) [@lonas](https://forum.arduino.cc/u/lonas)\
**Post date:** [May 23, 2016, 9:15pm UTC](https://forum.arduino.cc/t/eeprom-write-read-often/387714/7 "2016-05-23T21:15:24Z")

</div>

thanks

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 5, 2021, 9:54pm UTC](https://forum.arduino.cc/t/eeprom-write-read-often/387714/8 "2021-05-05T21:54:39Z")

</div>


