Make your Arduino “Remember” using the built in EEPROM - Tutorial
Vložit
- čas přidán 23. 07. 2024
- *There's an easter egg in this video, comment below if you saw it :)
Power failure? No problem! Just use the Arduino EEPROM to save the state so you can restart from there when the power is restored. - Věda a technologie
it really helps a lot man...your explanation for comments had cleared my doubts as well....Thanks for sharing 😊...!
Great video, your explanation was clearly understandable. Thanks for sharing!
thanks Mr, Ivan this is really a good Tuto (y) ;)
it helps on my project that i still working on it
thanks a lot man, that saves a lot resource and time than storing few bits of data in SD module.
Thanx for the video. I'm working on a library for storing and saving strings to internal or external EEPROM. You gave me an idea on what kind of functions are interesting to include in these libraries. This library will store your random number to one of 32768/1024 external/internal EEPROM addresses (address calculated automatically by the library). Each new random number will be stored at address+1 in a circular addressing mode. When you power up, the latest address will be again calculated by the library to enable you to fetch your latest random number. I'm doing this as a wear-levelling mechanism to prolonge the life of the EEPROM. You can only write 100000 times to any specific address. So now, you'll have about 100 million stores of your number before you have to change your Nano.
Very good tutorial, I was looking for a solution for a small project. It will help me. Thank you.
Thanks for watching Stephane, glad the video helped with your project. Cheers!
Thanks for the very good explanation!
I assume seeding the random number generator (maybe a sample from one of the open analog pins) would make that random number sequence become a bit less predictable?
thank you so much for your tutorial!!
I've been using EEPROM for a long time now on many projects.
It's really handy when you have a larger project where you have setup configurations that you may need to change.
For those who may have not used this before, I want to suggest that you be very careful of which locations you use and for how many bytes a variable may require.
If it's just up to 256, no problem to keep locations close.
BUT, if you have a variable that can get very large, where you need to use .put instead of .write, this is where you need to be aware of what can happen as the variable gets larger.
This is something that I totally forgot about when I made a project that I called, "mini sump pump."
This was a little pump that was triggered by a water level float that I made to detect when the water level in an area. The pump would be turned on to pump the water out.
The water level float is an arm that I designed on the 3D printer with a gear end on it. When lifted or lowered, it moved a gear on a potentiometer. I use those number for low/high water levels.
I have a setup page where I can set values to trigger the pump for on or off, based on a lower number and higher number.
But here's where I messed up. LOL
In location 0, I had the sketch keep a count of how many times the pump was cycled. I just wanted to get an idea of how much water was coming into the area.
The bad part, was that I didn't just save the number now and then, rather, I updated it on every cycle.
I used .put. The number grew to almost 300,000 and of course, more types were used.
So what happened there, is that this over-wrote some configuration numbers and caused problems. OOOPS! LOL This caused the system to be glitchy and not run properly.
So a few days ago, I re-wrote the sketch to not bother with the counter and now, all is working right again.
I just thought that I'd share that and save people some headaches.
Great vid, thanks. I have a homeautomation project that this would come in handy. But what if you hit the reset button, would that clear the memory?
Great question! No The reset button just restarts the code on the Arduino. So the EEPROM memory doesn't get affected. Technicaly you can't really clear the EEPROM memory, I think that when you receive a brand new Arduino, all the bytes in the EEPROM will contain "ones" or are set to "11111111", or a decimal value of 255 . So I guess if you wanted to get back to that state you could do a FOR LOOP to write a value of 255 to all the bytes. Thank again for a great questions and for watching! Cheers!
If your using an int I presume it must assign 2 address bytes so when how do you know what address to put in brackets
Thanks for sharing 💁
is there a way to store gifs or something on the memory of the chip on the uno?
The EEPROM memory is too small for pictures, but I have another video where I use the PROMEM memory to store some 16x16 pictures. Maybe it can help, check it out here: czcams.com/video/Q1iVtLQOZOI/video.html
You teach me a lot and very important from 1:38
Where does the codes get to this?
Thank you for the great tutorial. Are you sure your name isn't Al? (tall Guy from Police Squad!)
Wow, totally forgot about that guy "Al" from Police Squad, had to google it... Thanks for the laugh!
Don't forget there is a limited number of writes an EEPROM cell can handle, about 100000 is guaranteed. Write as rarely as possible and never in a short loop.
That's correct, but also those 100,000 Writes are for "each" byte of the EEPROM... So you can write 100,000 times to byte#0, 100,000 times to byte#1, etc, before the bytes memory becomes unreliable. Thank you for your comment and for watching.
greatttttttttt
Thanks for watching Ali.
Good video, but what I was hoping for was to see how to save two different numbers in that are as high as 60 million.
I saw the easter egg!
Tres bien (that's close to the limit of my French) I didn't know there was space available to store data... interesting... 1001 uses I think.
Hi Garth, long time no see, hope all is well! Yes having some non volatile memory (even if it's just a little bit) can be very useful. Thanks for watching and hope to see you again soon. Cheers!
Camp Crystal Lake! LMAO!
😘😊😊👍🏻👍🏻👍🏻❤️
\(^-^)/ for watching!
Классно
Еще раз спасибо за просмотр!
C'est pas "byte" ton affaire ! lol !
what happened to your head?