Page 2 of 6

Re: LCD 1602 - Library

Posted: Sat Jan 14, 2017 3:09 pm
by mcauser
Most PCF backpacks have a potentiometer for adjusting the display contrast. It may appear the display isn't working when the contrast is extreme.

Re: LCD 1602 - Library

Posted: Sat Jan 14, 2017 3:42 pm
by ZKDMun
Found it - but after adjusting the potentiometer the problem was not solved :/
After turning the potentiometer high, the display shows me just a single row on the lcd:
Image

Re: LCD 1602 - Library

Posted: Sat Jan 14, 2017 4:00 pm
by ZKDMun
i2c.scan() delivers me a list of the values 8 to 119...

>>>i2c.scan()
[8,9,10,11,12,13,14,15,16 - and so on - 117,118,119]

Re: LCD 1602 - Library

Posted: Sat Jan 14, 2017 5:36 pm
by Roberthh
me just a single row on the lcd
That's the typical power-on & not-cleared-yet state.

Re: LCD 1602 - Library

Posted: Sat Jan 14, 2017 6:42 pm
by ZKDMun
Roberthh wrote:
me just a single row on the lcd
That's the typical power-on & not-cleared-yet state.
But I just need to power on the LCD - there is no connection to REPL necessary, the row appears every time the LCD get some power.

How can I solve this problem and clear the display?

I have tried the code from mcausers post:

Code: Select all

from time import sleep_ms, ticks_ms
from machine import I2C, Pin
from esp8266_i2c_lcd import I2cLcd

i2c = I2C(scl=Pin(5), sda=Pin(4), freq=400000)

lcd = I2cLcd(i2c, 0x27, 2, 16)
lcd.clear()
but nothing changed :/

Re: LCD 1602 - Library

Posted: Sat Jan 14, 2017 6:58 pm
by dhylands
ZKDMun wrote:i2c.scan() delivers me a list of the values 8 to 119...

>>>i2c.scan()
[8,9,10,11,12,13,14,15,16 - and so on - 117,118,119]
Seeing this suggests that the pullup resistors aren't wired in properly.

Re: LCD 1602 - Library

Posted: Sun Jan 15, 2017 2:38 pm
by ZKDMun
Found the problem:

The wiring with the 4.7k ohm resistors like the wiring on my sketch I posted before was ok...
but I am using a long breadboard and I am a newbie - my lesson of the day was that the Vcc- and die GND-Line of these long breadboards are interrupted at the middle of the boards - that was my mistake, without any voltage the pullup-resistor can not work.
Many apologies for this mistake - I am ashamed of myself. :/
Now it works perfectly - thank you guys :)

Re: LCD 1602 - Library

Posted: Sun Jan 15, 2017 8:27 pm
by mcauser
Best part about making mistakes is that you learn from them :)

Re: LCD 1602 - Library

Posted: Thu Jan 19, 2017 3:46 pm
by ZKDMun
dhylands wrote: Did you add pullups on the SDA and SCL lines? I2C requires them.
Another question:
Is it necessary to use Pin.PULL_UP?
Can I replace the resistors with Pin.PULL_UP, or is this no replacement for the resistors?
Noob question :/, but I can not understand the meaning behind the Pin.PULL_UP-method...

Re: LCD 1602 - Library

Posted: Thu Jan 19, 2017 5:57 pm
by dhylands
When you use Pin.PULL_UP this enables the internal weak pullups which are on the order of 30-50K ohms (40K typical).

I2C prefers to have strong pullups (I normally pick 4.7K ohms or lower).

You can use weak pulllups if you have a small number of devices on the bus and the wires aren't long, and you can live with lower bus frequencies.

It basically boils down to the larger the value of the pullup, the slower the rising edge to create a 1 bit. The speed of this edge is affected by bus capacitance (which increases each time you add a device) and ultimately determines the max speed you can run the bus at.

There are so many factors that can affect this that the only way to know if it will work for you, is for you to experiment and see it it works reliably enough for you with your particular setup.