Skip to main content

Arduino - How to use Liquid Crystal Display I2C

Arduino - How to use Liquid Crystal Display I2C
In this article will be How to use Arduino board with Liquid Crystal I2C, It same Arduino Lcd Liquid Crystal Display  Examples applications, Arduino boards send text or output from sensor to show on LCD screen. But there is another control unit (PCF8574) to control the screen. This reduces the number of pins to 4 lines.
Details of PCF8574 (LCD Controller)
  1. Signal pin (i2c) from Arduino Board
  2. Potentiometer for adjust Contrast of character
  3. Address Selector pad
  4. Black light jumper 
Circuit

Install Library
  • go to Library Manager -> Search  "LiquidCrystal i2c" -> Install  (See more)
Scan I2C Adress of PCF8574 (LCD Controller)
  • Check connection and Search Address of PCF8574 (LCD Controller) (See more)
  • After find the PCF8574 Address, Take this in Example Code (0x27 or 0x3F)
Example Code
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
//LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x3f,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line display
//LiquidCrystal_I2C lcd(0x27,20,4); // set the LCD address to 0x27 for a 20 chars and 4 line display
void setup()
{
lcd.init(); // initialize the lcd
// Print a message to the LCD.
lcd.backlight();
lcd.setCursor(3,0);
lcd.print("Hello, world!");
lcd.setCursor(4,1);
lcd.print(" Arduino!");
delay(2000);
}
void loop()
{
lcd.clear();
lcd.print("Hello ");
lcd.print(millis()/1000);
delay(1000);
}

output program
* If LCD not show characters try adjust the potentiometer 
Referent
- https://github.com/marcoschwartz/LiquidCrystal_I2C

Comments

Popular posts from this blog

Arduino กับการใช้งาน Serial Monitor

Arduino กับการใช้งาน Serial Monitor Serial Monitor คือ ส่วนหนึ่งของโปรแกรม Arduino IDE สามารถใช้งานได้ 2 อย่าง คือ - แสดงผลลัพธ์จากบอร์ด Arduino - ใช้รับข้อมูลจากผู้ใช้ แล้วส่งข้อมูลไปยังบอร์ด Arduino รูปแบบการใช้งาน Serial Monitor เริ่มต้นใช้งาน void setup() {    Serial.begin(9600); } แสดงผลออกทาง Serial Monitor Serial.print("Hello World");       /* แสดงคำว่า Hello World */ Serial.println("Hello World");     /* แสดงคำว่า Hello World และขึ้นบรรทัดใหม่ */   อ่านค่าจาก Serial Monitor Serial.read(); วิธีเปิด Serial Monitor 1. กด Ctrl + Shift + M 2. กด Icon ตัวอย่างการแสดงผลลัพธ์จากบอร์ด Arduino แสดงผลลัพธ์จากบอร์ด Arduino ตัวอย่างการรับค่าจาก Serial Monitor - ส่ง 1 เพื่อ On LED -  ส่ง 0 เพื่อ Off LED แสดงผลลัพธ์การรับค่าจาก Serial Monitor * ถ้าไม่สำเร็จ ตรวจสอบว่าเลือก No line ending และบอดเรทเป็น 9600 เเล้วหรือยัง

Arduino กับการใช้งานจอ LCD (Liquid Crystal Display)

Arduino กับการใช้งานจอ LCD (Liquid Crystal Display)         ในบทความนี้จะเป็นตัวอย่างการใช้งานบอร์ด Arduino กับจอ LCD แบบ Liquid Crystal ขนาด 16x2 ( 16 ตัวอักษร 2 บรรทัด) โดยให้บอร์ด Arduino ส่งข้อมูลต่างๆ เช่น ข้อความ หรือ ค่าเอาต์พุตจากเซ็นเซอร์ เพื่อเเสดงผลยังหน้าจอ LCD ขาต่างๆของจอ การเชื่อมต่อระหว่างจอ LCD และบอร์ด Arduino LCD RS pin       to digital pin 12 LCD Enable pin to digital pin 11 LCD D4 pin       to digital pin 5 LCD D5 pin       to digital pin 4 LCD D6 pin       to digital pin 3 LCD D7 pin       to digital pin 2 LCD Vo pin       to เอาต์พุตจากตัวต้านทานปรับค่าได้ขนาด 10k โอห์ม เพื่อใช้ในการปรับความคมชัดของตัวอักษร  LCD Anode       to ตัวต้านทาน 220 โอห์ม เพื่อใช้ในการเปิดปิดเเบล็คไลท์ของจอ LCD Cathode    to GND ตัวอย่างโปรเเกรมที่ใช้ #include <LiquidCryst...