Arduino and External EEPROM

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

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

  • @elyesmehri3067
    @elyesmehri3067 6 ปีที่แล้ว +4

    For those who received 255 value returned, this is the new code i did fixed it, you just have replace some instructions with data byte ..
    #include "Wire.h"
    #define EEPROM_I2C_ADDRESS 0x50
    void setup()
    {
    Wire.begin();
    Serial.begin(9600);
    int address = 0;
    byte val = 110;
    writeAddress(address, val);
    byte readVal = readAddress(address);
    Serial.print("The returned value is ");
    Serial.println(readVal);
    }
    void loop()
    {
    }
    void writeAddress(int address, byte val)
    {
    Wire.beginTransmission(EEPROM_I2C_ADDRESS);
    Wire.write(byte(0x00));
    Wire.write(val);
    Wire.endTransmission();
    delay(5);
    }
    byte readAddress(int address)
    {
    char rData ;
    Wire.beginTransmission(EEPROM_I2C_ADDRESS);
    Wire.write(byte(0x00));
    Wire.endTransmission();
    Wire.requestFrom(EEPROM_I2C_ADDRESS, 1);
    rData = Wire.read();
    return rData;
    }

  • @MegaJefflin
    @MegaJefflin 5 ปีที่แล้ว +6

    That's an amazing and simple tutorial, I finally understand eeprom

  • @amitpatelpatel144
    @amitpatelpatel144 7 ปีที่แล้ว +9

    The best demonstration on TH-cam about EEPROM. You forgot that how to erase an EEPROM. Good Works

  • @colindgrant
    @colindgrant 4 ปีที่แล้ว +3

    Simple logical and concise. Nice video, thanks.

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

    Thank you for the great tutorial, it really inspired me to work on the similar chip i found from a broken car security circuit. I really like to test on the cmos serial eeprom from ATMEL 93C46 using your method and the datasheet.

  • @bigheat86
    @bigheat86 5 ปีที่แล้ว +2

    Great video. Short, precise, nice. Thank you.

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

    Hey, could you help me? It says 255 instead the needed value every time I try it.

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

      Are you using the sketch I provided in the description? I know that sketch works, so if you are not receiving the correct returned value it must be wiring problem or possibly a bad EEPROM chip. Check you connections against the data sheet and especially make sure you haven't write-protected the chip. The chip will not be write-protected if pin 7 is connected to ground.

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

      Turns out that pin 7 is not write protect but programming time control (I don't have the same eeprom as in your video) and it is supposed to be connected to 5v. This was the wiring problem that I couldn't figure out because I grounded pin 7 like everyone says should be done.

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

      I am glad that you got it figured out and working!

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

      hi friends, I had the same problem as you. I am using the device 24C04 and followed exactly the video´s code but the returned value is 255 instead of the value that I want to write. I tried to conect the pin 7 to ground when I write and to 5v when I read. I dont have any idea what could be my problem, I would be thankful if you shared me your solution.

  • @Golubnich
    @Golubnich 3 ปีที่แล้ว +2

    Hi! Is there any difference between programming this eeprom chip and 24LC01B?

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

    Your valuable tutorial helps a lot. Many many thanks.

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

    I like your EEPROM video demonstration. However I am still a little bit confused. I downloaded your sketch, and wired everything up as show and it seems to work as it should. I enter the value of 110 and it returns it just fine. My question though is how do I have to change the code so I could enter value of say 750. When I try that I get a value back of 0. You mention in your video that you are reading 1 byte on the line Wire.requestFrom(EEPROM_I2C_ADDRESS, 1); How do I read the next byte to be able to enter larger numbers? Thanks

    • @electricks6149
      @electricks6149  5 ปีที่แล้ว +2

      A byte can store a maximum value of 255, so for anything larger you have to store in multiple bytes. A 'short' data type is 2 bytes and can store a maximum value of 65,535. In your sketch, you would declare a short variable and set it equal to 750. You would then write (using shift/mask operators) the first byte of that short to address 0 and then write the second byte to address 1. To read it back, you would read in the byte at address 0 and then read in the byte at address 1. You then combine the bytes back into a short variable using the shift and mask operators.

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

    i dont get the output immediately after opening the serial monitor.
    i get the output only after sending any character from the serial monitor.
    why is that?

  • @stefano.a
    @stefano.a ปีที่แล้ว

    5:49 Why did you used an AND bitwise operator between an integer “address” and a number formed by all ones (0xFF)? The result should be the same “address” value, so why it would be useful? Thanks

  • @DasIllu
    @DasIllu 8 ปีที่แล้ว

    Oh hey, there is a little mix up which may cause some confusion. MSB & LSB are the wrong terms (somewhere around minute 5:00 )
    High byte and low byte are the terms i know for describing the two bytes you've shown. I just mention it, so people don't get confused.

    • @electricks6149
      @electricks6149  8 ปีที่แล้ว +1

      Good catch. MSB and LSB are more commonly used to refer to the Most/Least Significant Bit although sometimes used to refer to the byte order. Your are correct that high byte and low byte are the more common ways to refer to byte order.

  • @ahmetselim1166
    @ahmetselim1166 3 ปีที่แล้ว +1

    what is most logical eeprom for arduino uno more than 4k sram is enough for me

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

    Hi,
    Could you use the Arduino to reset/reprogram various BQXXXX ICs that are usually found in laptop batteries ? 🤔😕
    Thanks &....
    Best Regards,

  • @robostudio4305
    @robostudio4305 7 ปีที่แล้ว +1

    Hi, I have a 24 LC 64 chip and I also receive only 255 as a return value. Are there any other tips around than those below? Switching pin 7 to 5v does not work

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

      Pin 7 should be set to ground on the 24LC64 to allow write operations to the chip. Double check the wiring and make sure the SDA and SCL pins on the arduino are connected to pins 5 and 6 respectively on the EEPROM.
      Make sure the EEPROM chip isn't upside down. With the dimple at the top, pins 1-4 start at the upper left corner and go to the lower left, and pins 5-8 start at the lower right corner and go to the upper right part of the chip. I have a link to the source code of the sketch I used in the description. Have you tried to run it? If so, make sure the EEPROM pins 1, 2, and 3 are set to ground so that I2C address 0x50 is used.

    • @alejoprivera
      @alejoprivera 7 ปีที่แล้ว +1

      Hi, Robo Studio when you are recording EEPROM the pin wp has to be at gnd and when you want to read it has to be at vcc...

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

    Hi but with this programm i can write 24C64?

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

    hi, can this 24lc128 chip model be programmed into the arduino?

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

    I don't want to be "that guy" but EEPROMs don't have a limit on read cycles. Write/Erase operations are what reduce the life of an EEPROM. So if you have something you want to store in EEPROM, do it... and read till the cows come home.

    • @electricks6149
      @electricks6149  7 ปีที่แล้ว +1

      Ian Ide You are correct, I should have said one million erase-write cycles.

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

      Is it even really needed to worry about wearing the eeprom down when it has 1m write cycles? Unless you were recycling the same 4 locations every second, I would imagine it would take a very long time to wear it down

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

      You wouldn't want to do something silly like writing to the EEPROM an ADC value that was read in a loop with no break. Use the EEPROM for what it is intended, store a static setting of some sort and leave it alone (or even update this setting/value once in a while if needed), but you can read it pretty much until the device dies.

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

    This code did not stores the newpass string to eeprom, when ir button is pressed plz help
    #include
    // Absolute min and max eeprom addresses. Actual values are hardware-dependent.
    // These values can be changed e.g. to protect eeprom cells outside this range.
    const int EEPROM_MIN_ADDR = 0;
    const int EEPROM_MAX_ADDR = 250;
    // Returns true if the address is between the
    // minimum and maximum allowed values, false otherwise.
    //
    // This function is used by the other, higher-level functions
    // to prevent bugs and runtime errors due to invalid addresses.
    boolean eeprom_is_addr_ok(int addr) {
    return ((addr >= EEPROM_MIN_ADDR) && (addr

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

    Hi, I saw the datasheet and should't the address be 0xA0 for write and 0xA1 for read ? So it is 0b 1010 0000, why did you write 0x50 & 0x51 ?

    • @electricks6149
      @electricks6149  7 ปีที่แล้ว +3

      There are some I2C protocol versions that use 8 bit addressing, but this chip (24LC512) uses the more common 7 bit addressing. I believe the Wire library handles constructing the control byte for you, so you give it the 7 bit address which is 0x50 (0101 0000 the first bit is ignored) when you call Wire.beginTransmission(). I think it will then send 0xA0 or 0xA1 to the chip based on whether it is a read or write.
      So, I think if you don't use the Wire library and talk to the chip directly, you would send 0xA0 and 0xA1. With the Wire library, you send just the 7 bit address.

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

      It is all mixed up. Simple things are made complicated. Wire.h does use 7 bit device address but to make it 8-bit just before transmission starts, and it seem to always set the last bit to 0, so the EEPROM always waits for data to be written. All in all, Wire.h does not go with serial EEPROMS.

  • @خالدباشميل-ب9و
    @خالدباشميل-ب9و 2 ปีที่แล้ว

    I try make this tutorial but I use EEPROM 24C08A and use same the code in this video and result in serial print "the returned value is 255"
    why don't get this message "the returned value is110"

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

    Very good tutorial! Is there any reason you can't merge 50 & 52? `return Wire.read()` instead of writing it to a variable then returning it? I've never used Wire before.

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

      Yes, you can save a line of code by doing `return Wire.read()`.

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

    I'm having problems where the read of the EEPROM doesn't always match what I write to it. It's pretty random, but consistent. I integrated a while loop to keep writing the value wanted until the read matches the write... Even with the read matching the write loop, I still get read a different value if I read the address again. Any idea what my problem could be?

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

      Did you make sure to add the 'delay(5);' after performing a write? It takes 5 milliseconds for the chip to actually write the value to the address after calling the 'Wire.write();' command. If you do have the delay command, maybe try bumping the value up from 5 to 10 to see if that makes any difference.

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

    sorry im a noob in programming. but does this work for every 8 pin eeprom? and if i understand correctly you have put the value 110 in it? and is that the only date stored to it? thanks

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

      For other EEPROM models, you would need to look at its particular datasheet to see how data is I accessed on the chip. If it’s an I2C chip, it should be very similar to the one used in the video.
      I just used a single value of 110 to write and read, just to keep the demonstration simple. Most chips will have an additional way to read and write large blocks of data instead of a single byte at a time.

  • @shiva9989509341
    @shiva9989509341 9 ปีที่แล้ว +1

    nice tutrorial what i waslooking for

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

    Awesome brother please make video on led control with button with external eeprom..i wait your video..

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

    #include "Wire.h"
    Hi, i have a stm32f411(black pill board) and a 24lc64.
    i have wired data to PB7 and clk to PB6 these are the i2c pins.
    it does not work witht he code here, do i have to inform it of the different pins used?
    any ideas? please help. thanks

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

      You may want to double check the data sheet for the specific chip you are using. Make sure the I2C address is correct, and that the protocol for reading and writing to the chip are the same. Also, make sure the “write” pin is set correctly in case it is different than for the chip I am using.

  • @MadsRisbjerg
    @MadsRisbjerg 8 ปีที่แล้ว +1

    Great tutorial! Really informative. I have tried it and it works.
    However, I have one question: how do I address the individual EEPROM's if I have two connected to the i2c bus of the Arduino?
    I would like to store two different bytes on them.

    • @electricks6149
      @electricks6149  8 ปีที่แล้ว +1

      Mads Risbjerg Andersen Thanks for the comment. Pins 1, 2, and 3 are the address pins (A0, A1, and A2) and you set these pins high or low via the Arduino. Each chip has to have a unique address so the first could be set to 0 0 0 and the second to 0 0 1. The three address pins will allow for up to 8 EEPROM chips to be addressed. Each chip has the same I2C address so they will all receive the communications, however the address pin value is encoded in the control byte so the chip knows whether or not the communication was intended for it. You should probably take a look at the 24LC512 data sheet since it explains it better than I can.

    • @MadsRisbjerg
      @MadsRisbjerg 8 ปีที่แล้ว

      Thanks for the quick answer! I've spent quite some time trying to figure it out now. Still haven't fixed it though. I'm not quite sure how I give the individual EEPROM's their specific addresses. I understand that I can change the three last digits in the address, which gives me a variety of different combinations. I have defined a new address with the value: 0x51, since that would be 1010001, right? I just don't get what specific code I should write in the Arduino IDE to give the EEPROM's their different addresses. Would you mind giving an example of how it could work with starting point in your code example?
      Thanks again.

    • @electricks6149
      @electricks6149  8 ปีที่แล้ว

      You just need to add another #define for the second chip. From my sketch, you would now have this:
      #define EEPROM_I2C_ADDRESS1 0x50#define EEPROM_I2C_ADDRESS2 0x51
      So now when you call Wire.beginTransmission(), you pass it the address of the chip that you want to access.

    • @MadsRisbjerg
      @MadsRisbjerg 8 ปีที่แล้ว

      Yeah, okay nice. It is done and now I can read from both individually - however I only receive a value of 255 from the second EEPROM, do you know why that is?
      Also, what if I want to access (read) from both of them simultaneously?
      The purpose for me is to write to them one at a time, but then afterwards read from both at the same time and get both values.

    • @electricks6149
      @electricks6149  8 ปีที่แล้ว

      I just posted a new video on my channel that shows how to read and write to multiple EEPROMs, so maybe take a look at it: th-cam.com/video/Ejrh1vNeDhA/w-d-xo.html. If you are reading a value of 255, there is something wrong. Maybe the EEPROM address pins aren't set correctly? Also, I don't think it is possible to do a simultaneously operation across different chips. I believe part of that is the way that I2C works and the fact that there is only one processor on the Arduino.

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

    I didnt understand ..what did u do with the 7th pin of that ic...where did u connect it to?

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

      If you want to write-protect the contents of the chip, you set pin 7 to the same 5V that you use to power the chip. To enable writing, you connect pin 7 to ground. In the video, I call it high (5V) and low (0V).

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

    I've a microcontroller ic (AT90s1200).can anybady help me out how to program ..??

  • @nemac_SD
    @nemac_SD 7 ปีที่แล้ว +1

    Hello,
    I have some questions about eeprom and arduino.
    All of videos on youtube mostly explain how to upload sketch to eeprom, mostly attiny45/85, (they just copy each other videos, set board, programmer, butloader..) via arduino, but thay all use blink or fade sketch!
    I am completely new in this area (i'm mechanical engineer) and I'm working on some project that include 2 inputs and 3 outputs.. Can I use 24C32 or 24C64 (8pin chips) for project like this..(1250 bytes)?
    Is it possible to get some closer info on how to do it?
    Thank you very much in advance :)

    • @electricks6149
      @electricks6149  7 ปีที่แล้ว +1

      I think those chips (24C32 and 24C64) should work fine for use as external EEPROM to an arduino. Just make sure and check the data sheet for the pin layout. You only need 2 data pins from the arduino to communicate with the chip, the I2C serial communication clock and data pins.

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

      Electricks So it's possible to use it as stand alone chip with just power suply.. After programing it with arduino off course?

    • @electricks6149
      @electricks6149  7 ปีที่แล้ว +1

      I don't think there is a way to do that with these EEPROM chips. The chip by itself would not have any way to interpret and execute any programming code. It's kind of "dumb" in that it will store and allow you to retrieve data from it's memory addresses, but that's it. There are no internal registers or processors to execute code. The attiny (or arduino) chips that you mentioned in your original post is what you need I think. These EEPROM chips can be used to store additional data (but not programs) if you don't have enough storage space on the attiny/arduino.

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

      Ok, now I get it.. Thank you very much for replay :)
      I guess I'm just go and order few attinys :D

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

      Btw, I ask question like this cause in Serbia(I'm from Serbia) I can find ATTiny 45 nor 85, and 24c32/64 are like 30 cents :)

  • @100roberthenry
    @100roberthenry 4 ปีที่แล้ว

    did i hear you say you can re write this eeprom 1 million times???? if not how many times?. cheers.

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

      Yes, that's the number given by the data sheet for the chip.

    • @100roberthenry
      @100roberthenry 4 ปีที่แล้ว

      @@electricks6149 excellent thanks.....

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

    Why not use flash ic instead?

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

    I love you, thank you

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

    it works. Thank you

  • @gauravmg
    @gauravmg 8 ปีที่แล้ว +1

    very good. can you show how to write a .hex file byte by byte to an eeprom?

    • @electricks6149
      @electricks6149  8 ปีที่แล้ว

      I did a similar video where I am reading from an EEPROM and writing to a binary file in Dumping External EEPROM Contents to an SD Card Using Arduino. You should be able to do something similar by reading from a file and writing to the EEPROM.

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

    Hi. Is there a limit for reads?

  • @sunitapatil381
    @sunitapatil381 7 ปีที่แล้ว +1

    sir can we extend the flash memory? if yes then how? i am not getting.

    • @electricks6149
      @electricks6149  7 ปีที่แล้ว +1

      The flash memory on the arduino is used to store the program and I don't know of any way to extend that. If you are running out of available flash memory due to your program size, you may want to look at the arduino Mega2560. The arduino uno has 32kB of flash, however the Mega2560 has 256 kB of flash.

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

      yes thank you sir

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

    sir i work done home automation project using esp8266 module.my digital pins high or low how to store external eeprom.ple tell about sir

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

    I'm using 24c08 code not working 255 o/p instead of 110, wiring done according to video

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

      I think the addressing works different for the 24c08 chip. Look at pages 9-12 of ww1.microchip.com/downloads/en/DeviceDoc/doc0180.pdf

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

      @@electricks6149 thanks

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

    Why do you need to cast after an 8bit shifting?
    Wire.Write((int) (address>>8));
    Isn't (address>>8) already an int??

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

      Since 8 is a literal value I don't think it is certain how the compiler will treat it. Casting the result guarantees that the result value is an int. Wire.Write() is overloaded and one of the overloaded methods takes an int, although ultimately it only sends a single byte.

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

    Why not just use a SD card (or other flash memory) for read/write memory?

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

      Hey there, there might be several reasons. I'm coming from writing to an SD card and looking into EEPROM due to some "issues" with the cards:
      1: The sd cards need usually a very stable voltage to write to, most cheap modules work on 3.3V. Now, this is usually achievable, but the cheap modules also have cheap linear voltage regulators with high dropout voltage. Effectively, this means you usually need about 3.8 volts to write on the SD card, but if you power it with a single lithium cell, voltage drops below that well before you run out of battery capacity. I had to replace the cheap linear converters on the SD modules with low-dropout ones.
      2: Sd cards draw very high currents during read and write (about 200 ma). If you do ultra-low power projects, the writing to the card will quite likely be the biggest power consumption in your circuit. EEPROM need much less power to write to --> longer battery life of your project.
      3: EEPROM is very cheap. So if you don't have to write a lot it might be just about right. to save some bucks.

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

    great video. may i ask , how to erase an eeprom from ic 24lcxx with arduino ?

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

      I think you would just overwrite the memory areas you want to erase with all zero's or all one's.

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

    is it compatible with the 24LC01B model?

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

      I think the only real difference between the 2 chips is the capacity. The24LC512 can hold 64 kilobytes, whereas the 24LC01B can only hold 128 bytes. The pin layout, operating voltage, Max. I2C clock frequency, etc. seem to be identical.

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

      @@electricks6149 I'll try adjusting the code, Thanks!

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

      Janx the hedgehog Actually, you may want to take a look at the data sheet for the 24LC01B. I think the addressing scheme of accessing byte addresses is a little different.

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

      @@electricks6149 I'll take that into account.

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

      update: just by stripping the shifts and the second line from the address code it worked fine. still amazing tutorial

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

    Why do you initialize rData to 0xFF?

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

      Hmm, I honestly don't recall why I initialized that to 0xFF. Initializing it to zero (or not initializing it at all...although I generally don't like to do that) should be fine.

  • @dibraniuk
    @dibraniuk 8 ปีที่แล้ว

    great lesson thank you,
    is it possible to read & write any other eeprom this way?

    • @electricks6149
      @electricks6149  8 ปีที่แล้ว

      It should be possible, but you need to check the datasheet for the EEPROM chip you are using. It is generally easier to use if it utilizes the I2C communication protocol.

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

    It works fine on 24C64.
    On both 24C02 and 24C04 I got:
    The returned value is 255
    Why??

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

      Looking at their datasheets, I don't really see anything that would indicate why the code will not work. I did see that for the 24C04, the device addressing scheme is a little different than the other two chips. Instead of this type of address: 1 0 1 0 A2 A1 A0 , it uses 1 0 1 0 A2 A1 so the A0 bit is not used as part of the device address.

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

      Here the communication logged with my L.A.
      24C64:
      START - WRITE 50h - ACK - 0 - ACK - 0 - ACK - 110 - ACK - STOP
      START - WRITE 50h - ACK - 0 - ACK - 0 - ACK - STOP - START - READ 50h - ACK - 110 - NACK - STOP
      24C02 & 24C04:
      START - WRITE 50h - ACK - 0 - ACK - 0 - ACK - 110 - ACK - STOP
      START - WRITE 50h - ACK - 0 - ACK - 0 - ACK - STOP - START - READ 50h - NACK - STOP

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

      That is odd. I don't know why the 24C02 and 24C04 are not returning the value.
      In the readAddress function you might try changing the following line:
      rData = Wire.read();
      to:
      if(Wire.available()){ Wire.read();}

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

      Just tested it.
      Unfortunately same as above :(

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

      The only other thing I can think of is perhaps the write protect pins on the 24C02 and 24C04 are set?

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

    HI. are can eepprom memory adding to arduino memory. become size arduino memory large.

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

      I don't know of a way to add EEPROM in a way that extends the existing EEPROM. I think it has to be separate and separately addressable.

  • @sunitapatil381
    @sunitapatil381 7 ปีที่แล้ว +1

    nice vedio sir

  • @yxhankun
    @yxhankun 8 ปีที่แล้ว

    how to write GPS ( LONG & LAT with nnn.pppppp) into EEPROM 24C256 chip?

    • @electricks6149
      @electricks6149  8 ปีที่แล้ว

      You would need to devise a scheme to encode and decode the floating point values. There is an IEEE standard for doing this (IEEE 754), so you could try to find an arduino library for this or write your own. That may be overkill however, since you are only storing lat/lon values. So what you could do is write your own encoder/decoder. One way to do this is to have the integer portion of the float value stored in the first two bytes. One byte would not be enough for the longitude values, since the range is -128 to +128 and you need -180 to +180 for the longitude values. You could use the next 4 bytes to represent the unsigned decimal portion of the value. Each float value would then take up 6 bytes, and you would need to parse the lat/lon values and do some bit shifting to write the values to the EEPROM, and would also need to do reconstruct the float values when reading from the EEPROM.

    • @electricks6149
      @electricks6149  8 ปีที่แล้ว

      One other thing you could do is treat the values as long integers when they are stored in EEPROM. For example, if you have a longitude value of 121.3453456 just multiply it by 10000000 to get 1213453456. Store that into the EEPROM, and when you read the value from the EEPROM, you just divide it by 10000000 to get the original value.

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

    Very cool thanks

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

    How to write strings to external eeprom ??

    • @electricks6149
      @electricks6149  7 ปีที่แล้ว +1

      If they are fixed length strings you could use ASCII values and just write them out as bytes. Since they are fixed length, you know how many bytes to read once you have written them to the EEPROM.
      For variable length strings you could use null-terminated strings. You still use ASCII values but add an ASCII 0 byte at the end of the string. So to write the string 'HELLO', you would write the ASCII values 72 69 76 76 79 0 . You would need to know the starting address of the string in the EEPROM, and when you read the string value you would have a loop that reads each byte into a character array until you read ASCII 0, which indicates the end of the string.
      Another way to handle variable length strings is to have the first byte indicate the length of the string. So when writing 'HELLO', you would write the following ASCII bytes to EEPROM: 5 72 69 76 76 79 . When reading the string from EEPROM, you would read the first byte to get the string length and then loop that many times to read the values into a character array.

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

    Wt is d supply voltage of eeprom

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

    how to write string?

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

      Useful Tip: Learn Bytes, How PCs Store Strings/Text, ASCII then you can ask this question

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

    Sir I have 24c family eeprom can we blink Led with it

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

      @Andrew ergerergerg Are you serious? 100000 times per second.

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

      You cannot execute instructions on the chip, so you can't blink an LED like you can from an Arduino. The chip can only store data, and that's it.

  • @DrScientistSounds
    @DrScientistSounds 8 ปีที่แล้ว +1

    thank you!

    • @electricks6149
      @electricks6149  8 ปีที่แล้ว

      +DrScientistSounds Thanks for the feedback!

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

    how can i store the previous values of length for rotary encoder using external EEPROM? here is the code , plz help me to develope code to store previous data during powered off condition on LCD .
    code :
    #include
    #include
    LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
    int address=50;
    int read_value=0;
    const int buttonPin = 8;
    int buttonState;
    int led=9;
    int val;
    int encoderPinA = 6;
    int encoderPinB = 7;
    int counter = 0;
    int encoderPinALast = LOW;
    int n = LOW;
    float Length;
    float r=31.82;
    float pulses=15;
    float pi=3.1428571;
    int istrue;
    void setup() {
    pinMode(led,OUTPUT);
    pinMode (encoderPinA,INPUT);
    pinMode (encoderPinB,INPUT);
    Serial.begin (9600);
    lcd.begin(16,2);
    lcd.print("Last Value");
    read_value=EEPROM.read(address);
    lcd.print(read_value);
    EEPROM.write(address,(Length));
    delay(400);
    lcd.clear();
    }
    void loop() {
    n = digitalRead(encoderPinA);
    if ((encoderPinALast == LOW) && (n == HIGH)) {
    if (digitalRead(encoderPinB) == LOW) {
    counter--;
    Length=2*pi*r*counter;
    Length=Length/pulses;
    if(counter

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

      I would try using EEPROM.get() instead of EEPROM.read(), and EEPROM.put() instead of EEPROM.write(). EEPROM.read() will only read a single byte of data, however you want to read a float value which is larger than a byte. Take a look at www.arduino.cc/en/Reference/EEPROM and look at the differences between 'read()' and 'get()'.

  • @noone-en4jt
    @noone-en4jt 4 ปีที่แล้ว

    nice video can you tell how to write data in eeprom from .dat file?

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

      I did another video where I read and write EEPROM data to a file on an SD card: th-cam.com/video/eUgadvawA1I/w-d-xo.html

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

    How to write more than 3 digits

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

      For a short data type (which is 2 bytes), you could store the first byte (8 bits) in an address and then store the next byte (8 bits) in the next address. Your program would have to know that you are storing a 2 byte integer in the first address, and then read 2 bytes starting at that address. After reading the bytes, your program would then concatenate them together to get a two byte integer. You could do the same sort of thing for a 4 byte integer.

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

    biiiiiiiiiiiiiiiiiiiiiiiig like

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

    Please reply

  • @mezzofresh3521
    @mezzofresh3521 3 หลายเดือนก่อน

    This guy breathes too friggin loud! I cannot watch anymore