Using EEPROM with Arduino - Internal & External

Тәжірибелік нұсқаулар және стиль

Today we will learn how to use EEPROM with an Arduino to add nonvolatile memory to our projects.
Article with code: dronebotworkshop.com/eeprom-a...
More projects and tutorials: dronebotworkshop.com
Chat about this on the Forum: forum.dronebotworkshop.com
Join the Newsletter: dronebotworkshop.com/subscribe/
Nonvolatile memory refers to memory that retains its data even after being powered down. While there are many ways to accomplish this one of the simplest is by using EEPROM - Electrically Erasable Read-Only Memory.
The Arduino already has some EEPROM built-in, not too much, but for many applications it will be more than enough. You can use it to retain settings in your project. If you need more nonvolatile memory you can add an external EEPROM chip.
Today I will show you how to do both.
The Arduino's internal EEPROM is very easy to work with, thanks to the EEPROM library included within the Arduino IDE. The library comes with several small example sketches, and we’ll see how to use those sketches in our first demo.
We will also work with the AT24LC256, also called just the 24LC256 or 24C256. It’s an EEPROM chip that can store 256 Kilobits (or 32 KB) of data, and it uses the I2C bus for easy interfacing.
We will use the external EEPROM to record servo motor movements and then play them back. This would be perfect for an automated display. Of course, you can build upon the sample code to add EEPROM to almost any project.
Here is what we will cover today:
00:00 - Introduction
02:46 - Understanding EEPROMs
07:16 - Using Internal EEPROM
16:02 - Using External EEPROM
I’ll also cover some of the limitations of using EEPROMs, they are not entirely perfect. The biggest limitation is that they have a limited number of write operations, I’ll show you how you can reduce writes to the internal EEPROM by using the ”update” method.
I hope you enjoy the video!

Пікірлер: 217

  • @jacquesmertens3369
    @jacquesmertens33694 жыл бұрын

    Sir, I can't thank you enough for this fantastic channel. It's the only KZread channel where I never interrupt any advertisment so that you have a bit of extra income. Keep up the good work.

  • @waswestkan

    @waswestkan

    4 жыл бұрын

    Clearly not, the only KZread channel, that doesn't have *video* *interrupting* advertising. Then you and I probably never have seen every channel, however I have seen enough to of them to falsify your assertion.

  • @frankbose544

    @frankbose544

    3 жыл бұрын

    I don't think they actually get extra money if u watch the hole ad but idk

  • @shamrithponlingam1656

    @shamrithponlingam1656

    2 жыл бұрын

    @@frankbose544 for the video ads you have to watch them for at least two thirds and for the ads that is like in the lower half of the video, you have to go to the website.

  • @ezrabarrow2005
    @ezrabarrow20054 жыл бұрын

    your voice is so calming. you're like an electronics bob ross

  • @GhettoRanger01

    @GhettoRanger01

    4 жыл бұрын

    The lisp is kinda catchy, too.

  • @learningpower9437

    @learningpower9437

    4 жыл бұрын

    Fully....agree...He just needs start painting some arduino...few trees...here and there...

  • @ezrabarrow2005

    @ezrabarrow2005

    4 жыл бұрын

    @@learningpower9437 happy little microcontrollers

  • @dwalden74

    @dwalden74

    4 жыл бұрын

    Let’s give this arduino a little friend.

  • @somebody9033

    @somebody9033

    3 жыл бұрын

    @@dwalden74 I thought it was lip synced lol

  • @brigosx
    @brigosx4 жыл бұрын

    Welcome back Bill. It's nice to see you again in Workshop. You inspire us man. Thank you !!!

  • @EmirUysal
    @EmirUysal3 жыл бұрын

    It almost comes naturally, this impulse to shower you and your channel with compliments. I feel grateful for having this information for free. So structured, neat, easy to follow and quite thorough. And I see at the comments that I'm never alone. Your channel is my biggest ally as I started getting into electronics.

  • @danjason2167
    @danjason21674 жыл бұрын

    dude,loved the production value with the multiple-camera setup, didn't expect that from a tutorial video like this well done sir

  • @gweliver
    @gweliver4 жыл бұрын

    AWESOME!Just what I've been starting to research!!! Thanks for the AWESOME CHANNEL

  • @imadjawad4408
    @imadjawad44084 жыл бұрын

    Organized, detailed, informative and educational I love this channel

  • @Dalamain
    @Dalamain4 жыл бұрын

    fantastic video - you explain everything in full detail, thanks dronebot!

  • @musaadejoshuaibuopaluwa1712
    @musaadejoshuaibuopaluwa17124 жыл бұрын

    I missed your videos. Welcome back and I hope your videos will keep coming in. Thank you and welcome back

  • @mikepennington8088
    @mikepennington80884 жыл бұрын

    If you are using the Tiny RTC module, there is an eeprom module available there also. According to the source that I found when researching why the address scan showed two for the Tiny RTC: "The clock doesn't use the EEPROM at all, it's just there as a convenient place to log data if you so desire".

  • @stevetobias4890
    @stevetobias48904 жыл бұрын

    Great video, I am finding your videos very handy as someone who is just getting into Arduino to make learning basic electronics fun. My advanced starter kit and 45 sensor package should arrive in the next week or two. Have installed Arduino and playing with it to familiarise myself with the programming side. I would be lost already without your videos. So a huge thank you for putting in the time to create your content.

  • @robertwillemsen368
    @robertwillemsen3684 жыл бұрын

    Nice to see you back! Thank you. Nice video again

  • @ReneStover
    @ReneStover Жыл бұрын

    Thank you for the great instruction, I taught electronics for 13 years, worked in the field altogether for 49 years, never had the opportunity to work on my own projects, and never worked with memory, other than using it in computers. I purchased a couple of Arduino Unos and parts kits, and have been meaning to get into learning how to use them in some projects. You have given me the drive to go ahead with my dreams, thank you!

  • @gasko2762
    @gasko27624 жыл бұрын

    Thank you for the excellent work on the topic, I always like to come here when something new comes out.

  • @bluescream7463
    @bluescream74634 жыл бұрын

    So great to have you back and again a super kristal-clear video. It would be so nice if could give 2 thumbs up! Thanks for sharing your knowledge !

  • @luberies
    @luberies4 жыл бұрын

    Your videos are teaching works of art. Thank you very much!

  • @kellyklaask7su990
    @kellyklaask7su9904 жыл бұрын

    Great video! I'm just learning so all this stuff you show is new to me. Thanks for taking the time to do these videos!

  • @edsonkiyohara
    @edsonkiyohara4 жыл бұрын

    This is the best channel to learn about electronics stuff. I seldom subscribe in any channel, but this I do recommend for everyone. All subject are presented in a clear manner, in clean and neat and well organized workshop, and explained so well, paused and calm voice that everybody can understand even for who is not english native. Congratulation, I am your big fan!!!

  • 4 жыл бұрын

    In every single one of your videos the effort for building them as educational as possible just pours from my screen.. thank you very much for your effort.. regards from Paraguay! (psss.. in the middle of South America ;D )

  • @frankmayo1410
    @frankmayo14104 жыл бұрын

    Recently found your Your tube page, great stuff and you're a great instructor! I'll be watching many more! Thank you!!

  • @kevingrimshire7462
    @kevingrimshire74623 жыл бұрын

    Have tried several libraries but none work as well as your code. A fantastic video and your code is so reliable - using it for a data logger and has not missed a beat - well done!

  • @rongeernaert1208
    @rongeernaert12084 жыл бұрын

    Much learned from an EEPROM in this great video.

  • @dleland71
    @dleland713 жыл бұрын

    That experiment was so cool!

  • @janetmccusker9512
    @janetmccusker95124 жыл бұрын

    Welcome back Bill, was waiting for your new video. On one of your earlier vids you mentioned using multiple I2C Masters. That would be very useful and I hope you make the video soon.

  • @wardprocter2371
    @wardprocter23714 жыл бұрын

    Excellent, well explained tutorial! Thanks!

  • @paarthsstudio
    @paarthsstudio2 жыл бұрын

    Thanks a lot for explaining about EEPROM so well and in detail. You got a new subscriber!

  • @AlienWacker
    @AlienWacker4 жыл бұрын

    OMG this is the COOLEST VIDEOS I HAVE EVER SEEN YOU MAKE!

  • @raymondmichael4987
    @raymondmichael49874 жыл бұрын

    this is perfect but more importantly, it is you sir, the video description gives the big picture about the video not some "sit & dig in to find out" kind of videos, thanks; especially the last part of the description, thanks again. Greetings from Tanzania

  • @StrsAmbrg
    @StrsAmbrg2 жыл бұрын

    You are a very kind Gentleman.

  • @jnecece
    @jnecece4 жыл бұрын

    Your explanation is one of the best.

  • @maybornelectronics7944
    @maybornelectronics79444 жыл бұрын

    AS USUAL, FANTASTIC EXPLANATION.

  • @petercall4267
    @petercall42674 жыл бұрын

    Fantastic channel! Thanks so much for your inspirational teaching!

  • @gasko2762
    @gasko27624 жыл бұрын

    Simple and easy to understand video. I love your videos

  • @republicoftutorials6068
    @republicoftutorials60682 жыл бұрын

    Your channel is fantastic, one of the best electronic channel on entire youtube Thank you sir

  • @Lunolux
    @Lunolux4 жыл бұрын

    i spend many hour today watching your video, very good explanation and demo, great work, i bought an arduino 2 year ago but never try to build something more complexe than the basic turn ON/OFF LED xD, and always found video about "arduino" very hard to understand, but your are the first one that explaine it so well, great job (sorry for my bad english)

  • @jimkirk360
    @jimkirk3604 жыл бұрын

    Always enjoy your videos

  • @simonndungu1196
    @simonndungu11964 жыл бұрын

    New to the channel and I love your way of explaining stuff. Thanks and Cheers Man

  • @maybornelectronics7944
    @maybornelectronics794419 күн бұрын

    Simply superb explanation

  • @stephenbarlin2314
    @stephenbarlin2314 Жыл бұрын

    Indeed inspiring. Thankyou

  • @Good-Enuff-Garage
    @Good-Enuff-Garage10 ай бұрын

    brilliant presentation, thank you so much

  • @hadireg
    @hadireg4 жыл бұрын

    GREATLY EXPLAINED!! 👍👍👍👌 Thank you!

  • @lisandroiaffar4501
    @lisandroiaffar4501 Жыл бұрын

    Just impecable, thank you so much!!!

  • @gmonkman
    @gmonkman3 жыл бұрын

    Really clearly explained. TYVM

  • @jagannathkulkarni
    @jagannathkulkarni Жыл бұрын

    Thank you for the magnificent video. Learned a lot from you !

  • @josephbonello163
    @josephbonello1634 жыл бұрын

    Thank you Sir ..Love all your video's you are a great teacher

  • @thilinawijebandara3232
    @thilinawijebandara32322 жыл бұрын

    Thank you so much for making such a wonderful explanation with the experiments. You are the one of best youtuber I have seen in you tube. . Thank you again 🙂👍 Go ahead sir.

  • @samuelgeorge6756
    @samuelgeorge67563 жыл бұрын

    Thank you sir. Thats how you teach something well. Great !

  • @bik35
    @bik354 жыл бұрын

    Great video as usual. Best Regards.

  • @electronic7979
    @electronic79794 жыл бұрын

    Helpful information. I like it

  • @billglass5160
    @billglass51602 жыл бұрын

    Thanks for this information, well presented, precise, and thorough. Very Useful!!! I was able to add an external EEPROM AT24C256 (32768x8) module to my Sensor prototype. I was initally planning to use an SDCard but it requires a lot of Arduino Nano program(40%) and data(49%) memory. My sensor program and data memory requires 50%,72%. After installing the EEPROM module it uses only 53%,72%. I am able to log approx. 28000 characters (2000 14-character strings). This enables me to monitor more than a week of sensor activity (air & water temperature, humidity, pool water level, Internet information, etc.). In addition, if I neglect checking the EEPROM when it is full, I added a circular address mode for the EEPROM. When I DO check it, I always have the most recent week's activity. Another advantage of using the circular mode is its wear-leveling characteristic. One can only safely write 100000 times to a specific address before the EEPROM becomes unreliable. In my case, I am writing to any specific address only once per week, which gives me a guaranteed reliability for my EEPROM of 100000 weeks or 1923 years!!

  • @Robolearning
    @Robolearning Жыл бұрын

    Great Explainer !!!!!

  • @ronalddhs3726
    @ronalddhs37264 жыл бұрын

    Great tut! Thanks.

  • @jjjxxxaime
    @jjjxxxaime3 жыл бұрын

    Very interesting and nice video...thanks a lot

  • @cybaneticcybanetic441
    @cybaneticcybanetic4412 жыл бұрын

    Wow first time I've seen a comprehensive use of an eeprom, he he he my projects are about to be interesting even more

  • @ThePixel1983
    @ThePixel19834 жыл бұрын

    Thank you! I was planning to add an SD card to my led matrix display, but 1kb on the Nano should be enough! ❤️

  • @ALiALi-rm3pp
    @ALiALi-rm3pp4 жыл бұрын

    Thank you for your great work

  • @shivamdeshpande1959
    @shivamdeshpande19593 жыл бұрын

    Thanks a lot sir!! It was really helpful

  • @waswestkan
    @waswestkan4 жыл бұрын

    Back in the day I decided to purchase an Alinco DJ-160 VHF portable transceiver, because it used an EEPROM, thus no need for a backup battery. Being aware the memory had a limited number of writes to it, I was conscious about of not changing the contents of the memory channels, unless I absolutely had to, which wasn't often because of the number of channels available. Alas within 5 years the radio quite retaing the memory. Much of my days then where spent outdoors in cold winters, and hot summers, the temperatures where never to the extremes, to make that a fac.tor. Video given, thumbs up, Channell, subscribed to, and bookmarked

  • @melkiorwiseman5234

    @melkiorwiseman5234

    4 жыл бұрын

    If you still had it, it would probably be possible to replace the EEPROM with a new one. Maybe even one with a longer life.

  • @ayganotomasyon1109
    @ayganotomasyon1109 Жыл бұрын

    Very useful thank you.

  • @navodnandima4305
    @navodnandima43052 жыл бұрын

    well explained and can understand anyone

  • @inferno6012
    @inferno60124 жыл бұрын

    very informative new skills gained

  • @meekirimusic
    @meekirimusic2 жыл бұрын

    great video

  • @HamzaKhan-mf4ot
    @HamzaKhan-mf4ot4 жыл бұрын

    thank you for your great work sir.....

  • @VorpalForceField
    @VorpalForceField Жыл бұрын

    Excellent content .. Thank You for sharing .. Cheers :)

  • @levelmastersystems117
    @levelmastersystems1174 жыл бұрын

    You are great man , Thanks

  • @hosseinbehdarvandi1504
    @hosseinbehdarvandi15044 жыл бұрын

    very useful

  • @OsoPolarClone
    @OsoPolarClone4 жыл бұрын

    Great video

  • @rgdphome8974
    @rgdphome89744 жыл бұрын

    Lovely, Sir.

  • @tomneto8791
    @tomneto87913 жыл бұрын

    Very good

  • @GerardWassink
    @GerardWassink4 жыл бұрын

    Hi Bill, a tip: instead of using the number 13 for the internal LED it would be better to use the predefined LED_BUILTIN constant. This will hold the number of the internal LED dependent on the Arduino model you are working on...

  • @basmangeorge
    @basmangeorge4 жыл бұрын

    Just want to say thank you.

  • @jeremyvi
    @jeremyvi4 жыл бұрын

    Quality content 👍

  • @amnesie6615
    @amnesie66154 жыл бұрын

    Thank you!

  • @cokecamilo
    @cokecamilo10 ай бұрын

    THANK YOU!!!!!

  • @mysterythecat971
    @mysterythecat9714 жыл бұрын

    Wonderful!

  • @patrickmattele2013
    @patrickmattele20132 ай бұрын

    great channel thkx

  • @Arnodi_Project
    @Arnodi_Project4 жыл бұрын

    Good job.

  • @foxanderson967
    @foxanderson9674 жыл бұрын

    that was amazing

  • @abreytie
    @abreytie4 жыл бұрын

    Just a small add-in. ROM is normally programmed at silicon level during manufacture. PROM is Programmable Read Only Memory A windowless EPROM was available to be a pseudo-PROM EEPROM = Electrically Erasable Programmable Read Only Memory.

  • @siddharthmali5841
    @siddharthmali58414 жыл бұрын

    Great thank you sir 😊

  • @ahphorsheang4587
    @ahphorsheang45874 жыл бұрын

    Thank you so much

  • @ser7ser7i
    @ser7ser7i4 жыл бұрын

    Thank you.

  • @garybonard9591
    @garybonard95912 жыл бұрын

    Thanks!

  • @Dronebotworkshop

    @Dronebotworkshop

    2 жыл бұрын

    And thank you as well!

  • @ElieWar
    @ElieWar4 жыл бұрын

    thank you

  • @avejst
    @avejst4 жыл бұрын

    Greagt vidio Thanks for sharing👍😀

  • @caffeinatedinsanity2324
    @caffeinatedinsanity23243 жыл бұрын

    I bought EEPROMs on digikey that were capable of holding decent amounts of memory and could go as low as not even 1$ CAD so yes they are very inexpensve. However be ready to read datasheets since you are a huge variety of models made by a massive number of manufacturers. Like I bought some from Microchip. I better be ready to use the basic Wire.h commands haha. Speaking of, using sensors like AM2320 or the i2c eeprom I talked about, but only using basic I2C commands can be a great exercise to learn how to use the peripheral itself. Useful especially since not everything has an arduino library AND if you move to other platforms like STM32CubeIDE, you just learned something valuable Same for SPI, UART, etc...

  • @aeb5307
    @aeb53073 жыл бұрын

    Gracias.

  • @user-ne7rc5hy2r
    @user-ne7rc5hy2r3 жыл бұрын

    This is a very nice introduction/DEMO of the EEPROM for very beginners. Although :: CAUTION :: the introducer is not mentioning something very fundamental. EEPROM 's blocks (namely addresses) CAN NOT store a number greater than 255 - unsigned integer - or a byte number. Thus in case you need to use it for a real/practic purpose you will need to develop a special Driver-software. In addition to the previous fact you will need to include to the software a piece of code that will prevent loss of data. As a general fact if you try to write a number to your memory and before finished the MCU come with power loss you will lose your data for sure. You want to store the data in order not to lose them but if your Driver is not a proper one there will be always a chance to lose them. Good luck !

  • @sammyk7024
    @sammyk70244 жыл бұрын

    A little heads up for my fellow enthusiasts: When the IDE says something like "low memory, things may get unstable" when compiling, well, it appears to be true. At least when dealing with the internal EEPROM. While playing around with it, I wrote a particularly long sketch, with several debug utilities. When running the sketch on a nano, after complaining of such low memory, EEPROM.length() would report extremely low values, eventually reaching ZERO! I thought I have ruined the internal EEPROM, after a couple dozens of write operations. Turns out it was just an "instability" issue. Reducing the sketch size (removing several debug utilities) solved the issue.

  • @muhammadmcintee-masud5956
    @muhammadmcintee-masud59564 жыл бұрын

    If anyone is getting a return value of 255, make sure you are using the correct pins on your arduino board for the SDA and SCL of the EEPROM chip. According to the Wire.h library you should use the following: Board I2C / TWI pins Uno, Ethernet A4 (SDA), A5 (SCL) Mega2560 20 (SDA), 21 (SCL) Leonardo 2 (SDA), 3 (SCL) Due 20 (SDA), 21 (SCL), SDA1, SCL1

  • @watchvideo7225
    @watchvideo72256 ай бұрын

    Great Vidoe as allways! I was originally planning to use the EEPROM to save a sensor calibration, but knowing that it can only store 8 Bits, the accuracy is probably not enough for that. Still useful information though, might come in handy at some point.

  • @soumitradey8208
    @soumitradey82084 жыл бұрын

    Great!!

  • @placetoentertain6564
    @placetoentertain65644 жыл бұрын

    Sir your explanation is excellent.sir upload video about wifi module esp8266

  • @melkiorwiseman5234
    @melkiorwiseman52344 жыл бұрын

    It's an Electrically Erasable *Programmable* Read Only Memory. First, there were ROMs. These were generally referred to as "mask programmed ROMs" and they were manufactured with the contents of their memory already defined. The memory contents could never be changed and if the program changed, it was necessary to remove the ROM and throw it away while installing a new ROM with the updated program. Then came PROMs, also known as fusible-link ROMs. These came with every bit pre-programmed as a 1, but by using a special programmer and a high voltage, it was possible to make some bits read a 0 instead of a 1. Again, these memories could not be reprogrammed and would generally have to be thrown away and a new ROM or PROM installed if the program ever changed. Next came EPROMs. These used a similar programming method as fusible-link ROMs, but they could be erased by several minutes of exposure to ultra-violet light, then reprogrammed. Finally came EEPROMs. With this technology, almost instant reprogramming could be performed with the memory chip still in the circuit, and high voltages were no longer required. Best of all, it was possible to make EEPROMs read-compatible with the earlier EPROMs. Here endeth the lesson. :)

  • @TuanTran-xi4vs
    @TuanTran-xi4vs4 жыл бұрын

    Thanks for your this video clip, it's very easy to understand. Now I know how to use external EEPROM. if you can make a clip about arlarm clock which use the external EEPROM of I2C RST1307, that's a wonderful thing.

  • @catalinalb1722
    @catalinalb17224 жыл бұрын

    Hello Sir. Thank you for your great work by sharing your experience. What software are you using for the beautiful wiring diagrams?

  • @somebody9033
    @somebody90333 жыл бұрын

    Thank you very much for this tutorial! One thing though, according to all resources I have found on the internet other than this one, EEPROM is measured in *kilobytes* not *kilobits*

  • @jimwhitehead1650

    @jimwhitehead1650

    3 жыл бұрын

    Well, not exactly... He's got it right. See ATmel AT24C32 (or 64) Datasheet. They are specified in Kilo bits (Kb). Divide by 8 and you'll get number of Kilo Bytes (KB). Hope this helps. Cheers!

  • @somebody9033

    @somebody9033

    3 жыл бұрын

    @@jimwhitehead1650 I am sorry but I have to disagree with you here. I have just checked the Arduino Uno's EEPROM size and it is 1024 bytes, however the tutorial erroneously says that the Arduino Uno has 1 *kilobit* of EEPROM.

  • @jimwhitehead1650

    @jimwhitehead1650

    3 жыл бұрын

    @@somebody9033 Sorry, you're absolutely correct that he misspoke about the ATmega328 uC EEPROM size: it's 1 kilobyte (KB). Perhaps I misunderstood the intention of your original comment "EEPROM is measured in kilobytes not kilobits". I am merely pointing out that external EEPROM (like what he accessed in his video), as a separate product, is marketed in kilobits (Kb). It can be confusing for someone new to the game. Nice catch on his ATmega328 EEPROM size comment, BTW 👍

  • @somebody9033

    @somebody9033

    3 жыл бұрын

    @@jimwhitehead1650 Thanks! Yes, I am not disputing what you said about external EEPROM but the internal one is definitely 1kB not 1kb. What makes it even more annoying is that the official arduino EEPROM tutorial on their website states that the size of the EEPROM is 1kB but then refers to kilobytes as kb, which is actually the symbol for kilobits...

  • @pauldecastro1523
    @pauldecastro15234 жыл бұрын

    thank you sensei! your so great! can i ask you questions?

  • @monimoybanerjee380
    @monimoybanerjee3804 жыл бұрын

    Sir please make a video on IR sensors.

  • @atomize
    @atomize4 жыл бұрын

    The way "A-T-2-4-L-C-2-5-6" rolls right off of your tongue confirms that you're a pro :-P

Келесі