top of page
Search
Writer's pictureWatchIT Group

Challenge # : Display LDR sensor values on the LCD screen.

We come across LCD displays everywhere around us. Computers, calculators, television sets, mobile phones, digital watches use some kind of display to display the time.


An LCD is an electronic display module which uses liquid crystal to produce a visible image. The 16×2 LCD display is a very basic module commonly used in circuits.


The 16×2 translates o a display 16 characters per line in 2 such lines. In this LCD each character is displayed in a 5×7 pixel matrix.




The LiquidCrystal library allows you to control LCD displays that are compatible with the Hitachi HD44780 driver. There are many of them out there, and you can usually tell them by the 16-pin interface.


This example sketch prints "Hello World!" to the LCD and shows the time in seconds since the Arduino was reset


Hello World!"


The LiquidCrystal library allows you to control LCD displays that are compatible with the Hitachi HD44780 driver. There are many of them out there, and you can usually tell them by the 16-pin interface.

This example sketch prints "Hello World!" to the LCD and shows the time in seconds since the Arduino was reset.



output of the sketch on a 16x2 LCD


The LCDs have a parallel interface, meaning that the microcontroller has to manipulate several interface pins at once to control the display. The interface consists of the following pins:


A register select (RS) pin that controls where in the LCD's memory you're writing data to. You can select either the data register, which holds what goes on the screen, or an instruction register, which is where the LCD's controller looks for instructions on what to do next.


A Read/Write (R/W) pin that selects reading mode or writing mode

An Enable pin that enables writing to the registers

8data pins (D0 -D7). The states of these pins (high or low) are the bits that you're writing to a register when you write, or the values you're reading when you read


Experiment 1


Display Hello world on the LCD


Circuit diagram




Code

the LCD use a library "LiquidCrystal" most of the time it come with the arduino version , to get started with lcd go FIle>Examples>LiquidCrystal>HelloWorld and open that examples

sketch


// include the library code:
#include <LiquidCrystal.h>

// initialize the library by associating any needed LCD interface pin
// with the arduino pin number it is connected to
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("hello, world!");
}

void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  // print the number of seconds since reset:
  lcd.print(millis() / 1000);
}

on the screen you should start seeing the Hello world , otherwise try to varies the variable resistor the near the screen to get clear pixels.



now that you have understood the concept behind the lcd screen try now to display the ldr sensor values on the LCD screen and share with us the screenshot of the work.


If you have enough wires , try also the dht11 sensor (temperature and Humidity) and display all of its parameters in the lcd screen .



Thank you!


enjoy👩🏾‍💻



feel free to ask questions in the comment section !

351 views2 comments

2 Comments


Brian nziza
Brian nziza
Jul 29, 2020

worked

Like

kajothada
kajothada
Jul 24, 2020

what can be the couse of this error and how to solve it


Like
Post: Blog2_Post
bottom of page