Netduino home hardware projects downloads community

Jump to content


Photo

Interfacing with the uLCD-144 mini lcd screen


  • Please log in to reply
15 replies to this topic

#1 bill.french

bill.french

    Advanced Member

  • Members
  • PipPipPip
  • 260 posts
  • LocationPrinceton, NJ

Posted 12 January 2011 - 05:46 PM

I was introduced to this lcd in this thread: http://forums.netdui...ch__1#entry7229 -- and I got it working:

Posted Image

It's a 128x128 1.44" color LCD, with a serial interface and a "graphics processor" attached. Sparkfun has them for about $32. One of the comments from the Sparkfun page:

So let me get this straight. This thing is a color LCD with built in controller, backlight circuitry, microSD socket which is compatible with both low capacity and high capacity cards, AND! it basically has a user programmable microcontroller with 10k of program space and 2 GPIO lines in addition to all the on-board control lines for interfacing with the LCD?


The product pages are here: uLCD-144(GFX)

4D has two versions: GFX and SGC. GFX is basically a "standalone" version, meaning you program the built in controller directly, and can built an interface to whatever you want (netduino, pic, etc -- but you have to write the interface)

SGC is more like a "traditional" serial display, where you send it command like "draw a circle here", "display this text", etc.

At first I thought the difference was actually in the hardware, but it's not: it's just firmware. You can reflash the GFX to the SGC and back without any trouble. You can get the SGC firmware here.

I was able to power, test, flash, and program it using the 3.3v Sparkfun FTDI breakout via a breadboard, in spite of the board requiring 5v. I did have to manually toggle the reset line, but it was flawless, otherwise.

Here is the start of the class I'm building to interface with it:
using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.Netduino;
using System.IO.Ports;

namespace uLCD_144_Test1
{
    class uLCD_144
    {
        public SerialPort _COM2;
        public void init()
        {
            using (OutputPort d4 = new OutputPort(Pins.GPIO_PIN_D4, true))
            {
                d4.Write(false);
                d4.Write(true);
            }
            Thread.Sleep(2000);
            this.write(new byte[] { (byte)0x55 });
        }
        public void drawbitmap(byte[] bmp)
        {
            //2.2.5 Draw Image-Icon - 49hex
            //Command cmd, x, y, width, height, colourMode, pixel1, .. pixelN
            byte[] cmd = new byte[] { (byte)0x49, (byte)0x00, (byte)0x2A, (byte)0x80, (byte)0x28, (byte)0x08 };
            this.write(cmd, false);
            this.write(bmp);
        }

        public void write(byte[] ba, bool pause = true)
        {
            if (this._COM2.IsOpen)
            {
                this._COM2.Write(ba, 0, ba.Length);
                int sleeptime = (ba.Length / 14) + 1;  //(calculate transmission time, at 115200, it can send 14 bytes / ms
                Debug.Print(sleeptime.ToString());
                if (pause)
                {
                    Thread.Sleep(sleeptime);
                }
            }
            else
            {

            }
        }
        public uLCD_144()
        {
            this._COM2 = new SerialPort(SerialPorts.COM2, 115200);
            this._COM2.Open();
            this.init();
        }
    }
}


#2 AlfredBr

AlfredBr

    Advanced Member

  • Members
  • PipPipPip
  • 138 posts
  • LocationConnecticut, USA

Posted 12 January 2011 - 06:06 PM

I was introduced to this lcd in this thread: http://forums.netdui...ch__1#entry7229 -- and I got it working:


Wow! Now I'm getting one! Thanks for the pointer!

#3 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts
  • LocationPA, USA

Posted 12 January 2011 - 08:51 PM

I was actually looking at these guy's products. They look pretty awesome, maybe I'll get one of those. thanks for sharing Bill!
My Blog - Oz's Tutorials and Projects

Twitter - @ozsolutions
Youtube - VCSandARM

#4 freds

freds

    Advanced Member

  • Members
  • PipPipPip
  • 61 posts

Posted 12 January 2011 - 06:08 AM

Wow that looks like a great device, it actually looks like the graphics processor is fairly rich dev enviorment in it self and you can have a fairly complex GUI that is simply images loaded from the SD card. Crap time to make another sparkfun order! Going to have to bookmark this site.

#5 Corey Kosak

Corey Kosak

    Advanced Member

  • Members
  • PipPipPip
  • 276 posts
  • LocationHoboken, NJ

Posted 13 January 2011 - 12:43 PM

That looks cool! But how did you get the netduino icon to appear on the display?

#6 bill.french

bill.french

    Advanced Member

  • Members
  • PipPipPip
  • 260 posts
  • LocationPrinceton, NJ

Posted 13 January 2011 - 01:16 PM

That looks cool! But how did you get the netduino icon to appear on the display?

I was going to post it, but it's huge. I wrote this method (see above):

public void drawbitmap(byte[] bmp)

... and passed it in a static readonly byte array, a trick I learned from your fluent interopt stuff. I modified my c# code generator to do (byte) instead of (short), and had it read from a 8 bit bitmap file i generated from one of the 4D tools. I'll post more of a snippet tonight. I also have text working, but there's lots more work to do -- for instance, feeding it a file off the netduino SD card, or interfacing with the screen's SD card.

#7 Ryan Mick

Ryan Mick

    Advanced Member

  • Members
  • PipPipPip
  • 36 posts
  • LocationSacramento, CA

Posted 19 January 2011 - 09:51 PM

Just received mine today, and cant wait to play with it. Bill, I take it you are running it as an SGC instead of GFX? Also, could you share your connections, I cant see them clearly enough in your image above. I had found (before my laptop took a dump) a library for this on someones website. If I find it again I will post a link here. Thanks!

#8 bill.french

bill.french

    Advanced Member

  • Members
  • PipPipPip
  • 260 posts
  • LocationPrinceton, NJ

Posted 20 January 2011 - 03:15 AM

Hi there. It just needs 5v to the vin, ground, then you hook the tx/rx to the rx/tx on either uart (i used com2 above but have switched to com1 now) and then any io to the reset to be able to reset the device. In the above code I used D4, but have since switched to A5. Edit: and "yes" to the SGC question.

#9 Fred

Fred

    Advanced Member

  • Members
  • PipPipPip
  • 300 posts
  • LocationUK

Posted 20 January 2011 - 07:01 PM

A nice screen and a good price. SKPang in the UK doesn't stock that but has a similar OLED one. It looks even better but a bit pricier - £53.88 incl. tax. Same interface though. I could be tempted...

#10 Jarrod Sinclair

Jarrod Sinclair

    Advanced Member

  • Members
  • PipPipPip
  • 49 posts
  • LocationSF Bay Area, CA

Posted 20 January 2011 - 10:20 PM


It's a 128x128 1.44" color LCD, with a serial interface and a "graphics processor" attached. Sparkfun has them for about $32. One of the comments from the Sparkfun page:

The product pages are here: uLCD-144(GFX)


This is an awsome little display. You can hand off the UI to it and the spit back the "options", "settings" or whatever the user does. Makes addign a UI much simpler. Also since it supports 2 IO to can add your little 5 way switch without sucking up another IO and it uses even less pins then the Nokia 5110. I might just have to get one of these.


So Bill have you become the official un-official driver builder and testing for the netduino? Good job!!!

#11 bill.french

bill.french

    Advanced Member

  • Members
  • PipPipPip
  • 260 posts
  • LocationPrinceton, NJ

Posted 21 January 2011 - 02:18 AM

Yes, it is awesome, but comes with a price -- it's a little pricey, and it is small. It also can generate sound on the other pin. It's crazy. I am building a library to mirror the all the SGC commands, then I'll go from there. Part of me would like to get it to dial out via a modem and connect to a bbs or something. Use lynx to surf the web? LOL

#12 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7165 posts
  • LocationNew York, NY

Posted 21 January 2011 - 03:03 AM

Part of me would like to get it to dial out via a modem and connect to a bbs or something. Use lynx to surf the web? LOL


Oh, I have fond memories of dial-up BBS's. Maybe we could teach a Netduino how to play one of the doors (games)...Barren Realms Elite perhaps? ;)

Chris

#13 GDSever

GDSever

    Advanced Member

  • Members
  • PipPipPip
  • 81 posts
  • LocationNewark, DE

Posted 21 January 2011 - 12:56 PM

I picked up one of these (GFX firmware) but I think I'll actually try using the 4DGL environment to code it rather than switching it over to a serial slave to a Netduino - I have to believe the 4DGL is going to run faster. It also couldn't be too hard to write a serial interface between the 4DGL side and Netduino C# side...

#14 andybareweb

andybareweb

    Member

  • Members
  • PipPip
  • 12 posts

Posted 10 February 2011 - 03:40 PM

Hi, I'm having a little problem with the flashing problem. Probably a misunderstanding on my part. When you said: "I was able to power, test, flash, and program it using the 3.3v Sparkfun FTDI breakout via a breadboard, in spite of the board requiring 5v. I did have to manually toggle the reset line, but it was flawless, otherwise." What did you have to do with the reset line? Thanks Andy

#15 GDSever

GDSever

    Advanced Member

  • Members
  • PipPipPip
  • 81 posts
  • LocationNewark, DE

Posted 10 February 2011 - 04:59 PM


What did you have to do with the reset line?

Thanks
Andy


Communication with the uLCDs requires timing between when the display powers on and when the serial comms begin. You can manually trigger the RST line by having a momentary interrupt between the RESET pin and ground, or what I have found is connecting the Sparkfun FTDI Basic DTS line to RESET takes care of it automatically.

#16 andybareweb

andybareweb

    Member

  • Members
  • PipPip
  • 12 posts

Posted 10 February 2011 - 05:30 PM

Communication with the uLCDs requires timing between when the display powers on and when the serial comms begin. You can manually trigger the RST line by having a momentary interrupt between the RESET pin and ground, or what I have found is connecting the Sparkfun FTDI Basic DTS line to RESET takes care of it automatically.

Great thanks!

I have that breakout board, it has pins for DTR and CTS not connected (after I put in Rx Tx 3v3 and GND).

Edit: The pin to use is DTR, but you must implement this reference circuit: http://4d.websitetoo.../file?id=963864




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2010-2014 Secret Labs LLC  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.