Arduino Tutorial 10: Save Data with EEPROM!

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 ก.ย. 2024

ความคิดเห็น • 54

  • @t.c.nevzatozdogru7929
    @t.c.nevzatozdogru7929 5 ปีที่แล้ว +1

    Dear Baran-Harper,
    E2eprom information you provide was very helpful for me.
    Many many thanks.

  • @codingspace1143
    @codingspace1143 5 ปีที่แล้ว

    you are awesome...I watch a lot of videos about eeprom and not get the idea but your video is great...many thanks and God bless you bro

  • @GeoffPritchett
    @GeoffPritchett 3 ปีที่แล้ว

    cool now how do you write to eeprom when using timer interrupts....nothing works just crashes on button press when a timer is enabled to an ISR alarm

  • @JimmiJohnJunnior
    @JimmiJohnJunnior 6 ปีที่แล้ว +1

    I'd suggest to anyone trying this to put the read from EEP read in the setup and make two more if statements that compare the lastPress before writing to EEP so that you wont waste any cycles from your arduino.

    • @RD-ni7qe
      @RD-ni7qe 3 ปีที่แล้ว +1

      Hi Jim, I know this is several years old now, but would you be willing to write this up in an example code for me?

  • @timothymanz7999
    @timothymanz7999 3 ปีที่แล้ว

    why perform READ before WRITE as EEPROM preservation? would you call a function like UPDATE in order to only write when data is actually different?

  • @DwiNoviantoUntidar
    @DwiNoviantoUntidar 5 ปีที่แล้ว +1

    How to save 4 variables
    I need to save second, minutes & days.
    thanks.

    • @DwiNoviantoUntidar
      @DwiNoviantoUntidar 4 ปีที่แล้ว

      @Madushan Jayawardane no, i am not.
      I will make timer for egg incubator. I have to measure temp & humidity while counting the time for controling a motor to flip the egg. Cz i have to turn on the motor every 8hour.

  • @springwoodcottage4248
    @springwoodcottage4248 6 ปีที่แล้ว

    Super useful to me, thank you for sharing!

  • @dilshankasthuriarachchi4737
    @dilshankasthuriarachchi4737 4 ปีที่แล้ว

    Hellooo could you please tell me how does the any data save to EEPROM in arduino? i mean ,servo motor positioning, Gsm module

  • @paulg.3067
    @paulg.3067 5 ปีที่แล้ว

    very nice and clear tutorial, thanks!

  • @agentrfr1
    @agentrfr1 7 ปีที่แล้ว +2

    Cool video
    Just a question though, since your loop currently doesn't check EEPROM state before writing, wont it write every loop while the button is pressed? Even if it takes 5ms per loop, holding the button for 1 second would do 200 writes to the EEPROM, or rather that EEPROM is useless after a total of 500 1 second button presses :(

    • @alexanderbaran-harper4748
      @alexanderbaran-harper4748  7 ปีที่แล้ว

      Yes. And I suggest this at the end of the video when I say "a better way to go about doing this is you could read the EEPROM first before writing to it if you want to preserve your EEPROM, but for the sake of speed in this tutorial I just show you how to overwrite it every time." 9:20

    • @syedibrahim3139
      @syedibrahim3139 7 ปีที่แล้ว

      Alexander Baran-Harper lcd 16 by 2 and 4*4 keypad

    • @abdulrahmanismailali1064
      @abdulrahmanismailali1064 2 ปีที่แล้ว

      @@alexanderbaran-harper4748 can you help me in my project

  • @henokali7005
    @henokali7005 7 ปีที่แล้ว

    I love your content and explanation

  • @diyhub2986
    @diyhub2986 7 ปีที่แล้ว

    How to delete or clear save data in eeprom? what will happen if i uploaded a new code? does the data stays in the arduino even if i change or upload a new sketch/code?

  • @EVERY.CIRCUIT
    @EVERY.CIRCUIT 4 ปีที่แล้ว +1

    Nice, you taught us the way to store bits ,but how about saving the words and decimal numbers?

  • @neilanthonysevilleja7469
    @neilanthonysevilleja7469 6 ปีที่แล้ว

    Sir, i have a question. How can i save RFID tags into EEPROM?

  • @ضياء6
    @ضياء6 3 ปีที่แล้ว

    EEPROM.update () instead of EEPROM.write()

  • @shapathsust8948
    @shapathsust8948 6 ปีที่แล้ว

    Hello Sir...I am new in avr ..I am using arduno mega 2560..I try to use flash memory for data storage.I used PROGRAM array for this.I have multiple Program array .The prolem is when the sum of the arry size >64K It stoped working. I used pgm_read_xxx_far(). but not working for me.. I live in very native place..here no expart available who can help me... Please help sir..

  • @rimbacahyo8362
    @rimbacahyo8362 5 ปีที่แล้ว

    Is it the same memory that arduino used to save all program that we upload into it?

  • @alphonsesynrem28
    @alphonsesynrem28 6 ปีที่แล้ว

    Very good video. Thank you.

  • @joshuanulton1403
    @joshuanulton1403 7 ปีที่แล้ว

    Excellent video!!!

    • @alexanderbaran-harper4748
      @alexanderbaran-harper4748  7 ปีที่แล้ว +1

      Haha, your comment is making me laugh :). The 9 minute video has been up for five minutes and you're already commenting! Thanks man, I'm glad you like it.

    • @joshuanulton1403
      @joshuanulton1403 7 ปีที่แล้ว

      Alexander Baran-Harper Honestly I am still watching it, as soon as you demonstrated the power being pulled and the LED's resetting then stated your goal and plan I knew the video was GOLD! I may be jumping ahead of the video but I instantly wondered if integers could be written to the eeprom as a variable, and if the board resets it could poll the eeprom and display the last reading to an LCD? Can we write anything to it?

    • @alexanderbaran-harper4748
      @alexanderbaran-harper4748  7 ปีที่แล้ว

      The EEPROM allows you to write one byte to each address. You can therefore store an integer between 0 and 255 to a single address. If you write your code right, though, you could store bigger numbers across multiple addresses.
      So to answer your question, yes you absolutely can. You can store up to 1024 bytes on an Uno and it's up to you how you use them.

  • @derayend6939
    @derayend6939 6 ปีที่แล้ว +1

    Your code is very very inefficient, and it also will destroy your eeprom faster

  • @sandorfekete3730
    @sandorfekete3730 7 ปีที่แล้ว

    dear Alexander i am an old man but i am Bety passionated for IT i hope that You understun me and i send You this message becauuse i feel thath you name Baraj is by ther orrigine romanian.My be is not so. I live in romania and please exxcusse me If. is it is wrong. With many reguards alexader from oradea.

  • @Kyles_Granado
    @Kyles_Granado 5 ปีที่แล้ว +1

    can you pls explain further what is uint8_t EEPROM = 0; in line 12

  • @mohammadjawadbarati4578
    @mohammadjawadbarati4578 6 ปีที่แล้ว +1

    hi Alexander
    thank you for this video , i have question, when we write for number one , for example " uint8_t addressOfEEPROMnumberOne = 100; " and then save a float number one for example "22.34" , for next number ( number two) for example "25.96" , What number should I put in the new address?
    "uint8_t addressOfEEPROMnumberTwo= ? ;"

    • @alexanderbaran-harper4748
      @alexanderbaran-harper4748  6 ปีที่แล้ว

      This link below answers your question better than I can in a TH-cam comment:
      www.arduino.cc/en/Reference/EEPROMPut
      Something like a float takes up more than one byte. In the tutorial I show you how to address individual bytes and write individual bytes. I thought this would be a simpler tutorial than going into full detail of how to use the EEPROM. The link above has an example for writing a float or other object to EEPROM where you're dealing with objects that typically are longer than one byte.
      Hope this helps!

  • @EgyptFishingVideos
    @EgyptFishingVideos 4 ปีที่แล้ว +1

    Lovely! Thanks.
    Will try it with the Nano as well and see what happens!

  • @velgameinc5015
    @velgameinc5015 2 ปีที่แล้ว

    Hello! Please can you help with the code?

  • @EmadSaeed
    @EmadSaeed 8 หลายเดือนก่อน

    Straight to the point, thanks

  • @reinielantonio2278
    @reinielantonio2278 4 ปีที่แล้ว

    how to save input txt data?

  • @bikrammukherjee7613
    @bikrammukherjee7613 6 ปีที่แล้ว

    thanks for this video....but how to save bluetooth past data in arduino? when the power down and after power on the arduino fetch the past data of bluetooth
    please help in this matter...

  • @kouameherve6907
    @kouameherve6907 6 ปีที่แล้ว

    good tutorial, now can you make it with one EEPROM external 24C08 for exemple

  • @trungnguyenthanh5954
    @trungnguyenthanh5954 6 ปีที่แล้ว

    Can you show me how to study and save latitude and longtitude by button to eeprom? Thanks

  • @singpong7199
    @singpong7199 5 ปีที่แล้ว

    Can i use this for saving data coming from serial ports?

  • @EVERY.CIRCUIT
    @EVERY.CIRCUIT 5 ปีที่แล้ว

    nice

  • @AhmedAli-sn3ty
    @AhmedAli-sn3ty 6 ปีที่แล้ว

    you always make me understand your topics clearly
    thanks man make more like this

  • @williamponraj3637
    @williamponraj3637 6 ปีที่แล้ว

    how to do the same operation in external eeprom

  • @sobhanmovassagh6792
    @sobhanmovassagh6792 7 ปีที่แล้ว

    hi your tutorial is very usefull , tank you. but in your site the video for this tutorial (tutorial 10) is wrong. you linked video of tutorial 5 to tutorial 10.

  • @syedibrahim3139
    @syedibrahim3139 7 ปีที่แล้ว

    can u do it on keypad with lcd pl quick as possible

  • @taranagnew436
    @taranagnew436 6 ปีที่แล้ว

    where can I print the pin labels that you have on your Arduino?

    • @taranagnew436
      @taranagnew436 6 ปีที่แล้ว

      and does the EEPROM only activate if the power to the Arduino is cut off like if a power outage occurs?

  • @The_Mindful_Scholar
    @The_Mindful_Scholar 7 ปีที่แล้ว

    i use rotary encoder for measuring linear displacement. after power cutt off arduino is only able to store value from 0 to 255 mm. not more and less than this range. here is the code plz suggest me that how can i store large number of -ive and +ive values :
    #include
    int address = 1000; // the variable which holds the address in the eeprom
    #include
    LiquidCrystal lcd(6, 7, 8, 9, 10, 11);
    const int buttonPin = 4;
    int buttonState=0;
    float Length=0;
    float Length1;
    float r=31.82;
    float r1=3.182;
    float pulses=30;
    float pi=3.1428571485714;
    #define outputA 3
    #define outputB 2
    int counter = 0;
    int aState;
    int aLastState;
    void setup() {
    lcd.begin(16,2);
    pinMode (outputA,INPUT);
    pinMode (outputB,INPUT);
    pinMode(buttonPin,INPUT);
    Serial.begin (9600);
    // Reads the initial state of the outputA
    aLastState = digitalRead(outputA);
    lcd.print("LENGTH ");
    Length = EEPROM.read(address); // read the value from the address
    lcd.setCursor(0,1);
    lcd.print(Length)+lcd.print(" mm");
    }
    void loop() {
    buttonState = digitalRead(buttonPin);
    if (buttonState==LOW){
    counter=0;
    Length1=0.00;
    Length=0.00;
    Serial.println("Reseting All Values");
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("RESET... ");
    delay(1000);
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("LENGTH ");
    lcd.setCursor(0,1);
    lcd.print(Length);
    delay(100);
    }
    // buttonState1 = digitalRead(buttonPin1);
    // if (buttonState1==HIGH){
    aState = digitalRead(outputA); // Reads the "current" state of the outputA
    // If the previous and the current state of the outputA are different, that means a Pulse has occured
    if (aState != aLastState){
    // If the outputB state is different to the outputA state, that means the encoder is rotating anti-clockwise
    if (digitalRead(outputB) != aState) {
    counter ++;
    Length=2*pi*r*counter;
    Length=Length/pulses;
    Length1=Length1/pulses;
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("Forward (mm) ");
    EEPROM.write(address, (Length));
    } else {
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("Backward (mm) ");
    EEPROM.write(address, (Length));
    counter --;
    Length=2*pi*r*counter;
    Length=Length/pulses;
    Length1=Length1/pulses;
    }
    lcd.setCursor(0,1);
    lcd.print(Length);
    Serial.print("Counter: Length: ");
    Serial.println(Length)+Serial.println(counter);
    delay(15);
    }
    aLastState = aState; // Updates the previous state of the outputA with the current state
    // }
    }