Friday, January 1, 2021

A DIY TWI LCD Using PCF8574AP For Arduino

A character LCD with a 44780 LCD controller generally controlled by an MCU parallel port. Even the data transfer in-used is 4-bit mode, but it still require up to six MCU pins. 

A DIY I2C character LCD built with PCF8574AP For PIC AVR and Arduino
A character LCD with PCF8574AP

PCF8574AP is an 8-bit general purpose digital I/O expanding. We can read and write digital data between this device and a master MCU, or even controlling a parallel LCD module. However using an I2C IC bridge the master MCU uses only two pins of its digital I/O to interface to the LCD.

In online market the PCF8574AP is built in module the a character LCD that cost a few Dollars. For an electronics hobbyist like me, I only bought a single DIP version of this chip. I can program it to read/write digital data before I decide to put it with a character LCD.

I decided to make my own I2C board module for my Arduino Uno board. This design follows the liquidCrystal_I2C LCD library from an author on GitHub. The overall design is not difference from the original one's but I made my own schematic and PCB design for my personal use.

I use Eagle CAD from Auto Desk software due to its richness of symbols and footprints library. The result yield with a small rectangular PCB module wired with PCF8574AP and a character LCD.

A DIY I2C character LCD built with PCF8574AP For PIC AVR and Arduino
Schematic Diagram

A DIY I2C character LCD built with PCF8574AP For PIC AVR and Arduino
PCB View

This design example is fully worked as I have tested it with Arduino Uno using its library.

A DIY I2C character LCD built with PCF8574AP For PIC AVR and Arduino

A DIY I2C character LCD built with PCF8574AP For PIC AVR and Arduino

A DIY I2C character LCD built with PCF8574AP For PIC AVR and Arduino

A zip file of this design could be download here.

A DIY I2C character LCD built with PCF8574AP For PIC AVR and Arduino
Connection Diagram
 

This Arduino sketch is from the library itself with some of my own modification.

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

// set the LCD address to 0x38 for PCF8574A with A0 A1 A2 wired to GND
LiquidCrystal_I2C lcd(0x38,16,2); 
void setup()
{
  // initialize the lcd
  lcd.init();                     
  lcd.backlight();
  lcd.clear();
  Serial.begin(9600);
  lcd.setCursor(0,0);
  lcd.print("Serial Port LCD");
}

void loop()
{
  // when characters arrive over the serial port...
  if (Serial.available()) {
    // wait a bit for the entire message to arrive
    delay(100);
    // clear the screen
    lcd.clear();
    // read all the available characters
    while (Serial.available() > 0) {
      // display each character to the LCD
      lcd.write(Serial.read());
    }
  }
}

This sketch could be download here, or you can get from the library after the installation.

1 comment:

  1. I think this is an informative post and it is very useful and knowledgeable. We provide LCD modules/LCD Displays, Graphic LCM, smart Display LCD, TFT LCM, Custom LCD Module Display, and LCD panels. china LCD Manufacturers.

    tft lcd screen

    ReplyDelete

Search This Blog

Labels

25AA010A (1) 8051 (7) 93AA46B (1) ADC (30) Analog Comparator (1) Arduino (15) ARM (6) AT89C52 (7) ATMega32 (56) AVR (57) CCS PICC (28) DAC (1) DHT11 (2) Display (105) Distance Sensor (3) DS18B20 (3) dsPIC (2) dsPIC30F1010 (2) EEPROM (5) Environment Sensor (4) esp8266 (1) I2C (29) Input/Output (67) Interrupt (19) Keil (5) Keypad (10) LCD (47) Master/Slave (1) MAX7221 (1) MCP23017 (5) MCP23S17 (4) Meter (3) MikroC (2) Motor (15) MPLABX (71) Nokia 5110 LCD (3) OLED (2) One-Wire (6) Oscillator (8) PCB (6) PCD8544 (3) PCF8574 (5) PIC (107) PIC12F (2) PIC16F628A (2) PIC16F630 (1) PIC16F716 (3) PIC16F818 (10) PIC16F818/819 (2) PIC16F84A (15) PIC16F876A (1) PIC16F877A (9) PIC16F88 (1) PIC16F887 (60) PIC18 (19) PIC18F1220 (4) PIC18F2550 (3) PIC18F4550 (12) PWM (11) RTC (8) Sensor (10) SH1106 (1) Shift Register (11) Shift Registers (3) SPI (24) STM32 (6) STM32 Blue Pill (6) STM32CubeIDE (6) STM32F103C8T6 (6) SysTick (3) temperature sensor (11) Thermometer (21) Timer/Counter (31) TM1637 (2) UART (7) Ultrasonic (4) Voltmeter (7) WDT (1) XC16 (2) XC8 (94)