How long does a sketch last?

Once I upload a sketch to the board, how long can I expect it to stay working? I would like to use my seeeduino mega to get inputs from my house and send some sort of message to my computer. So if I program it to do this, and unplug from the compiler, how long can I expect it to run that sketch? is it burned into the eeprom or do I need to do that to make it work like that forever. . . or will the sketch disappear if left unplugged for a few weeks?

Thanks. Didnt know how to search for this answer on Google.

well the arduino dosent loose the program if you power if off and the eeprom has nothing to do with storing the progam it is used to log data and it dosent loose data for a million times ( Is it ? ) well i dont remember exactly check it out :wink:

The flash memory where your sketch is saved on as a data retention time of around 10 years if unplugged/arduino off, forever if arduino on.

From memory (no pun intended) the data retention figures are one of the headline features of the AVR datasheet.

Edit: Yup, there it is: 20 years @ 85 celsius, 100 years @ 25 celsius.

Edit: Yup, there it is: 20 years @ 85 celsius, 100 years @ 25 celsius.

I guess that means that archaeologist in 10,000 years won’t have a clue what my Arduino projects actually do/did. Oh the loss to humanity. :wink: Maybe I should switch my hobby to pyramid building? Maybe pottery?

Thanks. I plan to program it and mount it on the home automation wall. Once there, I was hoping it would just run the sketch for a long time. I found something you guys might be interested in. To protect the inputs I was going to use optoisolators. I was pricing them and they were going to be pretty expensive, and then I found these:
8 channels for only $4.90. But you have to wait about 3 weeks to get them in. However, I have been using 3 boards for about a year and they work well. You might have to change the resistor values or remove them like I did and use external pullup resistors, but at this price, I could not even buy the parts much less have it all made for me. Hope someone else gets some use out of this.

Thanks again,

opto-isolators are nice and have there use. However keep in mind and perspective that the replacement cost for a AVR 328 chip with bootloader is only around $6.

archaeologist in 10,000 years won’t have a clue

There is some real concern in academic and philosophical circles about the fragility of our digital information, when it comes to “history.” Already, over small amounts of time, it requires “active maintenance” to keep your digital photos from decaying off of their media, and your heirs may be faced with an anonymous, encrypted, lump of technology that they don’t know what to do with, rather than a drawer full of memory-stirring faded photographs…

(And I have a bunch of software from highschool and college that is essentially unreadable just because the media it is on is now hard to find readers for, even if it hasn’t decayed. DECTape?)

8 channels for only $4.90. But you have to wait about 3 weeks to get them in.

You may want to check other sources, this company has a reputation of being extremely slow at shipping (3 weeks would be like winning the lottery and only accounts for time in transit).

It does however put your question in perspective (flash retention time) as it becomes relevant considering the time you have to wait for parts. :wink:

Well, my point in sharing the opto link was that I am using this to monitor gates outside the house and doors and motion sensors. so running the wire to the board would get me lots of noise and bad readings. So I needed a way to isolate the circuit so radio waves dont cause spurious inputs to the board. You guys might be just reading a switch on the circuit board near the chip, but I am running my wires 200 feet sometimes. So I thought I would share the great find. Use it if you find it useful. I have bought 4 of these boards and are using them now with another circuit and they do ship slow. I just ordered 8 more boards today so will probably get them after the first of the year.

Erm I’m not sure opto-isolators are what you need for your purposes…

Not to mention we’re changing media types every 5-6 years, our ancestors are going to need 50 different media players to figure our shit out

I have a quick question sorta related to the original.

I recently received my 1st Arduino Uno, smd edition.

When I upload a sketch like Blink, run it, unplug my Usb cord, and plug it back in, it doesn’t start the blink sketch over again.

At this point I need to reload the sketch over Usb.

Is this normal?

Is this normal?

No, that is not proper behaviour. Once the board is powered up by either usb power or external power it should start running once the bootloader times out and jumps to the preloaded sketch.

Not sure what would cause your symptom.


From what I read on the Sparkfun forum, other people are having the same problem with the SMD edition.