Page 4 of 6

Re: I2C LCD Library... Help!

Posted: Sat Mar 18, 2017 9:28 pm
by raspi3ua
One of comments from Aliexpress:
"3f address. there is written about it. put the address 0х3f i2c module and start-everything works. https://ae01.alicdn.com/kf/UT8QpQBXNNaXXagOFbXQ.jpg"

So adress 63 is OK.


"The part number of the 0x3F chip will be PCF8574. i.e.0x38-0x3F
The part number of the 0x27 chip will be PCF8574A i.e. 0x20-0x27"
http://forum.arduino.cc/index.php?topic=369998.60


picture: https://cdn.instructables.com/FVV/YTFX/ ... .LARGE.jpg
0x3F - my code.
PCF8574AT - my backpack.

Re: I2C LCD Library... Help!

Posted: Sat Mar 18, 2017 10:09 pm
by dhylands
SDA and SCL both need pullup resistors. Some boards have them and some don't. I'd try adding 10K ohm pullups between 3.3v and SDA and also between 3.3v and SCL.

Re: I2C LCD Library... Help!

Posted: Mon Mar 20, 2017 8:30 am
by raspi3ua
I soldered all pins from LCD to backpack and now all is ok. :-)
Thanks for troubleshuting.
LED_front1.jpg
LED_front1.jpg (185.53 KiB) Viewed 28038 times
>>> from esp8266_i2c_lcd import I2cLcd
>>> from machine import Pin, I2C
>>> i2c = I2C(scl=Pin(5), sda=Pin(4), freq=100000)
>>> i2c.scan()
[63]
>>> lcd = I2cLcd(i2c, 63, 2, 16)
>>> lcd.clear()
>>> lcd.putstr(' Thanks from Ukraine :-) ')

Re: I2C LCD Library... Help!

Posted: Thu Apr 06, 2017 10:07 pm
by haks
Help: <ImportError: no module named 'esp8266_i2c_lcd'> trying to load the same code:

from esp8266_i2c_lcd import I2cLcd
from machine import Pin, I2C
i2c = I2C(scl=Pin(5), sda=Pin(4), freq=100000)
i2c.scan()
lcd = I2cLcd(i2c, 63, 2, 16)
lcd.clear()
lcd.putstr(' Thanks from Ukraine :-) ')

Re: I2C LCD Library... Help!

Posted: Sat Apr 08, 2017 7:52 am
by raspi3ua
haks wrote:Help: <ImportError: no module named 'esp8266_i2c_lcd'> trying to load the same code:

from esp8266_i2c_lcd import I2cLcd
There is no 'esp8266_i2c_lcd' library installed by default. You need to load 'esp8266_i2c_lcd' and 'lcd_api.py' on your NodeMCU. I use "ampy" util to load files to Node MPU.

Code: Select all

C:\>set AMPY_PORT=COM10
C:\>ampy put lcd_api.py 
C:\>ampy put esp8266_i2c_lcd.py esp8266_i2c_lcd.py
Then check if library loaded correctly:

Code: Select all

>>> with open('esp8266_i2c_lcd.py') as f:
            for line in f:
                print(line, end='')

Re: I2C LCD Library... Help!

Posted: Fri Apr 14, 2017 7:27 am
by raspi3ua
Question: Can we tune "Brightness" and "Contrast" using I2C LCD Library?

I ask this question because of next problem...
When I use wrong connection and power LCD Backpack (5V) from NodeMCU VU pin (5V) - all is ok with "Brightness" and "Contrast". See my picture above. But such connection may faulted I2C pin on NodeMCU (not 5V tolerant).

When I power LCD Backpack (5V) from NodeMCU 3V3 pin (3.3V) - LCD is working BUT "Brightness" and "Contrast" too low. I set potentiometer on Bacpack to max position. I can lcd.putstr('hi") but it very hard readable.

So is it any way to tune "Brightness" and "Contrast"?

Re: I2C LCD Library... Help!

Posted: Fri Apr 14, 2017 7:44 am
by raspi3ua
Test.
Power LCD Backpack (5V) from NodeMCU 3V3 pin (3.3V).
>>> i2c = I2C(scl=Pin(5), sda=Pin(4), freq=100000)
>>> lcd = I2cLcd(i2c, 63, 2, 16)
>>> lcd.putstr(' Thanks from Ukraine :-) ')
"Brightness" and "Contrast" too low.
low_Brightness.jpg
low_Brightness.jpg (106.48 KiB) Viewed 27940 times

Than I disconnect 3V3 pin and connect it again to 3V3 pin

>>> lcd.putstr(' Thanks from Ukraine :-) ')
ok_Brightness_wrong_char.jpg
ok_Brightness_wrong_char.jpg (112.79 KiB) Viewed 27940 times
"Brightness" and "Contrast" is ok but Char is wrong.

When I reinitialize LCD+Backpack
>>> i2c = I2C(scl=Pin(5), sda=Pin(4), freq=100000)
>>> lcd = I2cLcd(i2c, 63, 2, 16)
Char is good but "Brightness" and "Contrast" is too low again . :D

Re: I2C LCD Library... Help!

Posted: Fri Apr 14, 2017 12:50 pm
by Roberthh
The LCD requires 5V for proper brightness & contrast. You could try to run the LCD at 5V, and the NodeMCU at 3.3V with the pull-up resistors connected to 3.3 V. Or use a level converter for SDA & SCL, with pull-up resistors at both sides.

Re: I2C LCD Library... Help!

Posted: Wed Apr 19, 2017 2:28 am
by mcauser
There are some 16x2 LCDs which are designed for 3V, but they are hard to find and often 5-10x the price.
Most require 5V for reasonable contrast. Don't forget to adjust the potentiometer on the back.

Yellow/green LCDs are more readable in daylight without the backlight on, compared to blue/white.

Re: I2C LCD Library... Help!

Posted: Sat Apr 29, 2017 12:33 pm
by raspi3ua
Receive TXS0108E "I2C Logic Level Converter Bi-Directional Module 5V to 3.3V".
Connect LCD (5V) to NodeMCU (3.3V) through TXS0108E.
Now all is Ok.
I2C_Converter_5V_to_3.3V_TXS0108E .jpg
I2C_Converter_5V_to_3.3V_TXS0108E .jpg (167.76 KiB) Viewed 27860 times