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

 

57 thoughts on “A Smarter Display

  1. g3m

    Nice little gadget indeed. This would be a cheap and easy way to add a display to my existing projects targeting 8 bit MCUs, without sacrificing too much CPU time. They usually already have a free UART that I use for debugging/PC communication.

    However, I’m at a loss for where to locate those “$2 LCDs”. I’ve already checked the Chinese ebay stores i know about, but with no success. Some pointers on how to get hold of some of those TFTs would be greatly appreciated.

    Reply
  2. rossum

    @no0x The CY7C68013A board looks fun and cheap and would certainly do the job although I really like supporting Saleae; it is more expensive but a nicer build and he did go to the trouble of writing pretty software.

    Reply
  3. rossum

    @g3m Grab a friend who speaks mandarin and try taobao.com. We should encourage local folks like adafruit to stock these.

    Reply
  4. Anonymous

    I’d really like to follow this. Project. Do you have twitter? I’d love BOM w/ suppliers. Sign me up! I’m ready to buy! This is great! Exactly what i’ve been waiting for! Hats off to you.

    Reply
  5. Anonymous

    Any plans to offer this for sale as a kit or finished board? I’d love to have a few boards made and give it a try, but my SMD soldering skills are going to make parts of it a real challenge.

    Reply
  6. rossum

    @Matt Don’t fear the SMD soldering! It is so much fun. With the right application of flux it is easier and faster than thru hole. No flipping the board over and chasing components that fall out, just the joy of flux and fluid dynamics.

    Reply
  7. Anonymous

    Above you say that you found different controllers in different LCDs from the different products. They were: ILI9163, ILI9161 and Samsung S6D0144. Does the project function with LCDs with all of these controllers? For instance the one you linked above that is a 20 pin, is the S6D0144, even though the TFT20.cpp seems to be calling the routines for ILI9163, will it still work? I am reaching out to my contacts in China to find a source for these and want to make sure I have all the facts before I order a bunch of them.

    Reply
  8. rossum

    @Curtis The S6D0144 driver will be posted soon. I will also support the HX8309/HX8310 as soon as I can verify the driver with actual parts.

    Reply
  9. colinb

    @rossum What is your SMD soldering process, specifically? You mention flux, but do you mean flux paste with solder balls, or plain flux? Do you use a reflow oven or all soldering by hand? All the SMD soldering I have done has been soldering by hand; for many-pin packages like SOIC or QFP I apply solder to all the pins and use solder wick to remove the excess and fix bridges. I have a hot air feature on my soldering station but have only used it so far to fix a BGA on my old HP LaserJet’s JetDirect card, not for any new construction.

    Reply
  10. colinb

    @rossum Thanks for the video link. Is it critical to have a beveled soldering iron tip? The only tips I have are conical fine points. What type of flux do you use (water based, no clean, …) and do you use a pen or a syringe to apply it? Thanks.

    Reply
  11. rossum

    @colinb Get a bevel tip; a tiny conical tip won’t carry any solder and is useless for SMD work. I generally use ‘no-clean’ flux from a syringe (which I clean with alcohol). Pens work too but I tend to leave the caps off.

    Reply
  12. Anonymous

    rossum is right about the beveled (also known as a chisel or hoof) tip. The large round surface draws the solder and allows a wave formation as the tip moves along the leads. But be careful of the “no-clean” flux designation. Many flux manufacturers call fluxes “no-clean” when they are actually only low solids (rosin, or whatever material is being used to cover the parts during soldering). The critical consideration for flux selection should be acidity (sometimes known as “activity”); too much acidity will cause post-soldering reliability problems.

    I write about these sorts of topics pretty regularly at http://blog.emsciences.com. You should find some items of interest there.

    Reply
  13. Anonymous

    @Ramon Yes, I am still searching for a source for these modules, when I find them, I’ll probably order a bunch and put them up in my online store. I have been in contact with one manufacturer and they are end of life and have not heard back from a 2nd I found. I have also reached out to a contact I have in China to have him look in the market for them.

    @rossum, The one mfg said they are replacing the TFT20 with a 1.77″, 33pin, HX8353D controller IC. Looks like 12 of the pins are NC which is odd unless they are trying to fit an existing standard. I’m thinking that all that would need to be changed out on the board is the larger connector. Not sure how hand solderable they are. That touchscreen looks really interesting as well as support for other larger LCDs.

    Reply
  14. rossum

    @Curtis The S6D0144 driver works but this 36 pin / 1mm pitch board is a little problematic: the connector is wider than the current PCB. Do you have a physical spec for these?

    Reply
  15. Anonymous

    @rossum, I am working on getting the datasheet now. I can do the board re-design for these LCDs and the larger pinout. I plan on getting some PCBs made at the same time to go with these (and 2 others), so that isn’t a problem. Any chance we can start a dialog via email. I’d like to help build a BOM for this board, but there are a few items I’m not exactly sure what they are or what the values are. My email is cpope at wingsnwakes dot com.

    Reply
  16. Anonymous

    @rossum, just got the datasheet and found out why it doesn’t make sense. The pitch is actually 0.9mm not 1mm as in the ad. It should just fit now. There is another 1.8″ lcd with a 1mm pitch, 27 pin, HX8310 but says 16-bit interface. I’ll get the datasheet on this one too. http://item.taobao.com/item.htm?id=7521751367 Should it work?

    Reply
  17. Anonymous

    I have 2 of these, I hope I can use them on your board too I really can’t wait any longer to get my hands on one of your boards!! 🙂

    Reply
  18. Anonymous

    @ramon, You can get them from Mouser or Digikey. The picture at mouser is wrong, but it is the right package LQFP48. Here are both links:

    http://www.mouser.com/ProductDetail/NXP/LPC1114FBD48-3011/?qs=P1eGD%2f8NI1owlXN%2fIUm%252bgQ%3d%3d

    http://search.digikey.com/scripts/DkSearch/dksus.dll?site=us&lang=en&mpart=LPC1114FBD48%2f301%2c1

    There are other retailers…for the complete list with stock, see here:

    http://www.nxp.com/#/page/content=%5Bf=/dynamic/orderportal/tid-50809_sid-71391/data.xml%5D and search for 935290789151 on the page.

    Reply
  19. Anonymous

    Do you have (or plan to have) an online store where you sell your the things you develop- getting them as kits would be awesome !

    I know many folks in my hobby club would be interested in buying

    Reply
  20. Anonymous

    @Curtis Thanks I did check the nxp page indeed and I checked mouser, but I live in the Netherlands and I have no order that is going to exceed $75 so the shipping costs would me huge! Thanks for the response!

    Reply
  21. Anonymous

    rossum, you are awesome !
    If someone needs it, I made a project on mouser with all the components (apart from the LCD), I’m not quite sure about a few components (like the inductor) so if you could check it and see that I made no mistake
    http://www.mouser.com/ProjectManager/ProjectDetail.aspx?AccessID=d9b3cef564

    I have a question though : you say that we don’t need a special programmer for the Cortex. Do you program it using the USB port or directly via the Arduino ? That’s a bit not clear, but I guess I’ll have to dig into the code.

    Reply
  22. Anonymous

    @catblack, I would consider putting together a kit of at least an LCD and a PCB if rossum wouldn’t mind. That combined with a BOM from mouser would be pretty much all you’d need. Rossum, what do you think?

    Reply
  23. rossum

    @Kamel Thanks for putting together the BOM. There are a few errors that are my fault: It needs a 12Mhz crystal for USB (no crystal required for serial) and a 100uh power inductor for the boost circuit. I will make a couple of mouser BOMs for the different configurations.
    You won’t need a special programmer for the Cortex, it can be done by the Arduino hardware or a serial cable. I will post an application that flashes the device in the next week or so.

    Reply
  24. rossum

    Agreed. MCP73831/2s are only slightly more expensive and have a nice STAT pin to indicate termination; kit versions of the smartLCD use these.

    Reply

Leave a reply to Anonymous Cancel reply