عرض البيانات على شاشة LCD باستخدام الاردوينو🖥️

في حياتنا اليومية، نتعامل مع العديد من الأجهزة المزودة بشاشة LCD. تساعد شاشات LCD المستخدم على التفاعل مع هذه الأجهزة واستخدامها بسهولة.


تُستخدم شاشات LCD في مجموعة من التطبيقات اليومية، بما في ذلك راديو السيارة وجهاز التحكم عن بعد لتكييف الهواء.


 تقوم بعرض البيانات وتسمح لك بالتحكم فيها من خلال القوائم.


في هذا الدرس، سنعرض البيانات على شاشة LCD الخاصة بك باستخدام الاردوينو.


 لنكتشف المزيد معًا!


مقدمة


تتكون شاشة LCD (شاشة العرض البلورية السائلة) من عدة صفوف ويتكون كل صف من مجموعة من المناطق المستطيلة يمكن الطابعة داخلها. الشاشة المستخدمة في هذا الدرس هي شاشة LCD مقاس 16 × 2، مما يعني أنها تحتوي على صفين يحتوي كل صف على 16 منطقة مستطيلة. يتكون كل مستطيل منها يتكون من وحدات أصغر تضيء لعرض الحرف على الشاشة.


سيكون توصيل شاشة LCD بـ الاردوينو أسهل بكثير إذا كنت تستخدم بروتوكول I2C نظرًا لأنك ستستخدم عددًا أقل من أسلاك التوصيل.


 فلنبدأ بتطبيق المشروع!


الحصول علي القطع


ستحتاج إلى المكونات التالية لهذا المشروع، يمكنك شراؤها من متجر ڤولتات.

Sale Off
Voltaat Arduino Uno R3 (Voltaat Version)
45 QAR
Sale Off
Voltaat 2x16 LCD with I2C Module
29 QAR
Sale Off
Voltaat Jumper Wires - Male to Female (40 Pack)
10 QAR

التوصيل


باستخدام أربعة أسلاك توصيل، يمكنك إضاءة شاشة LCD والعرض عليها. توضح الصورة كيفية توصيل الأسلاك بين شاشة LCD والاردوينو. بمجرد توصيل شاشة LCD والارديونو ببعضهما البعض، قم بتوصيل الاردوينو بجهاز الكمبيوتر الخاص بك باستخدام وصلة USB.



التوصيلات من الاردوينو إلى شاشة LCD:

I2C module GND pin  ← Arduino GND pin

I2C module VCC pin  ← Arduino 5V pin

I2C module SDA pin ← Arduino pin A4

I2C module SCL pin ← Arduino pin A5


برمجة الاردوينو



وظيفة نص البرمجة هذا هو عرض جملة نصية على شاشة LCD واستخدام التأخير لتجعل الجملة تظهر وتختفي بتزامن معين.


لتتمكن من تحميل نص البرمجة على الاردوينو بشكل صحيح، يجب عليك أولاً تنزيل مكتبات liquid crystal I2C و wire.h.


المكتبات عبارة عن ملفات يمكنك تحميلها ونسخها إلى ملفات برنامج Arduino IDE حتى يتمكن الاردوينو من التعرف على أجهزة الاستشعار مختلفة. يمكنك تحميل ملفات المكتبة من قسم المصادر في أسفل الصفحة ثم تثبيتها باتباع هذا الدرس.


تأكد من أنك تستخدم شاشة LCD مقاس 16 × 2 مع وحدة I2C.


/*
Voltaat learn (http://learn.voltaat.com)
Link for full tutorial: https://bit.ly/3OsrrQZ
LiquidCrystal I2C Library: https://bit.ly/3Tgc7IT
Wire Library: https://bit.ly/3DdjWJB

Tutorial: Display data to LCD using Arduino
The function of this sketch is to print a string on the LCD
and use the delay function to make simple animations.

Connections from the Arduino to the LCD:
Arduino GND pin → I2C module GND pin
Arduino 5V pin → I2C module VCC pin
Arduino pin A4 → I2C module SDA pin
Arduino pin A5 → I2C module SCL pin
*/

// This library allows you to connect with I2C/TWI devices.
#include < Wire.h >

// The library allows you to control I2C displays using functions that are quite similar to those found in the LiquidCrystal library.
#include < LiquidCrystal_I2C.h >

// LCD instance (0x27 is the I2C address), 16 is 16 number of columns, 2 is number of rows.
// make sure you are using 16x2 LCD with I2C module.
LiquidCrystal_I2C lcd(0x27, 16, 2);

// Commands inside void setup run once
void setup()
{
  // initialize the lcd
  lcd.init();

  // turn on the LCD backlight.
  lcd.backlight();

}

// Commands inside void loop run forever
void loop()
{
  // Clear what is displayed on the LCD
  lcd.clear();

  // Delay for 800 milli second to make simple animation you can change this value to get a To get a different response.
  delay(800);

  // set the cursor of the LCD to column 2, line 1
  lcd.setCursor(2, 0);

  // Print "Voltaat Store" on the LCD
  lcd.print("Voltaat Store");

  // Delay for 1200 milli second to make simple animation you can change this value to get a To get a different response.
  delay(1200);

  // set the cursor of the LCD to column 0, line 1
  lcd.setCursor(0, 1);

  // Print "You are welcome!" on the LCD
  lcd.print("You are welcome!");

  // Delay for two second to make simple animation you can change this value to get a To get a different response.
  delay(2000);

}

قم باختباره



عندما تقوم بتحميل نص البرمجة على لوحة الاردوينو الخاصة بك وتوصيل شاشة LCD كما هو موضح سابقًا، سترى شاشة LCD تعرض "Voltaat Store" بدءًا من العمود الثالث والصف الأول.


ثم تظهر في الصف الثاني عبارة "!You are welcome" بدءًا من العمود الأول.


تم استخدام وظيفة التأخير لتحريكها. بحيث تجعل الكلمات تظهر وتختفي في أوقات مختلفة.


قم بتغيير قيم التأخير في delay () في نص البرمجة واكتشف النتائج المختلفة!

المصادر


Arduino Code

LiquidCrystal I2C Library

Wire Library

Fritzing Wiring file

دروس أخري


A keypad is a set of keys that are used to input data into a computer or electronic device. Most keypads consist of numeric, symbol, and navigation keys.


The ultrasonic sensor is a device that can measure distance by sending out sound waves and calculating how long it takes for them to bounce back.


The RFID reader is a module that reads a unique number from a tag or a card when it comes near it. You can then use the scanned number to identify the card holder.