Sketch gets wiped out faster than specifications

Hi everyone,

So I have been using Arduino Nano for my automatic lighting system for a while now, starting from July-August 2017 or so and it has worked perfectly. However, as of last week (May 2018), the system began to malfunction and stopped working alltogether. I suspect this is because Arduino Nano uses flash drive to store the data and after some time, that data wears out. This wiki page is one source but you guys can check out other sources too. Let me list out some general environmental conditions:

  • The Arduino is new (bought around June 2017) and I have only write to it around 30 times max.
  • I live in South East Asia so humidity and temperature is pretty high. I would say average temperature is around 32 Celsius in the summers and 26 Celsius in the winters.
  • It is always turned on from August 2017 to May 2018, with only some (around 2 or 3) minor and quick repairs like changing the wire connections.
  • The power source is the typical phone chargers. From the usb port on the charger I plugged a standard phone wire in and the other end I plugged in the Vin and GND pins. So the voltage is actually just 5V. I know I'm supposed to plugged a 7-12V power source in but that would be clumsy and 5V works just fine.
  • It is plugged into a homemade pcb so that I can easily replace the Nano easier.
  • It always stay in the shades and never come into contact with direct sunlight.

What I did is to re-upload the sketch and it worked perfectly. But I want it to last really long and I don't want this situation to come up again. I do realized that people have asked about this before (this post for example) but I don't see anyone addressing this problem before.

So my question is: is there a way to auto-correct errors in the flash memory? Obviously I can't hook up a HDD in as it would be overkill but there has got to be a way to detect such errors and fix it automatically given that the system is plugged in all the time right? So does anyone know how to do it?

Thanks in advanced.

I suspect that you got some corrosion on contacts, which was fixed by the work you did to it.

157239n:
The power source is the typical phone chargers. From the usb port on the charger I plugged a standard phone wire in and the other end I plugged in the Vin and GND pins. So the voltage is actually just 5V. I know I'm supposed to plugged a 7-12V power source in but that would be clumsy and 5V works just fine.

It worked just fine? It didn't have a power sag at some later date and wipe out your program? You should maybe tell that to the guy who wrote the rest of your post.