Monthly Archives: November 2010

A Smarter Display

Connecting display to Arduino can be expensive, complicated and unsatisfying. The smartlcd attempts to make it cheaper, simpler and more fun.
 
There are lots of interesting displays hiding in cell phones, cameras, mp3 players and various other devices. In this post we will be looking at two of my non-Nokia favorites: The iPod Nano 2G display and the so called “cheapest TFT in the world”. Then we will be making a gadget that hopefully does something useful with them.

To repurpose a display we need to determine its interface mode (serial/parallel), pinout and driver ic. If the display has a nice part number printed on the side then you might get lucky and have the interwebs answer all your questions. Much more often than not you have to do it the hard way.

Count the number of pins on the connector. If there are 8-16 pins it is almost certainly a 8 or 9 bit spi interface. Find the LED supply pins (almost always the thickest traces on the flex) and give them the respect their elevated voltages deserve. Attach a logic analyzer to a live system determine the spi clk (wiggles most), the spi mosi (wiggles second most), the spi select and the reset (wiggles once). See this example.

If you have 20 or more pins you have an 8 bit parallel interface. If you have 24 or more chances are it is 16 bit parallel. Many displays have the ability to run in both serial and parallel modes that can be selected with one or more external pins. If you are short of GPIOs this is a good option.

iPod Nano 2G
The iPod Nano 2G has a lovely little 22 pin transflective 176×132 screen. It has a 0.3mm pitch connector as seen in the iFixit tear-down. Nearly all 0.3mm ffc connectors have an odd number of pins. Apple thought different and used a DDK FF12 that is very hard to come by. After buying lots of replacement LCDs ($5 ebay + many $1 auction wins) and lots of dead/dying nano2Gs it was time bust out the fine transformer winding wire and a logic analyzer.
 

The data bus is easy to find: look for 8 consecutive bits that change all at the same time. The WR, CS and CD signals are then fairly easy to spot based on decreasing activity. As it turns out there are at least two different driver ics in these screens: A narrow one that looks a lot like a ILI9163 (8 bit wide commands, sets up blits with 0x2C) and wide one that looks a lot like an ILI9320 (16 bit commands, sets up blits with 0x22).
 

Although these controllers are similar to documented controllers they still have major differences and I needed to record an initialization sequence from a live boot in order to get them to work.

Connector pinout Nano 2G
        1        LED+ 6V
        2        LED-
        3        Frame Marker
        4        GND
        5        D7
        6        D6
        7        D5
        8        D4
        9        D3
        10        D2
        11        D1
        12        D0
        13        RD        Read
        14        WR        Write
        15        CD        Command/Data
        16        CS        Chip Select
        17        Reset
        18        GND
        19        VIO        3V3
        20        VDD        3V0
        21        ID0 
        22        ID1
Preview of an upcoming project using iPod Nano 2G screens:
The TFT 20
If one dismembers enough mp3 players one starts to notice patterns of part usage. One display caught my eye: it was very common in cheap 128×160 mp3 players, was a crisp and high contrast TFT, and had a hot bar solder connector that looked like it could be soldered by humans.

After dismembering a very nice Insignia digital photo keyframe and applying the logic analyzer the traces look very familiar. It was a ILI9163. Other devices turned up a ILI9161 and a Samsung S6D0144. All variants seem to have a very similar physical outline; another defacto standard like the touchscreen used in microtouch.They are widely available in China for $2 making them the cheapest TFT going.

So how can we make this lovely little screen useful to say an Arduino enthusiast? It needs 3v3 io on 14 pins connected to a 1mm pitch hot bar solder connector, a 6v boost converter to supply the leds, drivers, apis etc to make it useful. Not the simplest thing to do on a breadboard.
Thats where smartlcd comes in.
 
smartlcd 
 

The smartlcd adds intelligence to a TFT 20 display. An inexpensive Arm Cortex M0 or M3 microcontroller is used to provide graphics and media processing as well as providing a high speed serial interface the 3v3 display. With additional components the smartlcd can offer a spi-flash or microSD file system and usb. One single pcb scales from bare bones serial through to a stand alone lipo battery powered device.
A minimal configuration with just the backlight boost converter and serial interface:
2010-10-18_0002

smartlcd uses a serial link to connect to Arduino and other devices The serial link runs a slip framed, software flow controlled RPC at 1MBit. 5v to 3v3 level conversion is not necessary; the smartlcd inputs are 5v tolerant and can plug directly into the Arduino RX and TX pins. Because it is connected to the serial interface, the smartlcd can reprogram the Arduino and under the right circumstances the Arduino can be reprogram the smartlcd. The smartlcd can also be configured to be reprogrammed via USB and you don’t have to know anything about arm or own a arm development kit to build one.
Img_6286

The client does not have to be a Arduino; the smartlcd can connect to virtually any serial device or USB. However smartlcd makes it very easy to display text, graph values and draw graphics quickly on Arduino:
// Console demo
        int a[2];
        a[0] = analogRead(A0);
        a[1] = analogRead(A1);
        if (_mode == 0)
                Console.Write("X:%d Y:%dn",a[0],a[1]);
        else
                Console.Graph(0,1023UL,a,2);

        // Circle demo
        int x = random(128);
        int y = random(160);
        int r = random(70);
        int c = random(0xFFFFL);
        Graphics.Circle(x,y,r,c,1);

Fully loaded versions of smartlcd can decode JPEG, PNG and will be able to decode some forms of video. Source code, schematics and Eagle files: https://sourceforge.net/projects/smartlcd/.

Until next time