Arduino EEPROM Write & Read, Arduino EEPROM Examples
Table of Contents
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.
Download Arduino EEPROM Example 1 Simulation: Proteus simulation
Arduino EEPROM Example 1 programming:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
#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.
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.
Copy this link. Now open the Proteus simulation. Double click on the Arduino and paste this link.
Now click on the ok button. You are all set. Now you can click on the play button to start the simulation.
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.
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:
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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 |
#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.
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.
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.
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”.
very nice project, I like this project and waiting for farther project.
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.
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.
Please add (eeprom Home automation systems) code