i2c 20x4 LCD screen

I searched the internet and the Particle forum for information on how to set up a 20x4 serial LCD screen and could not find a direct answer. I have a simple sketch that loops to display characters on all 4 lines. Purchase and connection information is in the comments for anyone desiring to get one going. A copy of the code follows:

// test_loop_4x20_lcd
 #include "LiquidCrystal_I2C_Spark/LiquidCrystal_I2C_Spark.h"
/*
    Connect the LCD screen to 5v.  3v3 is not sufficient to power the unit
    Use 4.7K pull up resistors to 5v on SDA (D0), SCL (D1) lines
    I2C Address is: 0x3F 
   LCD is a Blue Serial 2004 20x4 Character IIC I2C TWI 5v LCD Module Display Screen for Arduino,    
   available from Ebay for $5.42
*/
 #include "application.h"
char Photon_Msg[] = "---- My  Photon ----";
char Charac_Msg[] = "ABCDEFGHIJKLMNOPQRST";
char Numeri_Msg[] = "01234567890987654321";
char Mixtur_Msg[] = "This is a nice print";
LiquidCrystal_I2C   *lcd;

void setup()
{
    lcd = new LiquidCrystal_I2C(0x3F, 20, 4); 
    lcd->init(); 
    lcd->backlight();
    lcd->clear();
}

void loop()
{
    lcd->setCursor(0,0);
    
    for(int i=0; i<20; i++)
    {
        lcd->setCursor(i,0);
		lcd->print(Photon_Msg[i]);
		delay(100);
    }
     
    for(int i=0; i<20; i++)
    {
        lcd->setCursor(i,1);
		lcd->print(Charac_Msg[i]);
		delay(100);
    }	
     
    for(int i=0; i<20; i++)
    {
        lcd->setCursor(i,2);
		lcd->print(Numeri_Msg[i]);
		delay(100);
    }	
     
    for(int i=0; i<20; i++)
    {
        lcd->setCursor(i,3);
		lcd->print(Mixtur_Msg[i]);
		delay(100);
    }	
		delay(1000);
	    lcd->clear();
}
1 Like

Do I understand it good : I have to take my 5V from another source than the Photon ? After that I have to use a 4,7 resistor to pull up the data channel. But isn’t it dangerous to mix one of the Photon pins to one side of the resistor and the other side of the resistor to the exterior 5+ ?

How are you powering your Photon?

If it is powered via USB or Vin at 5V, you can just take these 5V from Vin.
And when you do that, you are not “mixing” anything when pulling up to 5V.
Also you need to make sure your devices share common ground.

Right of course. Sorry for my stupid question.