Close this search box.


How To Clear Arduino Memory

There are three kinds of memory available in an Arduino – Flash, RAM and EEPROM.

The flash memory is used to store the program. It gets retained even when power to the Arduino is cut-off or there is a reboot.

All data and variables used during runtime is stored in RAM. However, RAM is a volatile memory and gets wiped clean with every reboot or power cut.

To store data that gets retained when there is a reset, Arduino provides an EEPROM.

What is EEPROM?

EEPROM stands for Electrically Erasable Programmable Read Only Memory. It can be thought of like the Hard Drive of a computer. However, the read/write times are much faster in case of an EEPROM.

Data in the EEPROM can be written, overwritten or erased. But this has to be done explicitly by the user. You can use Arduino’s EEPROM library to access APIs that do this job for you.

EEPROMs are usually used for storing settings that need to be recalled once the Arduino reboots or is turned on. Suppose, the Arduino needs to remember the last known state of a lamp, that it turns on and off, and restore this state when power returns. In such a case, the last known state can be written into an EEPROM which can be read back once the Arduino is rebooted.

How Many Bytes Can you Store?

Arduinos have an 8-bit addressable memory. You can only store 8-bit numbers in each memory block. This means that an individually addressable memory block can store any number from 0 to 255. Larger numbers have to be broken down into 8-bit units and will require multiple blocks to be stored.

The total size of the EEPROM depends on the model of the Arduino that you are using. The Arduino Mega has the largest memory of 4096bytes, followed by the Uno, Nano and Mini with 1024 bytes each. Some Arduinos, like certain versions of Nano and Mini, that have an Atmega168 controller on board, have an EEPROM of 512bytes only. Arduinos also allow you to interface external EEPROMs to increase storage capacity.

Of course, the lifespan of an EEPROM is limited. Therefore, there are only a certain number of times that you can erase and rewrite data onto it. Usually, EEPROMs in Arduino last around 100,000 write/erase cycles. Fortunately, reading operations on an EEPROM does not affect its longevity.

How To Clear Arduino Memory

Method 1

1. The USB cable must be unplugged

Before you start the process, the first step should be to disconnect the USB cable from the Arduino. This will remove the power and also free the RX and TX pins that is used for USB-Serial communication.

2. Connect the RX pin to the ground

The next step should be to connect the RX pin to Ground. While you can do this by connecting a jumper between the RX pin and GND pin, keeping a resistor of 10Kohm will be able to limit the current to safe value between the two pins.

3. The USB cable must be plugged

After you have pulled down the RX pin, turn on power to the Arduino by reconnecting the USB cable to it.

4. Upload a new program

Open the Arduino IDE and load any basic sketch to the Arduino. You can either upload the “Blink” sketch or the “Bare Minimum” sketch to keep things simple.

5. Remove the cable

Next, remove the power to the Arduino again by removing the USB cable. This is done to remove the RX pull-down safely without causing any accidental electrical shorts.

6. Remove the RX grounding

Once you have removed the USB cable, remove the resistor or wire that you have hooked up between the RX pin and Ground pin.

7. Make sure the Arduino is connected directly to the PC device rather than via a hub

If this method is not working for you, then you should check how the Arduino is connected to the USB port of your computer. If it is connected via a USB hub, then things may not work. Connecting it directly to the USB port of your PC is the best method.

Method 2

If you are not comfortable connecting the RX pin to the GND pin, then you can use the method given below.

1. Unplug the USB cable

This method also involves unplugging the USB cable first. This is because the subsequent steps will require you to change the port settings of the USB port to which your Arduino will be connected.

2. Select the Device Manager

Open Device Manager from the “Manage” window in the pull-down menu that appears when you right click on “This PC”.

3. Select Ports (COM & LPT)

The Arduino’s port is usually listed in the COM & LPT section in the list of devices. Select “COM & LPT” from the list.

4. Press the right click on your Arduino board (COMx)

Among all the COM ports connected, you should know which COM port number corresponds to the Arduino.

5. Then choose “Properties – Port Settings – Put flow control to Hardware”

Now, you need to modify the port settings of the COM port that corresponds to your Arduino. To do this, choose Properties from the drop down menu that appears. Click on Port Settings and then change Flow Control to Hardware.

6. Create an empty sketch (the example is below)

In this method, you can also use the “Bare Minimum” sketch to flash to the Arduino. Load the sketch in the Arduino IDE.

7. Again connect the USB cable

Reconnect the USB cable to the Arduino to power it up again.

8. Upload by pressing Ctrl + U

Upload the “Bare Minimum” sketch. You can also do this by pressing Ctrl+U on your keyboard without having to visit the toolbar menu.

Here is an Example of an Empty Sketch That You May Use

// Empty sketch

void setup()



// The loop routine goes over and over forever:

void loop()





If you keep an Arduino aside for a couple of weeks, then you may end up forgetting which sketch was uploaded to it last. In such a scenario, if you power it up which is plugged into a circuit, it may end up damaging your Arduino or associated circuitry.

Therefore, always erase and load a blank sketch onto it before you use it in a different circuit.

Leave a Reply

Your email address will not be published. Required fields are marked *