GLCD Serial interface
Moderators: adafruit_support_bill, adafruit

GLCD Serial interface

by pm6041141 on Fri Jun 10, 2011 8:20 am

I am working on a project and trying to use up some parts that I have at the same time. I want to use an Arduino Diecimilia and a graphics LCD from sparkfun part number LCD-00710. link http://www.sparkfun.com/products/710 It uses the KS0108 controller. I found this http://www.arduino.cc/playground/Code/GLCDks0108 in the playground for hooking the two of these together but, the connections to the gLCD plus my other required circuitry total more than the available IO pins on the Arduino. Does anyone know of a project that makes an interface for the gLCD to make it into a serial device so that I can utilize fewer Arduino pins to control the LCD?

Thanks,

Pete
pm6041141
 
Posts: 79
Joined: Thu May 29, 2008 5:26 pm

Re: GLCD Serial interface

by adafruit_support_bill on Fri Jun 10, 2011 9:22 am

The Adafruit I2C/SPI LCD backpack only works with character displays, but the ST7565 graphical LCD display has a serial interface and is very reasonably proced.
User avatar
adafruit_support_bill
 
Posts: 30825
Joined: Sat Feb 07, 2009 10:11 am

Re: GLCD Serial interface

by pm6041141 on Fri Jun 10, 2011 9:31 am

Thanks for the reply. And yes, the serial gLCD you linked to is reasonably priced but, as I stated, I am trying to use up some parts I have on hand so the question is really about an interface board for using the gLCD I have with serial comms. Graphics are not a necessary part of this project and as such I would forgo the gLCD in lieu of a char display I also have on hand if I cant find a solution I am looking for.
pm6041141
 
Posts: 79
Joined: Thu May 29, 2008 5:26 pm

Re: GLCD Serial interface

by stephanie on Fri Jun 10, 2011 10:45 am

There's the option of making your own serial 'backpack' for the GLCD. If you have a spare ATMega328 or maybe even a 168 you could make a sketch that uses the glcd library and accepts data on the serial port then sends it to the display.

I was toying with this idea myself, but in the end I went with an Arduino Mega so I could use the KS0108 and still have plenty of I/O left over.
User avatar
stephanie
 
Posts: 295
Joined: Sat Dec 11, 2010 1:17 am
Location: Canada

Re: GLCD Serial interface

by Dr. Au-fait on Fri Jun 10, 2011 12:34 pm

This would work, but at $14+ship it's cheaper to get another display that supports serial protocols. They don't say it in the description, but the GLCD supported uses the KS0108 controller.
http://www.mikroe.com/eng/products/view/147/serial-lcd-glcd-adapter-board/

I haven't tried the Adafruit item, but these displays look and work great if you don't mind waiting 2-3 weeks to receive it from China. Same issue however on the 1k display buffer since the serial mode is write-only. Somewhere I found some ST7920 sample code for getting it to work with Arduino and it just worked the first time. I was rather shocked about that, but I'm not complaining!

http://www.satistronics.com/128x64-12864-graphic-lcd-module-blue-backlight-st7920_p2618.html

If you want, post up a 64x128 b/w image and I'll take a photo of it for you displayed on the GLCD.
Dr. Au-fait
 
Posts: 73
Joined: Wed Apr 27, 2011 6:17 pm

Re: GLCD Serial interface

by pm6041141 on Fri Jun 10, 2011 1:49 pm

Looks like there are products out there to do what I want but, as the project really doesn't need a graphic display I think I will just use a character LCD instead. It isn't worth it to me to buy an adapter or put the work into developing one for this project. I was hoping to find someone who already made one and published the code etc. Just for fun, I uploaded an image 64x128 if you can put it on a graphic display, Dr. Au-fait I would like to see it for future reference.

Thanks for all the replies,

Pete
Attachments
yamaha_64x128_GS.jpg
yamaha_64x128_GS.jpg (4.33 KiB) Viewed 3902 times
pm6041141
 
Posts: 79
Joined: Thu May 29, 2008 5:26 pm

Re: GLCD Serial interface

by Dr. Au-fait on Sat Jun 11, 2011 11:33 am

Sounds like character LCD is the best way to go, but it will take as many signal lines at the GLCD unless it has serial mode. These from Jameco worked well for me, although the price has gone up a lot. they were $13 when I bought them:

16x2, Serial interface: I2C, SPI, or RS232:
https://www.jameco.com/webapp/wcs/store ... Id=2118651

Your image was grayscale, so it doesn't work without some graphics editing. The GLCDs are on/off and don't have multiple levels per pixel. I found a piece of line art that works and used that instead. Here's the file itself:

mcycle128x64x2.jpg
mcycle128x64x2.jpg (5 KiB) Viewed 3891 times


A couple views on the GLCD. The color balance is a little off - it's actually a really nice deep blue background with high-contrast white pixels.

glcd-front.jpg
glcd-front.jpg (210.99 KiB) Viewed 3891 times

glcd-angle1.jpg
glcd-angle1.jpg (238.33 KiB) Viewed 3891 times


The wiring consists of two signals lines (data and clock), 5V power and common, plus some fixed signals taken from the power connections. The backlight is being powered by 5V through a 100 ohm resistor which at the LED forward voltage amounts to about 25mA as shown.

---
Dr. Au-fait
 
Posts: 73
Joined: Wed Apr 27, 2011 6:17 pm

Re: GLCD Serial interface

by Cherno on Sun Sep 09, 2012 6:24 am

Hi there,
I hope no one will mind if I "revive" this thread. :)

I've got a display identical to the one Dr. Au-fait has shown in the pictures, and I've been trying for more than a year (on and off) to get it working, but I just don't know how to set it up!
I don't even know if the code I've got works, since I can't test it on the display. :cry:

I don't have an Arduino, but the controller I have (one that's been developed by a professor at the univerity I'm studying at) should be compatible with Arduino-code.
I haven't tested it though. Probably because I'm not a big fan of C (I prefer Ada).
I've asked the prof. but I havn't gotten anywhere near a good answer. And since you guy seem to get it working, I really hope I can too, with your help.

When it comes to the pins, I've got quite many...
There's SPI, I2C, UART, digital and analog IO, and 4x motor-controllers (H-bridges). Overall about 60 total (around 18 for power)


If any one can help me, please do!
And if you want to know more about the pins the controller has, please tell me and I'll write them down.

Cheers,
Cherno

Edit: I would prefer having it set-up in serial mode.
Cherno
 
Posts: 11
Joined: Sun Sep 09, 2012 6:01 am

Re: GLCD Serial interface

by Dr. Au-fait on Wed Sep 12, 2012 1:38 am

Do you think it's your code, or the wiring that's the problem?
Dr. Au-fait
 
Posts: 73
Joined: Wed Apr 27, 2011 6:17 pm

Re: GLCD Serial interface

by Cherno on Wed Sep 12, 2012 4:23 pm

Well, since I don't even know if my code works, I'm guessing (or at least starting with) the wiring.
Last time I tried to upload a program to my MPU via the Arduino software, it didn't work (I don't know how to make it work).
But as I said before, I can't see if the code works if the display isn't correctly wired.. :|

I'm pretty new to this and would appreciate any help :)
The only kind of display I've used before, was an 8x2 character, and I don't have one. And graphic ones are more fun.

Cheers,
Cherno
Cherno
 
Posts: 11
Joined: Sun Sep 09, 2012 6:01 am

Re: GLCD Serial interface

by Dr. Au-fait on Wed Sep 12, 2012 9:43 pm

Okay, let's start here: Post a 64x128 black and white bitmap - not grayscale, only black and white. I'll convert it and post some tested and working sample code using that image, along with the library needed for the LCD. Keep in mind that the pixels are negative. A black pixel is on (white on LCD), white is off (blue on LCD).

As to wiring the LCD, this is what the code and library expects. You'll need to convert those pins to the equivalent pins on your device, or modify the library:

Code: Select all | TOGGLE FULL SIZE
LCD      Arduino Duemilanove w/ATMega328
---      -------------------------------
LED-K    GND
LED-A    5V via 100R
RS       5V
RW       9
E        3
PSB      GND


This image:

20120912193517.png
20120912193517.png (915 Bytes) Viewed 2732 times


Produces this output:

glcd-front.jpg
glcd-front.jpg (210.99 KiB) Viewed 2732 times
Dr. Au-fait
 
Posts: 73
Joined: Wed Apr 27, 2011 6:17 pm

Re: GLCD Serial interface

by Dr. Au-fait on Thu Sep 13, 2012 2:14 pm

Just in case your connector isn't labeled the same as mine, here's a detailed photo of the LCD connector:

lcd_128x64_st7920.jpg
lcd_128x64_st7920.jpg (260.07 KiB) Viewed 2711 times
Dr. Au-fait
 
Posts: 73
Joined: Wed Apr 27, 2011 6:17 pm

Re: GLCD Serial interface

by Cherno on Thu Sep 13, 2012 3:57 pm

My LCD looks pretty identical (can't see any difference).
When it comes to the pins on the Arduino, I googled Arduino Duemilanove pinout, but I'm not entirely sure I've got it all right in my head.
So I've got two questions:
Is your Pin 9 a Serial Clock?
And your pin 3 Serial Data or Slave Select?

Or are they something else?

As for the bitmap, I like that bike. :) (A bike would probably be my first choice, or something Tron-related)

Oh, and I forgot to mention, I'm using an ATMega128A. Hope this won't be a problem.


Cheers,
Cherno
Cherno
 
Posts: 11
Joined: Sun Sep 09, 2012 6:01 am

Re: GLCD Serial interface

by Dr. Au-fait on Fri Sep 14, 2012 5:51 am

Okay, we'll go with the bike. It is a nice one - wish I could give credit to someone for it, but the origin is unknown.The sample & library code should be able to answer the other other questions. These files were compiled and tested before attaching, so it should at least work in the case of an Arduino. The library and sample code originated from DFRobot, with some minor modifications by me to fix the library to work on Arduino v1.0.1, fix some English, tighten up some statements, and change the image to the bike.

This is the compiler result on arduino:
Code: Select all | TOGGLE FULL SIZE
Binary sketch size: 3,180 bytes (of a 30,720 byte maximum)


There's one thing I'm unsure of, and that's RS. The library seems to use that as kind of an "LCD Enable" function on the Arduino pin 8. I tried tying it to 5V instead to save pins and it worked fine. Maybe you only need to use the signal line for that in the case of multiple LCDs. Of course if you don't use that signal, the library will need to be modified to prevent it from outputting the Enable signal.

Good luck making it work. I hope you will upload some results and photos of your project for the forum. One thing that would be a nice addition to the library is a function or two for setting pixels individually by x-y or for drawing shapes, even if it's just rectangles for bar graphs, etc. My ambition isn't sufficient to go there yet, but if you make such functions, I'd be happy to use them.
Attachments
GLCDST7920sample.zip
(1.81 KiB) Downloaded 175 times
GLCDSP7920lib.zip
(2.06 KiB) Downloaded 180 times
Dr. Au-fait
 
Posts: 73
Joined: Wed Apr 27, 2011 6:17 pm

Re: GLCD Serial interface

by Cherno on Fri Sep 14, 2012 9:51 am

When I tried to upload it, it tried to compile (as usual) but I got some errors saying
Code: Select all | TOGGLE FULL SIZE
GLCDST7920.cpp: In function 'void setup()':
GLCDST7920:24: error: 'LCDA' was not declared in this scope
GLCDST7920.cpp: In function 'void loop()':
GLCDST7920:30: error: 'LCDA' was not declared in this scope

Am I doing something wrong?
I'm not used to Arduino's software. (I usually write my code in GPS (Gnat Programming Studio). and then use a programmer named "usb_avr_progrmmer_16m".)
It wouldn't surprise me if I'm doing something wrong... :shock:

Just saw that the "LCDA" is in the LCD12864RSPI.cpp file, but why can't it be found/used?


If it is possible, do you have a *.hex-file?

Cheers,
Cherno

Also a small correction on my last post: There are three questions there, not two :)
Cherno
 
Posts: 11
Joined: Sun Sep 09, 2012 6:01 am