Saturday, 4 October 2008

Hacking the Esquire cover e-ink screen with the Arduino




















Last month, Esquire magazine published a cover that contained an E-ink screen. I was really looking forward to it, actually... so much so that I marked it in my calendar to make sure I picked one up around the corner. There was quite a bit of hype about it, and a lot of people wrote about it on their blogs and websites, and Esquire even encouraged hackers (does that include me?) to play around with the screen. The local store had a couple of copies left over this past week, so I grabbed one, and decided to see what I could do in a couple hours of playing around.








































Of course the first thing I did was rip off the cover:






















I noticed that the cover was a folded-over piece of card stock, so I pried it open:






















The funny part was that it kept on blinking even as I took it apart... felt a bit like the scene in 2001 A Space Odyssey when the guy unplugs Hal:






















This is the back-side of the device:






















And this is what the front side of the PCB board looks like. The components have been identified on other sites, but suffice to say there are a lot of batteries, two shift registers, and a small PIC chip that runs the program.











































I knew within a few minutes of looking at the board that I could either approach this one of 3 ways:

1-Hack the PIC chip, perhaps by reprogramming it
2-Hack into the shift registers, by cutting the input line, and taking them over... but what if they're held in some level by the PIC chip, and there's a via under the chip that I miss?
3-Hack directly into the screen (hoping that there protocol and voltage isn't too difficult to work with, and that I can safely bypass the rest of the circuit with little to no consequences).

I chose method 3, because it seemed like the most straightforward, and the one I could probably get right on the first try. The cable to the screen had 12 wires, and the PCB had resistors lined up in two rows after the connector. I soldered solid-core wire directly onto the small round pads the PCB designers left for me (thanks, guys!), in perhaps the world's sloppiest, hackiest, and odd-looking design ever. Actually, I took a perspective photo of it below, and I think it came out pretty nice!






































I connected the wires from the PCB onto a white mini-protoboard - mainly because of the fragile nature of the PCB-solid core soldering job I did. Even a small jostle would disconnect the wires from the PCB, and I knew I'd be rearranging the wires quite a bit as I discovered which lead was ground, or how they were wired up. I tried a few configurations, including assuming ground was in the middle, far right, or far left of the connector. I found that by applying +5 to one lead, and 0 GND to the ground pin, I could turn a segment on. Then, I found that by applying 0 GND to the lead, and +5 to the ground pin, I could turn the segment back off. This is the same as saying the screen accepts +5 to -5 voltage as it's range, where +5 turns it on, and -5 turns it off. Ugh. That means it'll be a little tricky to work with, but I've seen worse!



















































Ok, so I was fairly proud of my soldering job, so here's another shot of the wires:




















I connected the ground pin to the Arduino pin number 2, and all of the other pins on the first row to Arduino pins 3-7, and the second row from 8-13. I wrote a small piece of code to turn the pins on and off:

void turnon(int pin) {
digitalWrite(2, LOW);
digitalWrite(pin, HIGH);
}

void turnoff(int pin) {
digitalWrite(2, HIGH);
digitalWrite(pin, LOW);
}

After a little experimenting, I mapped each of the connector wires to the segments on the screen:

pinMode(3, OUTPUT); // the 21st century
pinMode(4, OUTPUT); // now
pinMode(5, OUTPUT); // right bar
pinMode(6, OUTPUT); // center bar
pinMode(7, OUTPUT); // boxes around now
pinMode(8, OUTPUT); // right box
pinMode(9, OUTPUT); // background
pinMode(10, OUTPUT); // begins
pinMode(11, OUTPUT); // left box
pinMode(12, OUTPUT); // left bar
pinMode(13, OUTPUT); // middle box

And of course as soon as that was done, I was ready to go... I wrote a small night rider script, and then rewrote it to run on a black background:

void barnightrider( void) {
turnoff(5);
delay(t);
turnon(12);
delay(t);
turnoff(12);
delay(t);
turnon(6);
delay(t);
turnoff(6);
delay(t);
turnon(5);
delay(t);
}


void barnightriderblack( void) {
allon();
delay(t);

turnon(5);
delay(t);
turnoff(12);
delay(t);
turnon(12);
delay(t);
turnoff(6);
delay(t);
turnon(6);
delay(t);
turnoff(5);
delay(t);
}


And then I played around with the text code segments:

void centurynowcycleblack(void) {
allon();
delay(t);

turnoff(3);
delay(t);
turnoff(10);
delay(t);
turnoff(4);
delay(t);
turnon(3);
delay(t);
turnon(10);
delay(t);
turnon(4);
delay(t);

turnoff(4);
delay(t);
turnoff(10);
delay(t);
turnoff(3);
delay(t);
turnon(4);
delay(t);
turnon(10);
delay(t);
turnon(3);
delay(t);
}

Finally, I put all the scripts into functions, and combined the functions to run a little version of the playback demo:



Probably the coolest part of all, though, is the fact that when you unplug the Arduino from power, the E-ink screen stays lit or programmed with whatever was on the screen at the time it was unplugged... cool!






















A final suggestion for the next time Esquire does this... please give us a dot-matrix version, with individually addressable pixels. If you do, I promise I'll hack it, and make it available to everyone to code, and I think that'll pretty much guarentee that I'll buy about 10 magazines just for myself :)

I've uploaded all the source code over at www.liquidware.org. Have fun!

0 comments:

Post a Comment