Hand-programmed EEPROM lookup table
Build it step by step
0 of 7 doneWire the memory
Connect the AT24C256 with A0, A1, A2 and WP to ground.
Wire the display
Add the seven resistors and segments.
Write the table
Upload the sketch once and check the Serial Monitor message.
Step through it
Press the button to move through 0 to F on the display.
Read after a power cycle
Unplug and re-plug to see the data is still there.
Change the table
Add your own letters or symbols to WORD_TABLE and upload again.
Compare with logic
Think how many gates a hex decoder would need and how memory replaces them.
How do you build a hand-programmed EEPROM lookup table?
Use an Arduino to program an I2C EEPROM as a lookup table of 7-segment patterns, then step through it to decode a display. You need Arduino Nano, AT24C256 EEPROM module, 7-segment display 1 digit (common cathode), Resistor 330 Ω × 7, Tactile push button 6 mm, Breadboard 830 Tie Points and Jumper wires male to male (40 pcs, 20 cm). It takes 7 steps and about 120 minutes.
- Level
- Intermediate
- Time
- About 120 min
- Parts
- 7
Parts list
- Development BoardsBuyArduino Nano × 1
- InterfacesBuy
- DisplaysBuy
- PassivesBuyResistor 330 Ω × 7
- SwitchesBuy
- PrototypingBuy
- PrototypingBuy
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| AT24C256 VCC, GND | Nano 5V, GND | Power |
| AT24C256 A0, A1, A2 | GND | Address 0x50 |
| AT24C256 WP | GND | Write allowed |
| AT24C256 SDA, SCL | Nano A4, A5 | I2C |
| Nano D2 to D8 | 330 Ω resistors then display segments a to g | Segment drive |
| Display common pins (3 and 8) | Nano GND | Common cathode |
| Button | Nano D9 and GND | Steps the address |
Code
Arduino IDE, board "Arduino Nano" (processor ATmega328P, or ATmega328P (Old Bootloader) for clones). No libraries needed. The table is written once at start-up; the EEPROM keeps it without power. The segment bit order is a to g from bit 0, so 0x3F makes a zero. To change the table, edit the arrays and upload again. A serial EEPROM cannot drive the display on its own, so the Nano acts as the address counter and the display driver, while all the decoding patterns come from memory, not from logic gates.
Runs on a virtual Arduino Nano in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).
#include <Wire.h>
const byte EEPROM_ADDR = 0x50;
// Segment patterns, bit 0 = a ... bit 6 = g
const byte HEX_TABLE[16] = { 0x3F, 0x06, 0x5B, 0x4F, 0x66, 0x6D, 0x7D, 0x07, 0x7F, 0x6F, 0x77, 0x7C, 0x39, 0x5E, 0x79, 0x71 };
const byte WORD_TABLE[8] = { 0x76, 0x79, 0x38, 0x38, 0x3F, 0x40, 0x73, 0x00 }; // H E L L O - P blank
unsigned int address = 0;
bool useWords = false;
void eepromWrite(unsigned int addr, const byte* data, byte n) {
Wire.beginTransmission(EEPROM_ADDR);
Wire.write(addr >> 8); Wire.write(addr & 0xFF);
for (byte i = 0; i < n; i++) Wire.write(data[i]);
Wire.endTransmission();
delay(6); // wait for the write cycle
}
byte eepromRead(unsigned int addr) {
Wire.beginTransmission(EEPROM_ADDR);
Wire.write(addr >> 8); Wire.write(addr & 0xFF);
Wire.endTransmission();
Wire.requestFrom(EEPROM_ADDR, (byte)1);
return Wire.available() ? Wire.read() : 0;
}
void show(byte pattern) { for (byte i = 0; i < 7; i++) digitalWrite(2 + i, (pattern >> i) & 1); }
void setup() {
Serial.begin(9600);
Wire.begin();
for (byte p = 2; p <= 8; p++) pinMode(p, OUTPUT);
pinMode(9, INPUT_PULLUP);
eepromWrite(0, HEX_TABLE, 16); // the table lives in the EEPROM from now on
eepromWrite(0x20, WORD_TABLE, 8);
Serial.println("Table written. Press the button to step through it.");
}
void loop() {
show(eepromRead((useWords ? 0x20 : 0) + address)); // the display is driven only from the stored data
if (digitalRead(9) == LOW) {
address++;
if (address >= (useWords ? 8 : 16)) { address = 0; useWords = !useWords; } // switch tables after a full pass
Serial.print(useWords ? "word table, address " : "hex table, address "); Serial.println(address);
delay(300);
}
}What the serial monitor should show
Open the serial monitor at the baud rate in the code. This is what our simulator prints for a virtual Arduino Nano with its sensors at their default values. Your numbers will follow your real readings, but the format should match.
Table written. Press the button to step through it.
Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Start-up | Shows 0 and the message prints |
| Press the button | Moves through 1 to F |
| After F | Switches to the word table H, E, L, L, O |
| Power off and on | The table still works |
If it does not work
Display stays blank
Check the common pins and the resistors.
Wrong characters
Check which Nano pin goes to which segment (D2 is a, D8 is g).
Reads return 255
The EEPROM is not found. Check the address pins and I2C wires.
Writes do not stick
Make sure WP is on ground and wait for the write cycle.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the hand-programmed EEPROM lookup table?
Arduino Nano, AT24C256 EEPROM module, 7-segment display 1 digit (common cathode), Resistor 330 Ω × 7, Tactile push button 6 mm, Breadboard 830 Tie Points and Jumper wires male to male (40 pcs, 20 cm).
How long does the hand-programmed EEPROM lookup table take to build?
About 120 minutes for a intermediate maker, in 7 steps.
How do I know the hand-programmed EEPROM lookup table works?
Start-up: Shows 0 and the message prints. Press the button: Moves through 1 to F. After F: Switches to the word table H, E, L, L, O.
Display stays blank: what should I check?
Check the common pins and the resistors.
Wrong characters: what should I check?
Check which Nano pin goes to which segment (D2 is a, D8 is g).
Reads return 255: what should I check?
The EEPROM is not found. Check the address pins and I2C wires.
Writes do not stick: what should I check?
Make sure WP is on ground and wait for the write cycle.
