LowPowerLab Forum

Hardware support => Moteino => Topic started by: niranjan_187 on August 16, 2015, 05:24:09 PM

Title: Using EEPROM
Post by: niranjan_187 on August 16, 2015, 05:24:09 PM
Hello,

I wanted to know if there is a way to store a variable information in some memory for more than 10,000 times? I got to know with EEPROM it is possible to write for 10,000 times to EEPROM. I am developing an application which requires storing a variable frequently. There is a high possibility that this would exceed 10,000 times. Is it possible to use a SD card for the same with moteino?

Please pardon me if this sounds a very naive query. But I am a bit new to Arduino hardware and wanted an expert advise on this issue to be on a safer side.

Waiting for your response.

Thank you in advance.
Title: Re: Using EEPROM
Post by: TomWS on August 16, 2015, 07:10:04 PM
Quote from: niranjan_187 on August 16, 2015, 05:24:09 PM
Hello,

I wanted to know if there is a way to store a variable information in some memory for more than 10,000 times? I got to know with EEPROM it is possible to write for 10,000 times to EEPROM. I am developing an application which requires storing a variable frequently. There is a high possibility that this would exceed 10,000 times. Is it possible to use a SD card for the same with moteino?

Please pardon me if this sounds a very naive query. But I am a bit new to Arduino hardware and wanted an expert advise on this issue to be on a safer side.

Waiting for your response.

Thank you in advance.
Just to be clear, this variable you're storing needs to be persistent across power cycles of the Moteino?   
And it's updated so often that you would exceed 10,000 writes to EEPROM? 
Does the value change dramatically with each update?  For example, can you filter so that you only write the value if it changes by x percentage?

Regarding SD card, most SD store algorithms do load balancing so saving the same value to the same file will write it to multiple places, thereby spreading the number of cycles over several addresses.  I don't know how many writes you can achieve, but it is significantly higher than a single cell in EEPROM.

Tom
Title: Re: Using EEPROM
Post by: Felix on August 16, 2015, 08:32:21 PM
The way I do it with my water meter, I use a sliding/cycling window algoritm to reduce EEPROM wear. I use 10 or 100 slots. I write a new value in a new slot each time, when I reach the limit I go back to 1 and repeat.
That reduces "wear" by a factor of 10/100. You could use the entire EEPROM like that. I know the datasheet says 100K? but as far as I can tell and from what I've read in other blogs where folks have tried this, the EEPROM can achieve 1 million writes with 100% reliability.
Title: Re: Using EEPROM
Post by: LaneF on October 31, 2015, 12:36:15 PM
In trying to use the #Index EEMPROM.h  with my SwitchMote Config, my code compiler throws a myriad of errors.  Does anyone recognize this?


QuoteSwitchConfig.ino: In function 'void setup()':
SwitchConfig.ino:51:3: error: 'EEPROM' was not declared in this scope
SwitchConfig.ino:62:24: error: expected primary-expression before '>' token
SwitchConfig.ino:63:24: error: expected primary-expression before '>' token
SwitchConfig.ino: In function 'void handleMenuInput(char)':
SwitchConfig.ino:104:64: error: 'EEPROM' was not declared in this scope
SwitchConfig.ino:209:32: error: 'EEPROM' was not declared in this scope
SwitchConfig.ino: In function 'void eraseSYNC()':
SwitchConfig.ino:250:3: error: 'EEPROM' was not declared in this scope
SwitchConfig.ino:250:25: error: expected primary-expression before '>' token
SwitchConfig.ino:251:25: error: expected primary-expression before '>' token
Error compiling.
Modify message

Thanks LaneF
Title: Re: Using EEPROM
Post by: TomWS on October 31, 2015, 03:48:20 PM
Quote from: LaneF on October 31, 2015, 12:36:15 PM
In trying to use the #Index EEMPROM.h  with my SwitchMote Config, my code compiler throws a myriad of errors.  Does anyone recognize this?
...
Perhaps if, instead of the above, you wrote

#include <EEPROM.h>


I suggest that you show us your #include section that you have in your sketch file and also tell us what version IDE you're using.

Tom
Title: Re: Using EEPROM
Post by: LaneF on October 31, 2015, 06:07:45 PM
Tom,

Thanks for getting back to me.  See the pic of my #Include statements.  The #Index was just an "on-the-fly" type-O, the js code does say "#Include".


Thanks Again - Cheers

LaneF

PS - Big fan of your Woodshop Air Actuated dust collection and the Pencil Post Bed you made is spectacular.
Title: Re: Using EEPROM
Post by: LaneF on November 01, 2015, 11:57:50 AM
Problem solved (this one for now).  I had to reload Arduino and instead of installing 1.0.6 I did the current default load.  That's the problem.  I re-read some of your past post and spotted Felix's comment about using 1.0.6 "..it works for me" so I uninstalled the current ver and went back to 1.0.6.

Thanks
LaneF
Title: Re: Using EEPROM
Post by: Felix on November 01, 2015, 10:15:28 PM
Unfortunately they really dropped the ball in some aspects on the newer releases. They added some nice functionality but messed up several others. I still prefer the good old 1.0.6 which just works.