20x4 LCD comms

manie

Senior Member
I notice that LCD's these days communicate via I2C with CLK/DATA. I want just good old Serial.
The OLED, however nice, is just too expensive and therefore I opt for LCD display.

Where can I look for LCD's with SERIAL (not I2C) comms ?

If I use I2C, I will require the device address. What will a command to such an LCD look like, example please..........

Thanks in advance........

EDIT:
I require backlight, so afraid Rev-Ed LCD not suitable.......
 

geoff07

Senior Member
You might also consider inexpensive graphics tft displays. These are available in 320 x 240 px format, a couple of inches across (60mm diagonal). They are driven by SPI, which is like i2c except the chip addressing is done by a chip select pin rather than an address.

I'm working on a driver picaxe (28x2) for these displays, with a built-in 5 x 8 font in a separate eeprom, displayable in 1,2x2, or 4x4 px per dot. It can draw circles and rectangles of any colour, filled or outline. Perhaps it is 80% done. All the bits are working, it is 'just' a matter of finishing the driver code that communicates with the picaxe, via a ring buffer and hserin/out. The command set is as close to the picaxe lcd display set as I can make it, obviously with extra commands (colour, shape and dimensions, positioning addresses etc.).

Happy to share if anyone interested.
 

lbenson

Senior Member
The question is, how do you send commands and text to these I2C LCD devices? Some of them at least have interfaces which are much more complex than sending codes and data via serial. I'd be happy to see examples of straightforward picaxe code which works with them.
 

AllyCat

Senior Member
Hi,

I2C is cheap and plentiful. 0x27 address. $8 USD
Although that listing claims an I2C interface, the picture only shows the normal 8-bit data + control parallel interface. AFAIK a common approach is to add (or have included) a small dedicated "backpack" PCB to either interface via I2C or via serial ("RS232").

The I2C backpacks use an "I2C expander" chip and are very cheap (~$1) so often pre-fitted to the display PCBs (my assembled Blue 20 x 4 display+ I2C backpack cost around £5 from China). However, the expander is mapped with only 4 pins to the data bus, 3 pins for control (clock, enable, etc.) and one pin for the backlight (on/off), so the driver code is not trivial. Significantly more complex than driving directly via a PICaxe parallel port, which in turn is more complex than sending simple ASCII serial commands/characters.

There are threads on this forum describing how to drive the I2C backpacks, but IIRC the novice OP(s) asking for assistance eventually gave up and resorted to the Rev.Ed. serial backpack. The backlight really shouldn't be an issue, just drive it (via a single transistor) from a pin on your main PICaxe, or a spare pin on the 18M2 in the backpack, if you modify its code slightly.

Cheers, Alan.
 

tmfkam

Senior Member
Ron Hackett wrote a serial driver for 'standard' parallel LCD displays, this is listed in his book "PicAxe Microcontroller Projects For The Evil Genius'. Most of the details were also shown in one or more of his articles in Nuts & Volts Magazine. I've modified some of his code myself and use it in all the LCD projects I've made so far, proving it must be easy to follow!

MarkS wrote some code that is listed here on the forum if you wanted to 'roll your own' but don't want to buy Ron's book. http://www.picaxeforum.co.uk/showthread.php?19474-Learning-to-Drive-an-LCD-DISPLAY
 

Goeytex

Senior Member
IF you have access to a PIC Programmer or know someone who does, this might be of interest. I have used it with many of my Picaxe Projects. It uses a PIC12F683 as a driver for any HD44780 / Compatible display. The Serial speed is fixed but can be changed in the ASM code. I changed the ASM code so that the serial speed was 9600. It can be programmed to be anywhere from 9600 to 115200 baud.

http://www.picaxeforum.co.uk/showthread.php?25991-Low-Cost-DYI-quot-1-Wire-quot-Serial-Backpack-57600-bps
 

BeanieBots

Moderator
The easiest (and most support offered here) would be to get the Rev-Ed serial driver http://www.picaxestore.com/index.php/en_gb/picaxe/add-on-modules/axe132.html
and a compatable LCD of your choice.
As pointed out by SAborn, many of the fleaBay offerings are simply mis-leading. Read VERY carefully.
If no datasheet is offered, DO NOT BUY.

Cheap will enevitably end up expensive either because the device is not suitable or will take huge effort to get working.
A ready made product from a reputable company such as Rev-Ed will simply work as is. (but where's the fun in that?)

For example code, have a look at the Rev-Ed product.
 

AllyCat

Senior Member
Hi,

The AXE132 will work with cheep Chinese displays, or construct your own using a 18m2 and the code can be down loaded from picaxe shop.
Agreed. But if I were building my own, I'd use the slightly cheaper and more "modern" 14M2 or 20M2. It will require a little effort to adapt the code, but probably much less than attempting to get an I2C backpack working well from your main processor.

Or an "interesting" project would be an 08M2 which receives commands as if it were an AXE132, but acts as a host to drive an I2C backpack. That could be the "best" solution if the LCD is already supplied with an attached I2C backpack such as this one (see backpack in right-hand photo).

Cheers, Alan.
 

hippy

Technical Support
Staff member
There was considerable thought which went into choosing the 18M2 for the AXE132 backpack.

The advantage of an 18M2 for LCD backpack use is that its B port pins are all on a single port of the PICmicro it is built upon meaning it is slightly quicker in providing 8-bit output signals than other M2 options. The 14M2 also doesn't have a single 8-bit port which means either a slowed down 8-bit write or a double write to LCD for 4-bit mode.

That's not a problem per se in software terms but the extra time taken can affect the responsiveness to serial input which may mean lower baud rates and/or having to split SEROUT commands to it for reliable operation, which will mean slower communications overall.

The same would also apply to any serial-to-I2C interface; the time taken to send the I2C commands will mean it's not immediately ready to receive another serial byte sent to it.

Using an X2 with background receive mitigates a number of the issues but also increases cost.
 

manie

Senior Member
Thanks for all the input here guys...........

What I really want is just a good old SERIAL comms LCD that uses "Serout........." commands to print stuff on the LCD.
I also want backlighting, so where do I look ? At WINSTAR ?? Would love the NICE display offered by OLED but at 20 pound sterling for 20x4 ??

Thanks
 

hippy

Technical Support
Staff member
I also want backlighting, so where do I look ? At WINSTAR ?? Would love the NICE display offered by OLED but at 20 pound sterling for 20x4 ??
Having considered the possible need for a 20x4 OLED display for an up-coming personal project our pricing seemed comparable and even cheaper than from other suppliers, and it includes the serial to display back pack.

As for any component, not stocked or considered too expensive, the only option is to search around and that probably includes looking on ebay as well, weigh up the pro's and con's of each offering and make a decision.

The way I have come to consider components which may seem quite expensive in themselves is to measure their cost against usefulness and/or desirability. A £20 component costed over the expected lifetime of a completed project can put the cost into a better perspective. If you are going to be looking at it and using it every day an outlay which may be higher than desired can still deliver good value for money.
 

BeanieBots

Moderator
I have to agree with hippy.
Have a browse around and you will find that most of the offerings (even FleaBay) offer similar displays for a few pence less but they DO NOT INCLUDE the serial backpack.
For a fair amount of effort, you can build your own and save a pound or even two followed by a few hours on here getting it to work.
The Rev-Ed 4*20 is a really nice unit and it simply works out of the box.
My sole criticism is that the PCB is so much larger than the display it makes mounting difficult, but that is true of almost all displays.
Also, the marketing text is for real. Once you have used OLED, you will never go back to LCD!
 

geoff07

Senior Member
Once you have used OLED, you will never go back to LCD!
Indeed true. But I suspect soon to be superceded by colour graphics, though perhaps not in schools. These are tests from my 28X2 tft graphics backpack (under development). 320 x 240 pixel resolution and addressing. 262k colours! Too slow for video but fine for text and shapes. £4.47 on ebay inc postage for the 2.4 inch version (and that is for the touch screen variant - not currently part of my backpack development).

The backpack includes a 28x2 plus an eeprom for the font so, in total, retail hardware costs of perhaps £12 including board, download socket etc. The host picaxe communicates with the backpack using hserout and very similar commands as per the AXE133.

There is still a way to go to complete it though.

IMGP0059smaller.JPGIMGP0047smaller.JPG
 

manie

Senior Member
True for everything you say but consider the ZAR to Pound exchange rate of 17.80 ! Then a 4 pound or 8 US$ LCD makes a lot of sense quickly.
But, I forgot about the backpack that comes with it, maybe not so bad after all ! I will ponder this a bit more...........
 

hippy

Technical Support
Staff member
I suspect soon to be superceded by colour graphics, though perhaps not in schools.
It's hard to say but could be going that way as reasonably sized colour graphics LCD's are getting cheaper and more readily available. The key is having something low cost, easy to use ( eg, SEROUT serial control ) and being able to reliably deliver such a product to be used.

One problem in the past was that graphic LCD's were all different, had different specifications, pinouts, commands, memory maps. Many were poorly documented or not at all and it was difficult to find the right LCD to use existing driver code and hard to find or write driver code for arbitrary LCD's. It's okay to use any arbitrary LCD in a one-off project but to create a saleable product one needs a long term reliable supplier for what that product uses. For a commercial product designed around a specific LCD that's a lot of wasted effort if the required LCD ceases to be available.

That's not intended to discourage you and it looks like you are doing an excellent job and on a superb journey. Apologies if I missed it or hadn't paid enough attention but do you have other details of your project on the forum or details of the LCD module you are using ? An ebay link would be fine as it makes sense for anyone who wants to build on what you have done to choose the exact same hardware.
 

geoff07

Senior Member
It is my intention to post the details when I have a working backpack, though if anyone is interested now I am happy to share. 'All' I have to do to finish it is to find time to get the command side working with the scratchpad ring buffer with hserin (the scratchpad is shared as it also contains a working copy of the font for speed reasons). Probably a job for the dark evenings that beckon. The ring buffer is necessary to allow a degree of asynchronicity between the tx and rx, the display is quite slow when drawing pixels. The alternative would be flow control per command but that would be clumsy (I will use flow control when the buffer is full).

The module that I am using is identical with this one currently on ebay:

http://www.ebay.co.uk/itm/2-2-Serial-240x320-Chip-SPI-TFT-LCD-Module-Display-ILI9340C-PCB-Adapter-SD-Card-/321417153958?pt=UK_BOI_Electrical_Components_Supplies_ET&hash=item4ad5f48da6

There are many similar products on the site. Prices are falling fast, and now they also have touch screens, e.g.

http://www.ebay.co.uk/itm/240x320-2-4-SPI-TFT-LCD-Touch-Panel-Serial-Port-Module-with-PBC-ILI9341-5V-3-3V-/121414443081?pt=UK_BOI_Electrical_Components_Supplies_ET&hash=item1c44dd6049

I assume that they are from the mobile phone industry. SPI is very easy to control, the eeprom and the lcd share the same pins with separate CS lines.

The ILI9341 driver chip is microscopic and (I think) embedded in the flexible PCB that connects the display to the carrier board. The main learning curve item is understanding how it is best controlled. There are a few other such chips which are, as you say, not compatible. But this driver does seem to be extremely well documented now (the data sheet runs to 240 pages, nearly as complex as a PIC), though there are few usage examples around so it is a bit of a voyage of discovery. In fact there is only one library I have come across (widely copied) and that is very simple (i.e. does not use what I assume is the real power of the device) and is in C (and thus a real fiddle). If anyone is an expert on the ILI9341 family, then guidance on how to speed up writing would be useful! For example, I would expect to see a clear screen primitive, but so far the best I can do is write every pixel.
 
Top