Arduino Projects

Arduino EEPROM Write & Read, Arduino EEPROM Examples

Description:

Arduino EEPROM Write & Read Operations– In this tutorial you will learn how to use the Arduino EEPROM at the basic and advanced level. We will cover the extreme basics including storing a string message in the Arduino EEPROM and then reading and erasing the stored message. I will explain in detail the Arduino EEPROM Read and Arduino EEPROM Write operations.

I will also explain how to make an advanced level project based on the Arduino and Bluetooth Module for storing

  • Multiple cell phone numbers in the Arduino EEPROM.
  • How to update any cell phone number in the EEPROM?
  • How to erase a particular cell phone number?
  • How to erase all the cell phone numbers and string messages stored in the Arduino EEPROM?
  • How to display all the stored cell phone numbers?

These EEPROM Reading and Writing processes will be wirelessly controlled using the android cell phone. Once a program is uploaded into the Arduino Uno, then there is no need to manually connect the Arduino with the computer to update any cell phone number or any other data. The user can store, update, read, erase, and display any information using the android cell phone. The commands are sent wirelessly from the Android cell phone application to the Arduino using the HC-05 Bluetooth Module.

This tutorial will really help you in making advanced level projects where you need to store the information permanently. You can use the Arduino EEPROM in different projects e.g.

  • Arduino and GSM based security system.
  • Car accident location tracking system.
  • Home automation systems
  • Data logging projects, and so on.

This tutorial can be a bit longer as I will be explaining the basic and advanced things about the Arduino EEPROM. I will also share with you the simulation screenshot.

Without any further delay let’s get started!!!


What is EEPROM?

The term EEPROM stands for electrically erasable programmable read-only memory. This is the Non-volatile memory and is used in Computer systems, microcontrollers, smart cards, remote keyless systems, and other electronic devices for storing small amounts of data that can be erased/deleted and reprogrammed. We have other types of the Non-volatile memory including

  • Mask Rom
  • PROM
  • EPROM
  • EEPROM
  • Flash Memory etc

Unlike the computer systems, Arduino also comes with the Internal and External type of EEPROMs

Arduino Internal EEPROM

The Arduino’s internal EEPROM is quite fast as compared to the external EEPROM. We can use the Arduino’s internal EEPROM in different types of projects quite easily. The amount of the EEPROM memory depends upon which Arduino Model we are using.

Arduino Model                                              Capacity

Arduino Mega 2560 “Atmega2560”              4096 Bytes

Arduino Uno, Mini, and some Nanos             1024 Bytes

Atmega168 “Nanos”                                       512 Bytes

Arduino Internal EEPROM limitations:

The Arduino internal EEPROM has some limitations that you need to consider before you are going to use this in your project. Although it is easy to use EEPROM in the Arduino, it does have a limited life. The Arduino’s internal EEPROM is specified to handle 100,000 read/erase cycles. This means you can write, erase the data/re-write the data 100,000 times before the EEPROM will become unstable. So this is the major limitation that you definitely take into consideration. So, if you are working on a project and you are constantly storing and erasing the data then you are not supposed to use the Arduino’s internal EEPROM. In a situation like this you can use an SD card, because the external EEPROM won’t work as well.



Arduino External EEPROM

The Arduino compatible External EEPROM chips are not that fast as the Arduino’s internal EEPROM, but if you need more capacity and larger write-cycle tolerance than the 100,000 writes then the Arduino External EEPROM is the only choice you are left with. You can easily interface the external EEPROMs with the Arduino Boards using the I2C bus. I will talk about the Arduino’s external EEPROM in a separate tutorial, for now let’s stick with the Arduino’s internal EEPROM.

When not to use the EEPROM?

It really doesn’t matter if you are using the Arduino internal EEPROM or External EEPROM, each one has a limited number of write cycles. If you are performing thousands of writing and erasing cycles, like storing the sensors data and then erasing them, soon the EEPROM writes cycles will be completed and the EEPROM will become unstable. In data logging projects you can use large size SD.

How to perfectly use the Arduino’s internal EEPROM?

The Arduino Uno, Mini, and some Nanos can store 1024 Bytes of data which is more than enough for thousands of projects. And as I already explained Arduino can handle 100,000 read/erase cycles. You can use the Arduino’s internal EEPROM in all those projects where you perform the writing and erasing tasks on random basis, like for example, updating a cell phone number used in a security based project. this number is not updated on daily basis, may be after one month or 1 year, or may be 2 years in a situation like this it works perfectly. 100,000 write cycles are more than enough.

You can use this for storing the RFID cards identity numbers. Let’s say you have a door security system and you have given access to 5 persons. You can erase/rewrite any number. This erase/rewrite thing is not performed on daily basis.

Enough with the theory.


Arduino EEPROM Example Number1:

In example 1 we will write a simple program which displays the data stored in the EEPROM, delete/erase the stored string message, and asks again for the new message to enter. You can enter the text using the Arduino’s serial monitor. For the best understanding I designed a simulation in Proteus, which is available for the download, the link is given below.

Arduino EEPROM

Download Arduino EEPROM Example 1 Simulation: Proteus simulation

Arduino EEPROM Example 1 programming:

#include<EEPROM.h>
int eeprom_Memory_address = 0; 
int read_eepromDATA = 0; 
char serialDATA_to_write;
int write_memoryLED = 13; 
int end_memoryLED = 12; 
int eeprom_size = 1024; 

void setup() {
pinMode(write_memoryLED,OUTPUT); 
pinMode(end_memoryLED, OUTPUT); 
Serial.begin(9600); 
Serial.println(); 
Serial.println("The previous text saved in the EEPROM was: "); 
for(eeprom_Memory_address = 0; eeprom_Memory_address < eeprom_size; eeprom_Memory_address ++)
{
  read_eepromDATA = EEPROM.read(eeprom_Memory_address); 
  Serial.write(read_eepromDATA); 
}

Serial.println(); 
Serial.println(); 

for(eeprom_Memory_address = 0; eeprom_Memory_address < eeprom_size; eeprom_Memory_address ++)
{
 EEPROM.write(eeprom_Memory_address, " ");  
}
Serial.println("EEPROM memory is Erased."); 
Serial.println(); 
Serial.println("Write you new text :"); 
Serial.println(); 

for ( eeprom_Memory_address = 0; eeprom_Memory_address < eeprom_size;)
{
  if ( Serial.available())
  {
    serialDATA_to_write = Serial.read();
    Serial.write(serialDATA_to_write); 
    EEPROM.write(eeprom_Memory_address, serialDATA_to_write);
    eeprom_Memory_address++; 
    digitalWrite(write_memoryLED, HIGH); 
    delay(50); 
    digitalWrite(write_memoryLED, LOW); 
  }
}


}

void loop() {


}


Testing:

Simply copy the above code and open the Arduino IDE and paste it. Before you click on the compile button.

Click on the Arduino IDE file menu and then click on the preferences.

Arduino EEPROM

Make sure the compilation and upload boxes are checked and then click on the OK button. Now, click on the compile/verify button. This will check for the errors and will also generate the Hex file link.

Arduino EEPROM

Copy this link. Now open the Proteus simulation. Double click on the Arduino and paste this link.

Arduino EEPROM

Now click on the ok button. You are all set. Now you can click on the play button to start the simulation.

Arduino EEPROM

When you run the simulation, it will display the previous text saved in the EEPROM, then it Erase the EEPROM. Then it will ask you to enter new text. I simply entered Electronic Clinic. Now if you stop the simulation and run this simulation again.

Arduino EEPROM

As you can see this time it displayed the previous text which was electronic Clinic, erased this text and now asking for new text, now this is repeated again and again.


Arduino EEPROM Example 2:

This example itself is an advanced level project, which I designed for a client long time again. In this project a user can enter 10 cell phone numbers wirelessly using the Android cell phone application. Any number can be erased or updated. The user can display all the stored numbers and can also delete all the stored numbers. Different commands are used.

So there is no need to connect the Arduino board with the laptop to update any number. The same project can be used for storing the identity numbers of the RFID tags in the Arduino EEPROM.

 

Arduino Bluetooth Circuit Diagram:

Arduino EEPROM

The Tx and Rx pins of the HC-05 or HC-06 are connected with the Arduino’s Rx and Tx pins, while the ground and VCC pins are connected with the Arduino’s gnd and 5 volts pins.

If you don’t have the Bluetooth module then you can simply use the Arduino’s serial monitor for the testing purposes. Or you can use the Proteus simulation given above.



Arduino EEPROM program for storing and Erasing cell phone numbers:

#include<EEPROM.h>

// cell number1 
int cn1_starting_address = 10; // cell1 number starting address
int cn1_ending_address = 23; // ending address

// cell number2 
int cn2_starting_address = 30; // cell2 number starting address
int cn2_ending_address = 43;  // ending address

// cell number3 
int cn3_starting_address = 50; // cell2 number starting address
int cn3_ending_address = 63;  // ending address

// cell number4 
int cn4_starting_address = 70; // cell2 number starting address
int cn4_ending_address = 83;  // ending address


// cell number5
int cn5_starting_address = 110; // cell1 number starting address
int cn5_ending_address = 123; // ending address

// cell number6
int cn6_starting_address = 130; // cell2 number starting address
int cn6_ending_address = 143;  // ending address

// cell number7
int cn7_starting_address = 150; // cell2 number starting address
int cn7_ending_address = 163;  // ending address

// cell number8
int cn8_starting_address = 170; // cell2 number starting address
int cn8_ending_address = 183;  // ending address

// cell number9
int cn9_starting_address = 210; // cell1 number starting address
int cn9_ending_address = 223; // ending address

// cell number9
int cn10_starting_address = 230; // cell2 number starting address
int cn10_ending_address = 243;  // ending address

int eeprom_Memory_address = 0; 
int read_eepromDATA = 0; 
char serialDATA_to_write;
int write_memoryLED = 13; 
int end_memoryLED = 12; 
int eeprom_size = 1024; 

String number1 = ""; 
String number2 = "";
String number3 = "";
String number4 = "";
String number5 = "";
String number6 = "";
String number7 = "";
String number8 = "";
String number9 = "";
String number10 = "";

char data; 

void setup() {
pinMode(write_memoryLED,OUTPUT); 
pinMode(end_memoryLED, OUTPUT); 
Serial.begin(9600); 
Serial.println(); 


// access the previous stored numbers and save them in variables.
previous_numbers_saved(); 

     

}

void loop() {

if ( Serial.available() > 0 )
{

data = Serial.read(); 

  if( data == 'a' ) // command to save cell number 1
  {
    save_number1();
  }

    if( data == 'b' ) // command to save cell number 2
  {
    save_number2();
  }

      if( data == 'c' ) // command to save cell number 3
  {
    save_number3();
  }
      if( data == 'd' ) // command to save cell number 4
  {
    save_number4();
  }
      if( data == 'e' ) // command to save cell number 5
  {
    save_number5();
  }
      if( data == 'f' ) // command to save cell number 6
  {
    save_number6();
  }
      if( data == 'g' ) // command to save cell number 7
  {
    save_number7();
  }
      if( data == 'h' ) // command to save cell number 8
  {
    save_number8();
  }
      if( data == 'i' ) // command to save cell number 9
  {
    save_number9();
  }
      if( data == 'j' ) // command to save cell number 10
  {
    save_number10();
  }



  // commands for numbers erasing 

        if( data == 'l' ) // erase number 1
  {
 erase_number1();
 number1 = "";  
  }

  
        if( data == 'm' ) // erase number 2
  {
 erase_number2();
 number2 = "";  
  }

  
        if( data == 'n' ) // erase number 3
  {
 erase_number3();
 number3 = "";  
  }

        if( data == 'o' ) // erase number 4
  {
 erase_number4();
 number4 = "";  
  }

          if( data == 'p' ) // erase number 5
  {
 erase_number5();
 number5 = "";  
  }

          if( data == 'q' ) // erase number 6
  {
 erase_number6();
 number6 = "";  
  }

            if( data == 'r' ) // erase number 7
  {
 erase_number7();
 number7 = "";  
  }

            if( data == 's' ) // erase number 8
  {
 erase_number8();
 number8 = "";  
  }

              if( data == 't' ) // erase number 9
  {
 erase_number9();
 number9 = "";  
  }

                if( data == 'u' ) // erase number 10
  {
 erase_number10();
 number10 = "";  
  }


      if( data == 'y' ) // command to erase all the numbers
  {
    erase_memory(); 
String number1 = ""; 
String number2 = "";
String number3 = "";
String number4 = "";
String number5 = "";
String number6 = "";
String number7 = "";
String number8 = "";
String number9 = "";
String number10 = "";
delay(1000);
  }

      if( data == 'z' ) // command to display all the saved numbers. 
  {
Serial.println("numbers saved are");
Serial.println("Number1: ");  
Serial.println(number1); 
Serial.println("Number2: ");
Serial.println(number2);
Serial.println("Number3: "); 
Serial.println(number3);
Serial.println("Number4: ");
Serial.println(number4);
Serial.println("Number5: ");
Serial.println(number5);
Serial.println("Number6: ");
Serial.println(number6);
Serial.println("Number7: ");
Serial.println(number7);
Serial.println("Number8: ");
Serial.println(number8);
Serial.println("Number9: ");
Serial.println(number9);
Serial.println("Number10: ");
Serial.println(number10);
  }
}

}




// ************************** Erase Memory Function *************************
void erase_memory()
{

  for(eeprom_Memory_address = 0; eeprom_Memory_address < eeprom_size; eeprom_Memory_address ++)
{
 EEPROM.write(eeprom_Memory_address, " ");  
}
Serial.println("Memory Erased!!!"); 

}


//********************************** Previously Stored Numbers**********************************

void previous_numbers_saved()
{

Serial.println(" All the previously saved numbers"); 
      for(eeprom_Memory_address = cn1_starting_address; eeprom_Memory_address < cn1_ending_address; eeprom_Memory_address ++)
    {
      read_eepromDATA = EEPROM.read(eeprom_Memory_address); 
      number1 = number1 + char(read_eepromDATA);
    }

          for(eeprom_Memory_address = cn2_starting_address; eeprom_Memory_address < cn2_ending_address; eeprom_Memory_address ++)
    {
      read_eepromDATA = EEPROM.read(eeprom_Memory_address); 
      number2 = number2 + char(read_eepromDATA);
    }

              for(eeprom_Memory_address = cn3_starting_address; eeprom_Memory_address < cn3_ending_address; eeprom_Memory_address ++)
    {
      read_eepromDATA = EEPROM.read(eeprom_Memory_address); 
      number3 = number3 + char(read_eepromDATA);
    }

                  for(eeprom_Memory_address = cn4_starting_address; eeprom_Memory_address < cn4_ending_address; eeprom_Memory_address ++)
    {
      read_eepromDATA = EEPROM.read(eeprom_Memory_address); 
      number4 = number4 + char(read_eepromDATA);
    }

                  for(eeprom_Memory_address = cn5_starting_address; eeprom_Memory_address < cn5_ending_address; eeprom_Memory_address ++)
    {
      read_eepromDATA = EEPROM.read(eeprom_Memory_address); 
      number5 = number5 + char(read_eepromDATA);
    }

                      for(eeprom_Memory_address = cn6_starting_address; eeprom_Memory_address < cn6_ending_address; eeprom_Memory_address ++)
    {
      read_eepromDATA = EEPROM.read(eeprom_Memory_address); 
      number6 = number6 + char(read_eepromDATA);
    }

                      for(eeprom_Memory_address = cn7_starting_address; eeprom_Memory_address < cn7_ending_address; eeprom_Memory_address ++)
    {
      read_eepromDATA = EEPROM.read(eeprom_Memory_address); 
      number7 = number7 + char(read_eepromDATA);
    }

                          for(eeprom_Memory_address = cn8_starting_address; eeprom_Memory_address < cn8_ending_address; eeprom_Memory_address ++)
    {
      read_eepromDATA = EEPROM.read(eeprom_Memory_address); 
      number8 = number8 + char(read_eepromDATA);
    }

    
                          for(eeprom_Memory_address = cn9_starting_address; eeprom_Memory_address < cn9_ending_address; eeprom_Memory_address ++)
    {
      read_eepromDATA = EEPROM.read(eeprom_Memory_address); 
      number9 = number9 + char(read_eepromDATA);
    }

        
                          for(eeprom_Memory_address = cn10_starting_address; eeprom_Memory_address < cn10_ending_address; eeprom_Memory_address ++)
    {
      read_eepromDATA = EEPROM.read(eeprom_Memory_address); 
      number10 = number10 + char(read_eepromDATA);
    }

     // Display all the numbers
    Serial.println("number1:"); 
    Serial.println(number1); 

        Serial.println("number2:"); 
    Serial.println(number2); 

        Serial.println("number3:"); 
    Serial.println(number3); 

        Serial.println("number4:"); 
    Serial.println(number4); 

        Serial.println("number5:"); 
    Serial.println(number5); 

        Serial.println("number6:"); 
    Serial.println(number6); 

        Serial.println("number7:"); 
    Serial.println(number7); 

        Serial.println("number8:"); 
    Serial.println(number8); 

        Serial.println("number9:"); 
    Serial.println(number9); 

        Serial.println("number10:"); 
    Serial.println(number10); 
}

void save_number1()
{
  number1 = ""; 
   Serial.println("enter number 1: ");
  for ( eeprom_Memory_address = cn1_starting_address; eeprom_Memory_address < cn1_ending_address;)
{
  if ( Serial.available())
  {
    serialDATA_to_write = Serial.read();
    Serial.write(serialDATA_to_write); 
    EEPROM.write(eeprom_Memory_address, serialDATA_to_write);
    eeprom_Memory_address++; 
    number1 = number1 + serialDATA_to_write; 
    digitalWrite(write_memoryLED, HIGH); 
    delay(50); 
    digitalWrite(write_memoryLED, LOW); 
  }
}
  Serial.println("number saved"); 
}

void save_number2()
{
  Serial.println("enter number 2: "); 
  number2 = ""; 
  for ( eeprom_Memory_address = cn2_starting_address; eeprom_Memory_address < cn2_ending_address;)
{
  if ( Serial.available())
  {
    serialDATA_to_write = Serial.read();
    Serial.write(serialDATA_to_write); 
    EEPROM.write(eeprom_Memory_address, serialDATA_to_write);
    eeprom_Memory_address++; 
    number2 = number2 + serialDATA_to_write; 
    digitalWrite(write_memoryLED, HIGH); 
    delay(50); 
    digitalWrite(write_memoryLED, LOW); 
  }
}
  Serial.println("number saved");
}

void save_number3()
{
  Serial.println("enter number 3: "); 
    number3 = "";
  for ( eeprom_Memory_address = cn3_starting_address; eeprom_Memory_address < cn3_ending_address;)
{
  if ( Serial.available())
  {
    serialDATA_to_write = Serial.read();
    Serial.write(serialDATA_to_write); 
    EEPROM.write(eeprom_Memory_address, serialDATA_to_write);
    eeprom_Memory_address++; 
    number3 = number3 + serialDATA_to_write; 
    digitalWrite(write_memoryLED, HIGH); 
    delay(50); 
    digitalWrite(write_memoryLED, LOW); 
  }
}
  Serial.println("number saved");
}

void save_number4()
{
  Serial.println("enter number 4: "); 
    number4 = "";
  for ( eeprom_Memory_address = cn4_starting_address; eeprom_Memory_address < cn4_ending_address;)
{
  if ( Serial.available())
  {
    serialDATA_to_write = Serial.read();
    Serial.write(serialDATA_to_write); 
    EEPROM.write(eeprom_Memory_address, serialDATA_to_write);
    eeprom_Memory_address++; 
    number4 = number4 + serialDATA_to_write; 
    digitalWrite(write_memoryLED, HIGH); 
    delay(50); 
    digitalWrite(write_memoryLED, LOW); 
  }
}
  Serial.println("number saved");
}

void save_number5()
{
  Serial.println("enter number 5: "); 
    number5 = "";
  for ( eeprom_Memory_address = cn5_starting_address; eeprom_Memory_address < cn5_ending_address;)
{
  if ( Serial.available())
  {
    serialDATA_to_write = Serial.read();
    Serial.write(serialDATA_to_write); 
    EEPROM.write(eeprom_Memory_address, serialDATA_to_write);
    eeprom_Memory_address++; 
    number5 = number5 + serialDATA_to_write; 
    digitalWrite(write_memoryLED, HIGH); 
    delay(50); 
    digitalWrite(write_memoryLED, LOW); 
  }
}
  Serial.println("number saved");
}

void save_number6()
{
  Serial.println("enter number 6: "); 
    number6 = "";
  for ( eeprom_Memory_address = cn6_starting_address; eeprom_Memory_address < cn6_ending_address;)
{
  if ( Serial.available())
  {
    serialDATA_to_write = Serial.read();
    Serial.write(serialDATA_to_write); 
    EEPROM.write(eeprom_Memory_address, serialDATA_to_write);
    eeprom_Memory_address++; 
    number6 = number6 + serialDATA_to_write; 
    digitalWrite(write_memoryLED, HIGH); 
    delay(50); 
    digitalWrite(write_memoryLED, LOW); 
  }
}
  Serial.println("number saved");
}

void save_number7()
{
  Serial.println("enter number 7: "); 
    number7 = "";
  for ( eeprom_Memory_address = cn7_starting_address; eeprom_Memory_address < cn7_ending_address;)
{
  if ( Serial.available())
  {
    serialDATA_to_write = Serial.read();
    Serial.write(serialDATA_to_write); 
    EEPROM.write(eeprom_Memory_address, serialDATA_to_write);
    eeprom_Memory_address++; 
    number7 = number7 + serialDATA_to_write; 
    digitalWrite(write_memoryLED, HIGH); 
    delay(50); 
    digitalWrite(write_memoryLED, LOW); 
  }
}
  Serial.println("number saved");
}

void save_number8()
{
  Serial.println("enter number 8: "); 
    number8 = "";
  for ( eeprom_Memory_address = cn8_starting_address; eeprom_Memory_address < cn8_ending_address;)
{
  if ( Serial.available())
  {
    serialDATA_to_write = Serial.read();
    Serial.write(serialDATA_to_write); 
    EEPROM.write(eeprom_Memory_address, serialDATA_to_write);
    eeprom_Memory_address++; 
    number8 = number8 + serialDATA_to_write; 
    digitalWrite(write_memoryLED, HIGH); 
    delay(50); 
    digitalWrite(write_memoryLED, LOW); 
  }
}
  Serial.println("number saved");
}

void save_number9()
{
  Serial.println("enter number 9: "); 
    number9 = "";
  for ( eeprom_Memory_address = cn9_starting_address; eeprom_Memory_address < cn9_ending_address;)
{
  if ( Serial.available())
  {
    serialDATA_to_write = Serial.read();
    Serial.write(serialDATA_to_write); 
    EEPROM.write(eeprom_Memory_address, serialDATA_to_write);
    eeprom_Memory_address++; 
    number9 = number9 + serialDATA_to_write; 
    digitalWrite(write_memoryLED, HIGH); 
    delay(50); 
    digitalWrite(write_memoryLED, LOW); 
  }
}
  Serial.println("number saved");
}

void save_number10()
{
  Serial.println("enter number 10: "); 
    number10 = "";
  for ( eeprom_Memory_address = cn10_starting_address; eeprom_Memory_address < cn10_ending_address;)
{
  if ( Serial.available())
  {
    serialDATA_to_write = Serial.read();
    Serial.write(serialDATA_to_write); 
    EEPROM.write(eeprom_Memory_address, serialDATA_to_write);
    eeprom_Memory_address++; 
    number10 = number10 + serialDATA_to_write; 
    digitalWrite(write_memoryLED, HIGH); 
    delay(50); 
    digitalWrite(write_memoryLED, LOW); 
  }
}
  Serial.println("number saved");
}


// erase individual numbers

// ************************** Erase Memory Function *************************
void erase_number1()
{

  for(eeprom_Memory_address = cn1_starting_address; eeprom_Memory_address <= cn1_ending_address; eeprom_Memory_address ++)
{
 EEPROM.write(eeprom_Memory_address, " ");  
}
Serial.println("Cell number1 Erased"); 

}

void erase_number2()
{

  for(eeprom_Memory_address = cn2_starting_address; eeprom_Memory_address <= cn2_ending_address; eeprom_Memory_address ++)
{
 EEPROM.write(eeprom_Memory_address, " ");  
}
Serial.println("Cell number2 Erased"); 

}

void erase_number3()
{

  for(eeprom_Memory_address = cn3_starting_address; eeprom_Memory_address <= cn3_ending_address; eeprom_Memory_address ++)
{
 EEPROM.write(eeprom_Memory_address, " ");  
}
Serial.println("Cell number3 Erased"); 

}

void erase_number4()
{

  for(eeprom_Memory_address = cn4_starting_address; eeprom_Memory_address <= cn4_ending_address; eeprom_Memory_address ++)
{
 EEPROM.write(eeprom_Memory_address, " ");  
}
Serial.println("Cell number4 Erased"); 

}

void erase_number5()
{

  for(eeprom_Memory_address = cn5_starting_address; eeprom_Memory_address <= cn5_ending_address; eeprom_Memory_address ++)
{
 EEPROM.write(eeprom_Memory_address, " ");  
}
Serial.println("Cell number5 Erased"); 

}

void erase_number6()
{

  for(eeprom_Memory_address = cn6_starting_address; eeprom_Memory_address <= cn6_ending_address; eeprom_Memory_address ++)
{
 EEPROM.write(eeprom_Memory_address, " ");  
}
Serial.println("Cell number6 Erased"); 

}


void erase_number7()
{

  for(eeprom_Memory_address = cn7_starting_address; eeprom_Memory_address <= cn7_ending_address; eeprom_Memory_address ++)
{
 EEPROM.write(eeprom_Memory_address, " ");  
}
Serial.println("Cell number7 Erased"); 

}

void erase_number8()
{

  for(eeprom_Memory_address = cn8_starting_address; eeprom_Memory_address <= cn8_ending_address; eeprom_Memory_address ++)
{
 EEPROM.write(eeprom_Memory_address, " ");  
}
Serial.println("Cell number8 Erased"); 

}

void erase_number9()
{

  for(eeprom_Memory_address = cn9_starting_address; eeprom_Memory_address <= cn9_ending_address; eeprom_Memory_address ++)
{
 EEPROM.write(eeprom_Memory_address, " ");  
}
Serial.println("Cell number9 Erased"); 

}


void erase_number10()
{

  for(eeprom_Memory_address = cn10_starting_address; eeprom_Memory_address <= cn10_ending_address; eeprom_Memory_address ++)
{
 EEPROM.write(eeprom_Memory_address, " ");  
}
Serial.println("Cell number10 Erased"); 

}


Testing:

In example 1 I have already explained how to generate the Hex file link. Follow the same exact steps. After the link has been pasted into the Proteus simulation. Click on the Play button to start the simulation.

Cell numbers storing commands:

The commands a, b, c, d, e, f, g, h, I, and j are used for storing ten numbers. if you want to update the third cell phone number simply enter c and press enter, and then write the cell phone number.

Cell numbers Erasing commands:

The commands l, m, n, o, p, q, r, s, t, and u are used for deleting any of the ten cell phone numbers. if you want to delete the 7th cell phone number simply write r and press enter.

Erase all cell phone numbers:

The command y is used to erase all the stored cell phone numbers.

Display all the cell phone numbers:

The command z is used to display all the cell phone numbers stored in the Arduino EEPROM.

So now you know how to use the simulation.

 

Arduino EEPROM

After you run the simulation, it will display all the stored cell phone numbers. currently, no cell number is stored. Let’s say I want to store my cell number under number7.

Arduino EEPROM

I simply entered g on the keyboard, or you can write the letter g in the android cell phone application and press enter, in replay you will be asked to enter your cell phone number. As you can see I wrote my number, the Arduino replied with number saved. Now to check if the number is saved you can write the letter z to display all the numbers.

Arduino EEPROM

As you can see my number is stored in the Arduino’s EEPROM which will remain in the memory no matter if I turn off the Arduino.

You can try all the commands.

Now you can make an advanced level Security system and use multiple numbers. So when an intruder is detected the same message is sent on multiple cell phone numbers, you can update any number.

 Let me know in the comment if you find this tutorial helpful?  For more tutorials you can subscribe to my Website and my YouTube channel “Electronic Clinic”.

Engr Fahad

My name is Shahzada Fahad and I am an Electrical Engineer. I have been doing Job in UAE as a site engineer in an Electrical Construction Company. Currently, I am running my own YouTube channel "Electronic Clinic", and managing this Website. My Hobbies are * Watching Movies * Music * Martial Arts * Photography * Travelling * Make Sketches and so on...

4 Comments

  1. Sir, do you have any program which can save multiple phone number through GSM and Arduino. if you send that type of program i will be very thank full to you.

  2. Sir, do you have any program which can save multiple phone number through GSM and Arduino. if you send that type of program i will be very thank full to you.

Leave a Reply

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

Back to top button