Message in a Chip




Introduction: Message in a Chip

If you had just 1024 bits of data to write a message of importance, how would you do it? That could be 128 ascii-coded characters (about a Tweets worth), or a bit map of 32 x 32 pixels.

Why would I ask such a question? I was working with a label printer and the cartridge contained a small surface mount chip on a PCB. On closer inspection, it turns out to be a fairly common 1-Kilobit EEPROM (erasable memory). The next obvious question is, "can I read and write it with an Arduino?" The answer to that is, "YES!", of course. Which leads us back to the first question. What could you do with a kilobit?

In 1974, astronomers brocast a 1.6 kilobit message from the Arecibo radio antenna. The message consisted of a 73 x 23 bitmap (prime numbers) containing coded information about humans, our basic structure, and that of our solar system. Being that the stars it was pointed at were 25,000 light years away, I doubt we'll get a reply any time soon, but it does lead to some interesting thinking about how to code information so it can be retrieved by someone with no fore knowledge of the structure or contents.

The real title of this Instructable should be "How to Read and Write to a DS2431 EEPROM with Arudino", but how boring is that? The interesting part of the DS2431 is that it uses a communication system called 1-wire which requires only a ground and a signal.

Enough pre-amble. Let's get down to bits.

Step 1: One Wire?

The PCB has three pads on the bottom, with the one in the middle marked "S", which we can assume means signal, and the ones on the edges marked "G", which by process of elimination we can assume are ground. Despite the chip having six legs, looking at the data sheet show that only two are used, one for ground and the other signal, or "IO".

The only real hitch for the Arduinoist is that the signal line requires a "strong" pull-up signal, which rules out using the internal ones. We need to wire something in the 4.7K - 8.2K ohm range. I'm using a 6.8K ohm resistor. See the diagram if you are unsure how pull-ups work. They basically ensure the signal line is at 5 volts unless a signal pulls it low.

On the PCB I designed, I decided to add the resistor to make it easy to interface to. All you need is a three pin male header. You can set the Arduino pins to be ground or supply by setting the pinmode to OUTPUT, and then setting them either HIGH (for source) or LOW (for ground).

On to some code!

Step 2: Code

I started with some code posted in the Arduino Forum by FredBlias. Even with a working code example, I still had to struggle a bit to understand what was going on under the hood. The important thing to understand is that the chip reads or writes 8 bytes at a time to a temporary "scratchpad" memory location.

You will need to download and install the OneWire library from the Arduino Playground. There is also some interesting details about the protocol mostly applying to the Dallas temperature sensors.

I've modified the code so you can either read/write 128 characters (bytes in ASCII code), or bits in a 32x32 matrix (an arbitrary layout). By default, the code attempts to talk to the chip, and if communications are established, read the memory.

ADDR= 2D 4E A1 94 B 0 0 61 <br>Reading from EEPROM as chars
0     M71  
1    �     
2   �;;� � 
3  � �     
4  � �     
5  �       
6  �       
9     �� d<
10  M P n  
11 p p � � 
12 //<<    
14      �'�

This looks like scrambled bits, except the "M71" matches the printer model. I assume the rest is information about expiration date and label type.

Now, lets make it our own.

Step 3: Write

If you do not have the wires right, you will get a "No device found". That never happens to me, but try again if you see it.

Here is my attempt at 32x32 bit art. I actually started in Gimp and then wrote a Python script to parse me out some one and zeros.

No device found.<br>No device found.
No device found.
ADDR= 2D 4E A1 94 B 0 0 61 
Writing bits to EEPROM
Reading from EEPROM as bits
0              1 1 1 1 1                     1 1 1 1 1             
1            1 1         1 1             1 1         1 1           
2          1                 1         1                 1         
3        1                     1     1                     1       
4        1                       1 1                       1       
5        1                                                 1       
6      1                                                     1     
7      1                                                     1     
8      1                                                     1     
9    1                                                         1   
10   1                                                         1   
11     1                                                     1     
12     1                                                     1     
13     1                                                     1     
14       1                                                 1       
15       1 1                                             1 1       
16         1                                             1         
17           1                                         1           
18           1 1                                     1 1           
19             1 1                                 1 1             
20               1 1                             1 1               
21                 1 1                         1 1                 
22                   1 1                     1 1                   
23                     1 1                 1 1                     
24                       1                 1                       
25                       1 1             1 1                       
26                         1 1         1 1                         
27                           1         1                           
28                             1     1                             
29                             1     1                             
30                               1 1                               
31                               1 1

Or maybe you are the poetic type . . .

ADDR= 2D 4E A1 94 B 0 0 61 <br>Writing chars to EEPROM
Reading from EEPROM as chars
0  Roses   
1  are red,
2  violets 
3  are blue
4  bits are
5  awesome,
6  and     
7  bytes   
8  are     
9  too!    

Step 4: E-Jewels?

At recent workshop I helped with for, we had them create jewelry out of scrap electronic parts. It was pretty fun, and the girls were very creative. Now that we've got a chip with some meaningful data stored on it, time to make it into something wearable.

I drilled a small hole in the top and put a 6mm ring on it. I also rounded and smoothed the edges a bit. Got to love Dremels! After that, it was earrings or a necklace. None of my favorite ladies have pieced ears, so necklaces it will be.

On the PCB I designed, I created a heart silkscreen pattern for the front, and laid out a large gold pad on the back.

I have a few of these on hand if you have someone who would appreciate this type of geekiness in your life. Head over to Tindie.

Step 5: A "bit" More . . .

I sat down with my granddaughter and helped her code a message for her best friend. Realizing that it was not as easy as it should be (it never is, is it?), I wrote some scripting to help, and so here it is . . .

  1. Use a piece of graph paper or a 32x32 pixel image for the design. I use free, Open Source, GIMP, and if you set the scale to 200, the transparency background squares match the pixel sizes, making it easy to draw or design something.
  2. It needs to be coded to "1"s and "0"s, and doing 1024 by hand is a bit tedious. Free, Open Source Python to the rescue! The attached script will convert the image to text that can be cut-and-pasted into the Arduino script.
  3. And of course, you may not expect the recipient to have the skills to extract the message, so maybe a printout is proof enough!
Tech Contest

Participated in the
Tech Contest

Wear It! Contest

Participated in the
Wear It! Contest

Microcontroller Contest

Participated in the
Microcontroller Contest

1 Person Made This Project!


  • Lamps Challenge

    Lamps Challenge
  • CNC and 3D Printing Contest

    CNC and 3D Printing Contest
  • Puzzles Challenge

    Puzzles Challenge



Question 6 months ago

I am trying to run your script to get to the step where the select menu for deleting read or chip writing options opens but when I select an option nothing happens No error message appears The device is connected to pins A3 A4 and A5 from andurio


Answer 6 months ago

It has been such a long time since I messed with this, and I'm afraid I can't be much help. The one thing you might try is a stronger pull-up, something in the 1K ohm range.


1 year ago

Thank you for the instructable. I have a couple of DS2431s from a Bray printer that I have wanted to repurpose. I slightly modified the code. I used +5V and the Ground pins on the uno vice the analog pins as well as digital pin 12 for the signal pin. It worked great. I am now going to use it to make a poor man's altimeter for my model rocket using an ATTINY85.
Many thanks

Sebastián J. E.L
Sebastián J. E.L

4 years ago

Hi. I dowload the code and i use it in arduino nano. But i cant compile. Give me this

C:\Users\SebastiánJ.E\Downloads\F66LW3QI2KS8NCG\F66LW3QI2KS8NCG.ino: In function 'void loop2()':

F66LW3QI2KS8NCG:129: error: 'SearchAddress' was not declared in this scope

F66LW3QI2KS8NCG:141: error: 'ReadAllMemHex' was not declared in this scope

C:\Users\SebastiánJ.E\Downloads\F66LW3QI2KS8NCG\F66LW3QI2KS8NCG.ino: In function 'void writeString()':

F66LW3QI2KS8NCG:177: error: 'WriteRow' was not declared in this scope

C:\Users\SebastiánJ.E\Downloads\F66LW3QI2KS8NCG\F66LW3QI2KS8NCG.ino: In function 'void writeBitMap(boolean*)':

F66LW3QI2KS8NCG:202: error: 'WriteRow' was not declared in this scope

C:\Users\SebastiánJ.E\Downloads\F66LW3QI2KS8NCG\F66LW3QI2KS8NCG.ino: In function 'void ReadAllMemBits()':

F66LW3QI2KS8NCG:288: error: 'print_binary' was not declared in this scope

C:\Users\SebastiánJ.E\Downloads\F66LW3QI2KS8NCG\F66LW3QI2KS8NCG.ino: In function 'void ReadAllMemHex()':

F66LW3QI2KS8NCG:340: error: 'print_hex' was not declared in this scope

exit status 1

'SearchAddress' was not declared in this scope

Librería inválida encontrada en C:\Program Files (x86)\Arduino\libraries\ArduinoSignalFilteringLibrary: C:\Program Files (x86)\Arduino\libraries\ArduinoSignalFilteringLibrary

Librería inválida encontrada en C:\Program Files (x86)\Arduino\libraries\ArduinoSignalFilteringLibrary: C:\Program Files (x86)\Arduino\libraries\ArduinoSignalFilteringLibrary


7 years ago on Introduction

I'm pretty sure that I have everything set up correctly, however when I run my serial monitor to view what is happening on the EEPROM I don't get any feedback. I downloaded and set up the OneWire library correctly and coppied and pasted your sketch to make sure that everything was working and no matter what I do, nothing happens on my serial monitor. It brings up the programmed menu however whenever a char is imputed nothing happens on the monitor and the RX led on my arduino flashes.

Any ideas?


8 years ago

Nothing better than geeky jewelry! Too bad my girl wouldn't wear it...


Reply 8 years ago on Introduction

That's what I think! Well, Christmas is around the corner. I think I may get her one and see how she likes it.


8 years ago on Introduction

COOL!! but what if we can not get our hands on that chip, what else can we use?


Reply 8 years ago

You could use one of these and have 888 bytes of data permanently within you (and readable by any NFC equipped phone).

Answering the original question, that very URL is what I've stored in mine.


Reply 8 years ago

Wow, that is some "spy-level" geekiness.


Reply 8 years ago on Introduction

Here is same chip in a 3-lead package that would be easy to breadboard: or, you could head over to and I'll sell you one:

Victor Does
Victor Does

8 years ago on Introduction

Wow. Would like to have a necklace like that.. one more project for thous "grey days"!


8 years ago on Introduction

frnds i just make a team for technow and its a COOL group so if u want join our group and want to know more about it