Tuesday, November 19, 2019

Display 2004A generic 4 line 20 characters display with PCF8574T expander



4 line display with PCF8574T -  I/O expander for I2C-bus -  two-wire bidirectional (serial clock (SCL), serial data (SDA))

Arduino Library required: LiquidCrystal_I2C.h
Put the files in Documents -> Arduino -> libraries

Tip: also buy a case for the display, it stands up and its easy to read: http://s.click.aliexpress.com/e/lqzxEDeo

Wire connections:
- 5V and GND to corresponding
- the marked ones SDA, SCL on the end of the digital pins
- or the analog pins A4 (SDA) A5 (SCL)

Arduino Code:

#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,20,4);  // set the LCD address to 0x27
void setup()
{
  lcd.init();                      // initialize the lcd
  lcd.backlight();
  lcd.clear();
 lcd.setCursor (0,3);   // first parameter its the line 0,1,2,3 - second character position 0-20
 lcd.print("Hello World");
}
void loop() {
}
 If you have more devices on the I2C buss you can change the address by soldering the A0, A1 OR A2 connection on the PCF8574T  board.


To display a special character : lcd.print((char)228);

Contract and Backlight
- In case you don't see nothing on the screen, use a screwdriver and adjust the blue potentiometer on the back.
- The backlight on/off is controlled by the jumper
- jumper in place: backlight on
- jumper removed: backlight off

The backlight can also be controlled with software.
Use  lcd.backlight(); to turn it on and lcd.noBacklight(); to turn it off.




No comments:

Post a Comment