This manual is released by the author into the public domain.
- Connect Arduino GND to EEPROM GND.
- Connect Arduino SDA to EEPROM SDA.
- Connect Arduino SCL to EEPROM SCL.
- Connect Arduino 5V to EEPROM Vcc.
- Open the Arduino IDE.
- Connect Arduino (I used USB).
- Choose correct board and serial port in Arduino IDE.
- Upload code to Arduino using the IDE.
- Open serial console (Ctrl+Shift+M).
- The board waits 4 seconds after Arduino reset (end of upload).
- Then it promps for I²C address.
- If you do not see this prompt, just enter the address.
- If you don't know the address, enter the character 'P'.
If you opened the serial console soon enough, you'll be prompted for an I²C address or a 'P'. If you did not open the serial console within four seconds after the Arduino reset, you will not see the prompt, but the Arduino will still patiently wait for your input.
Enter the address, or the character 'P'.
The Arduino wire library works with 7-bit I²C adresses.
The Arduino Serial library can easily parse decimal values, not hex codes. Therefore the default T24C02A address 0xA0 is rendered thus:
- Right-shift one bit to get 7-bit address: 0xA0 >> 1 → 0x50
- Convert to decimal: 0x50 → 5×16 + 0 = 80
If you have a T24C04A, T24C08A or T24C16A, you can change addresses later to write to other memory pages.
If you entered the character 'P', the Arduino will poll all 128 possible addresses on the I²C bus. It wil show you the address the devices that answered, and their answers.
Once you have successfully entered an address, you will arrive in the main shell menu.
You will be asked for a command char:
R — Read
W — Write
S — Set I²C address
P — Poll the I²C bus.
S is useful if you set the I2C address wrong, have multiple EEPROMs or have a T24C04A, T24C08A or T24C16A IC.
- Follow the instruction:
- Enter the start address for the read.
- Enter the number of bytes to be read.
- The device will print all characters on a single line.
- Followed by a line of statistics.
- Optionally followed by a line indicating an error.
- Follow the instruction:
- Enter the start address for the write.
- Enter the string to be written.
- Escape numerical ASCII representations of characters by prefixing them with an @.
- @64 is the @ character itself, in case you want to write an actual @.
- The device will print each character submitted to the device.
- The device will print a human readable error message for each unsuccessful write.
- The device will retransmit (including reprint of) the character up to NUM_TRIES times.
NUM_TRIES
is set to 10 in the code by default.
- You get an error message indication.
- The device skips this address.
- It continues to write the next character to the next location in the EEPROM.
The same procedure as detailed in the section "Getting Started", see above.
The same procedure as detailed in the section "Getting Started", see above.
This polling is not done as part of a change of address. Therefore, the device will give information on the polled devices, and return to the menu immediately afterwards.
Due to the way the Arduino Serial library works, you need not wait for the prompt to enter the next command. It reads command characters and numerical characters separately as well thus:
R11 13
will read thirteen bytes starting at EEPROM address 11.
- Note the space between 11 and 13, otherwise the start address will be set to 1113.
- Any non-numerical character should work between the numbers, it need not be a space.
W25Hey!This is a test@64@
will write the string Hey!This is a test@@
starting at EEPROM address 25.
- Note that the string is written directly after the start address.
- This method will not work if you want your string to start with a numerical character.
- The ending may be untuitive, but the first @ is treated as an escape character indication that the next character is the numerical 64 (an @ character). The next @ is the last character on the line. The system will check and see that the Serial buffer is empty, and conclude that it is not an escape character, since it is not followed by a number.
- This only works at the end of the string! Any @ followed by a non-numerical character WILL mess up your write command.