Page 6 of 6

Re: LCD 1602 - Library

Posted: Sat Nov 30, 2019 10:22 pm
by vitalis
Do you mean that it should be done by implementing similar wrapper class to use FBConsole?
But is it possible for text, non-graphical LCD like 20x4 or 16x2?

Re: LCD 1602 - Library

Posted: Sun Dec 01, 2019 11:32 am
by Christian Walther
Yes, the FBConsole class demonstrates how you need to subclass uio.IOBase so that it can be plugged into the REPL using os.dupterm. (Incidentally, is there any documentation for this? Searching for “IOBase” in the docs yields nothing.) Writing the text you get from there out to the display should then be straightforward – even simpler for a text-based display than a bitmapped one, I would assume.

Re: LCD 1602 - Library

Posted: Sun Dec 01, 2019 3:49 pm
by vitalis
Ok, having REPL on the "old school" type of 20x4 LCD sounds interesting! :)
If I will not succeed with my TFT 320x240, I will try that.

Re: LCD 1602 - Library

Posted: Sat Dec 07, 2019 4:20 pm
by vitalis
I have got TFT 320x240 working with esp32 and FBconsole (to some extent). But now I'm switching back to 20x4 LCD, it will be really interesting to get os.dupterm() working with it.
Christian Walther wrote:
Sun Dec 01, 2019 11:32 am
Incidentally, is there any documentation for this? Searching for “IOBase” in the docs yields nothing.
It will be good to have some docs about it.

Re: LCD 1602 - Library

Posted: Thu Nov 26, 2020 9:39 pm
by Pitias
mcauser wrote:
Fri Jan 06, 2017 4:56 pm
@ernitron
1. Yes, using various HD44780s, 08x2, 16x1, 16x2, 16x4, 20x4, blue and yellow.
2. Yes, using both PCF8574 I2C backpacks and GPIO pins (4x data pins).

The 08x2 pin arrangement does not mate with the I2C backpacks as the pins are on 2 rows. You can still use the backpack, but you will need to use some wires instead.

Add these to your ESP8266 build's /modules:
https://github.com/dhylands/python_lcd/ ... lcd/lcd.py

for I2C backpack:
https://github.com/dhylands/python_lcd/ ... i2c_lcd.py
https://github.com/dhylands/python_lcd/ ... cd_test.py

for GPIO:
https://github.com/dhylands/python_lcd/ ... pio_lcd.py
https://github.com/dhylands/python_lcd/ ... cd_test.py

Connections:
WeMos D1 Mini -- PCF8574 I2C backpack
D1 SCL ------------ SCL
D2 SDA ----------- SDA
GND --------------- GND
5V ----------------- VCC

Power consumption:
My blue and green 16x2 LCDs: 21mA with backlight on, 5.4mA with backlight off.
My blue and green 20x4 LCDs: 36mA with backlight on, 5.5mA with backlight off.

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.putstr("Hello ernitron\nIt's working!")
lcd.clear()
lcd.putstr("Using dhylands\npython_lcd")

lcd = I2cLcd(i2c, 0x27, 4, 20)
lcd.putstr("WeMos D1 Mini with  PCF8574 I2C backpackWorks with HD44780s:08x2 16x1 16x2 20x4")
lcd.clear()
lcd.putstr("line 1\nline 2\nline 3\nline 4")
Image
Image
http://imgur.com/a/h6UWJ


Hi Friends
I am using ESP6288 with LCD 16X2 I have uploaded both the esp8266_i2c_lcd.py and lcd_api.py to my module

D1 SCL ------------ SCL
D2 SDA ----------- SDA
GND --------------- GND
5V ----------------- VCC

Code: Select all

 microPython
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.putstr("Hello ernitron\nIt's working!")
lcd.clear()
Quick question:
1: the code is good without errors but the display is blank. I need help ?? Thank you so much

Re: LCD 1602 - Library

Posted: Fri Nov 27, 2020 4:38 am
by dhylands
When you power the display on do you see some black squares? If you don't see any black squares then you need to adjust the contrast voltage.