Welcome! Log In Create A New Profile

Advanced

P018 I2C 16x2 LCD Arduino Code

Posted by F1p 
F1p
P018 I2C 16x2 LCD Arduino Code
December 25, 2013 08:52PM
Is there any arduino library or example code for the I2C P018 LCD chip and RGB 16x2 LCD?



Edited 1 time(s). Last edit at 12/25/2013 08:52PM by F1p.
F1p
Re: P018 I2C 16x2 LCD Arduino Code
December 27, 2013 08:40PM
So i got the RGB LED's working, with the following:


#include "Wire.h"

void setup()
{
  Wire.begin();

  Wire.beginTransmission(0x38);
  Wire.write(1);
  Wire.write(0);   //Red
  Wire.write(10); //Green
  Wire.write(0);   //Blue
  Wire.endTransmission(); 
  
}


Although no luck with any text/cursor etc on the screen with a similar code:


#include "Wire.h"

void setup()
{
  Wire.begin();

  Wire.beginTransmission(0x38);
  Wire.write(3);  // Print A
  Wire.write(65);
  Wire.write(13);
  Wire.endTransmission(); 
}



Edited 3 time(s). Last edit at 12/28/2013 03:51PM by F1p.
Re: P018 I2C 16x2 LCD Arduino Code
December 28, 2013 05:58PM
Well I was hoping that somebody would write some Adruino libraries for this device, however nothing so far so I have done it.

There are two libraries:
P017 - for the serial controller
P017 - for the I2c controller

Both can be found In the documentation.

This is an example from the P018 sketch:
// Example of how to use the LCD library with the P018.
// P017 - serial LCD controller IC
// P018 - I2C controller IC
#include <Wire.h>
#include <p018.h> // defines LCD

// These are the A pins
// A5 = SCL
// A4 = SDA

// constructor defines pins and the address of the device
// in this case 'p'
LCD disp(0x38);

void setup()  {
}

void loop() 
{
// example of custom charatcers
char custom0[]={4,10,21,4,4,4,4,4}; // up arrow
char custom1[]={0,0,1,2,20,8,0,0}; // tick
  // example of defining above custom characters
  disp.lcd_defcust(0,custom0);
  disp.lcd_defcust(1,custom1);
  
  disp.lcd_cls(); // clear display
  disp.lcd_print("First Line");
  disp.lcd_rowcol(1,0);
  disp.lcd_print("Second Line:");
  disp.lcd_print(77); // prints a number
  disp.lcd_printcust(1); // print a tick
  delay(2000);

  // now go through some back light colours
  while(1) {
    disp.lcd_cls();
    disp.lcd_bl(10,0,0);
    disp.lcd_print("Red");
    delay(1500);
    disp.lcd_cls();
    disp.lcd_bl(0,10,0);
    disp.lcd_print("Green");
    delay(1500);
    disp.lcd_cls();
    disp.lcd_bl(0,0,10);
    disp.lcd_print("Blue");
    delay(1500);
  }
}


F1p
Re: P018 I2C 16x2 LCD Arduino Code
December 28, 2013 06:50PM
Hi Jim,

Thanks very much for this, greatly appreciated.

I got this as an xmas pressy from your eBay shop...
The Screen is still absolutely blank though!!
The backlight is changing colour as expected.


Any possible suggestions for the problem??

Regards,
Philip
F1p
Re: P018 I2C 16x2 LCD Arduino Code
December 28, 2013 09:47PM
More information to help with the problem:

Arduino Version: 1.0.1 (Stable)
Code: I2C library as above.


Hardware supplied:
PO18 I2C Chip + Holder - Orientation correct
100kOhm resistor (measured at 97.6k)
Contrast Pot (0 to 840ohm) - set in the middle
SCL/GND/SDA/5 Pin header
EGO 1602RGB LCD + 18 way pin header

Pin 1 on the ByVac PCB Driver connected to Pin 1 on the LCD, and 18 to 18.

The driver PCB has been low mounted on the back of the LCD (Due to the project) - one screen mounts (Black clip has been cut and the other is high enough to clear the PCB on the back - no Short Circuit, verified)


YouTube Video (http://www.youtube.com/watch?v=Dwpk-_bLC2E) shows the problem & PCB mounting etc.






Edited 2 time(s). Last edit at 12/28/2013 09:59PM by F1p.
Re: P018 I2C 16x2 LCD Arduino Code
December 29, 2013 10:49AM
Thanks for the detailed explanation.

A couple of things spring to mind:
1) We can safely say that the I2C communication is okay otherwise the BL would not change like it does so we need to concentrate on the LCD itself.
2) It looks a bit dim but could be just the video, however check the voltage on pins 1 and 2, it must be at least 4.8V otherwise the LCD will not work
3) Now check the voltage on pin 3 set this to 0 or as near as possible with the contrast pot, 0V is maximum contrast.
F1p
Re: P018 I2C 16x2 LCD Arduino Code
December 29, 2013 11:20AM
jimeer Wrote:
-------------------------------------------------------
> Thanks for the detailed explanation.
>
> A couple of things spring to mind:
> 1) We can safely say that the I2C communication is
> okay otherwise the BL would not change like it
> does so we need to concentrate on the LCD itself.
> 2) It looks a bit dim but could be just the video,
> however check the voltage on pins 1 and 2, it must
> be at least 4.8V otherwise the LCD will not work
> 3) Now check the voltage on pin 3 set this to 0 or
> as near as possible with the contrast pot, 0V is
> maximum contrast.


Many thanks Jim,

I was going to write this library before the problem!

Problem solved - USB only providing 4.5V which wasn't enough, used a better PSU @ 5.0V and working now. Many thanks for the help!

Regards,
Philip
Re: P018 I2C 16x2 LCD Arduino Code
December 29, 2013 02:21PM
Happy to help,
I have had this before so it may be a common problem for the Arduino although the UNO I have here supplies 5V okay.

Jim
Sorry, only registered users may post in this forum.

Click here to login