Serial i2c interface for LCD

westaust55

Moderator
Firstly, there is no need to "bump" or generate a duplicate thread after just an hour from the first post.
Accordingly, I have merged your two threads into one.

In response to your question, in simple terms. YES, these can be used with the PICAXE parts.

However, you need the schematic and i2c slave address for the particular module as there are several variants being sold on Ebay and other on-line sources. I note that the Ebay itme you linked to has "i2c Address Changeable".
There are typically libraries for the arduino microcontrollers but you will need to generate your own PICAXE based library specific to the i2c interface board that you buy.

There are numerous threads on the PICAXE forum pertaining to similar i2c based LCD interface boards where the purchasers have posted with questions seeking help to get the particular variant they have purchased operating.

Creating your own subroutine (= library) is somewhat more complex that just using SEROUT with the AXE033 or AXE133 LCD/OLED modules.
More like driving an LCD/OLED with a 4-bit or 8-bit parallel interface. Both require your additional code which takes up program space

EDIT:
Below is a few of the past threads in the same vein:
http://www.picaxeforum.co.uk/showthread.php?27134-LCD-1602-and-i2c
http://www.picaxeforum.co.uk/showthread.php?28124-I2C-display
http://www.picaxeforum.co.uk/showthread.php?23471-Picaxe-18M2-and-I2C-LCD-16x2-display
http://www.picaxeforum.co.uk/showthread.php?21872-Using-Arduino-IIC-I2C-Serial-3-2-quot-LCD-2004-Module-Display
http://www.picaxeforum.co.uk/showthread.php?27135-LCD-1602-et-i2c

From the links in the first post for the last given link above, and the images of the actual interface board it seems the same board and using a PCF8574T chip as the i2c to parallel interface.
 
Last edited:

neiltechspec

Senior Member
Why bother with i2c for an ASCII LCD display ?

i2c - Gnd, +ve, SDA, SCL = 4 wires. Complex to drive, 2 x I/O ports.

serial - Gnd , +ve, Data = 3 wires. Simple to drive, 1 x I/O port.

Neil.
 

nick12ab

Senior Member
Why bother with i2c for an ASCII LCD display ?

i2c - Gnd, +ve, SDA, SCL = 4 wires. Complex to drive, 2 x I/O ports.

serial - Gnd , +ve, Data = 3 wires. Simple to drive, 1 x I/O port.
If you're using another I2C device anyway, the I2C display does not take up any more pins, whereas the serial one will still take up a pin.

The eBay I2C displays are complex to drive and are intended for a certain platform which uses a certain programming language which has functions with parameters, "objects", classes etc. which means the 'library' hides the complexity, can effortlessly be dropped in and in fact programs can be converted from using the parallel interface library to the I2C interface library with almost no work whatsoever. Plus, a display can be added to a project for that platform without taking up any extra I/O (as with PICAXE) if you're already using I2C devices.

An easier solution for PICAXE is to use an AXE033 in I2C mode, though this attracts a price premium.
 

jproehl

New Member
My apologies. I didn't intend to "bump" the post. I clicked on the "Post" button and then went away to do some other things. When I came back the thread entry page was still open like it hadn't gone through. I live in a rural area with flaky internet service and thought that my first click had failed to post the message. So I tried again. When I saw that it had been posted and I had just re-posted it, I sent an immediate message to the Administrator asking them to delete my second erroneous post. Sorry. I fully expect that any post I put up will not necessarily be answered for a day or so.
 

paco556

New Member
explain with sample code, that shoes more than writing

Why bother with i2c for an ASCII LCD display ?

i2c - Gnd, +ve, SDA, SCL = 4 wires. Complex to drive, 2 x I/O ports.

serial - Gnd , +ve, Data = 3 wires. Simple to drive, 1 x I/O port.

Neil.
explain with code sample please think is better (lot of "newbis" trying to understand)
 

inglewoodpete

Senior Member
This is a very old thread and some of the members who originally posted may not be monitoring the forum.

The best answer to your question is probably in post #4 from nick12ab.

i2c is a "bus" which can connect to several slave devices, each device having a unique address. So only two pins are needed, SDA and SCL, to communicate with multiple slave chips. Eg. Clock chip, LCD, EEPROM memory chip, temperature or humidity sensors. It would be too complicated to provide an example off the cuff.
 

hippy

Technical Support
Staff member
There are a number of examples on the forum of how to drive an I2C LCD but the main problem is that the actual code required will depend upon which I2C device is used to provide the interface and how that is wired to a particular LCD. Unless using a board which has code written for it then the example code will have to be tailored to suit the board.

Using serial LCD's and OLED's, such as the AXE033, AXE133 and AXE133Y, is described in their respective datasheets.

What I believe neiltechspec was rhetorically asking is why anyone would use I2C which requires two output pins, four wires of interfacing in total, when serial only requires one output pin and three wires.

In addition the I2C interfacing software is likely to be more complex, more difficult to use, and potentially slower to execute than when using a serial LCD or OLED.
 

mikeyBoo

Senior Member
Some food for thought

I don't see why most any Picaxe (except 08) couldn't be used to make a fast I2C OLED driver. Would keep all the software simple.

Anyone interested, take a look at attached .pdf.

Could be a good idea or I may be full of what the dog left in the yard.
Anyhow, food for thought.

If it wouldn't work, let me know why. It's on my to-do-list, but pretty far down.
 

Attachments

techElder

Well-known member
Here's some food for your thought, too. I've read into your project document, and it occurs to me from reading that you might not know just how i2c transfers work.

There's no need for "other" RAM devices, an X2 device already has RAM for i2c.

Seems like others above haven't hit on this detail so, here's a quote from the PICAXE manual 2, "hi2csetup - slave mode (X2 parts only)", page 79 of 279:

When in slave mode all i2c functions of the slave PICAXE chip are completely automatic. An i2c master can read or write to the slave PICAXE chip as if it was a 128 (X1, 20X2) or 256 (X2) byte 24LCxx series EEPROM, with the scratchpad area acting as the memory transfer area.
I've used this process in an 8x8 matrix dual display with a 20X2 in control with i2c.
 

mikeyBoo

Senior Member
here we go again...

Tex, I try to be nice to everybody, but you really try my patience.
Once again, you make an obnoxious, negative comment without having a clue what you’re talking about.
I know exactly how I2C transfers work, you don’t need to be insulting.

I don’t mind criticism (that’s how we learn) so instead of being obnoxious, why don’t you explain why my idea won’t work? Well?

If you really did read the attached .pdf, what part of “ANY Picaxe chip” did you not understand?
The proposed design is meant to work with ANY Picaxe chip or ANY Arduino, Pi (whatever). NOT just an X2. The whole point is ANY.

Since you can’t seem to get on my wavelength, why not just ignore my posts?
 

newplumber

Senior Member
Hey we got to work together here ... we need mikeyboo and we need texasclodhopper and we NEED ME! (patty my back) .....cause
someone has to be the test wrongly janitor :)
 

hippy

Technical Support
Staff member
I don't see why most any Picaxe (except 08) couldn't be used to make a fast I2C OLED driver. Would keep all the software simple.

Anyone interested, take a look at attached .pdf.

Could be a good idea or I may be full of what the dog left in the yard.
Anyhow, food for thought.
It took me a while to grasp what you seem to be proposing and I think what you are saying is that the master PICAXE can dump what it wants on an LCD into an I2C RAM of some kind, a second PICAXE can pick that up and transfer it to the actual LCD display.

That should work but I am not sure how much speedier it would actually be than other alternatives and, as pointed out, an X2 can operate as an I2C slave and cut out the middleman requirement of additional I2C RAM, or could use HSERIN background receive to avoid the complexities of having to use I2C at all.

While the idea is valid and would work for any PICAXE on the LCD driver side it would be most appropriate for non-X2 devices. The question then would be whether it would be better and cheaper to use a non-X2 and I2C RAM or simply choose an X2. That would probably depend on whether the I2C RAM already exists in the project.

There is always more than one way to skin a cat and it's an interesting approach to off-loading LCD interfacing.
 

mikeyBoo

Senior Member
yep Hippy, you get it!

I just posted the idea to see if it had any flaws or if anyone could improve on it. It’s just a very simple I2C bus handoff.
Of course, using X2s we could use the same basic method without the I2C handoff, but I wanted a method that would work with any Picaxe chip (e.g.I like to use 08M2s & 20M2s).

The I2C handoff memory could be an X2, clock chip, even a big RAM (may wanna’ send the slave(s) a waveform or IR code sequence).

The I2C memory is simply a high-speed receive buffer (100KHz bit rate vs 2400bps) to save time for the master.
Nothing fancy, just a way to speed things up.
I’ll post it as a project when I get around to building it. The proof is always in the workability.

1-to-8 I2C Multiplexer* (another way to skin the cat)
https://learn.adafruit.com/adafruit-tca9548a-1-to-8-i2c-multiplexer-breakout/overview

Y’all have a fun day!
 

inglewoodpete

Senior Member
...an X2 can operate as an I2C slave and cut out the middleman requirement of additional I2C RAM, or could use HSERIN background receive to avoid the complexities of having to use I2C at all.
A few years ago I published a working solution using a 20X2 in this forum's Completed Projects. It combined code for an OLED driver (could be altered slightly for an LCD) that could accept hSerial, i2c command mode (ie. like hSerial) and Memory Mapped i2c. In full flight, it can update a full 16 x 2 OLED/LCD screen in under 20mS using a 4-bit data interface bus.
 

mikeyBoo

Senior Member
thanks Pete,
That should really help! If I use your code, I'll give credit in the project.
If I use your project verbatim, thanks in advance!
Now that's working together. Thanks, guys.
 
Top