មេរៀនទី២៣៖ Display Lux Brightness Measurements on LCD 16x2 LCD Screens Using LDR Sensors - Tann Thona

Telecommunication and Electronic Engineering

Post

Post Top Ad

Thursday, January 7, 2021

មេរៀនទី២៣៖ Display Lux Brightness Measurements on LCD 16x2 LCD Screens Using LDR Sensors

Display Light Sensor on LCD 16x2 Screen

 

1. Objective

The objective is talk about, Use LDR sensor to measure light in lux and display on LCD 16x2 screen.

2. Requirement

  • Arduino Uno x1
  • USB Cable x1 (No need in simulation)
  • Breadboard x1 (No need in simulation)
  • LDR x1 (Name in Proteus: TORCH LDR)
  • Resistor 10 KOhm x1
  • Potentiometer 4.7KOhm or 10KOhm x1 (Name in Proteus: POT-HG)
  • Electronic Wire (No need in simulation) 

 

3. Build Circuit

Build circuit like Figure 1.


Figure 1. Arduino Connection

 

4. Coding

// Coding by Tann Thona (06/12/2020)
#include <LiquidCrystal.h>

const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
float LDR = 0;
float Vout = 0;
float R1 = 1000;
float Lux = 0;
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
lcd.setCursor(6,0);
lcd.print("Lux:");
pinMode(A0,INPUT);
}

void loop() {
// Turn off the display:
LDR = analogRead(A0);
Vout = (5*LDR)/1023;

Lux = ((25000/Vout) - 500) / R1;

lcd.setCursor(6, 1);
lcd.print(Lux);
}

Click Here to Download Code and Proteus Simulation File 

 

4. Result

According to code above, The LCD 16x2 screen will display on top column "Lux" and under column display number of light measurement in lux depend on environment's bright.

Watch Video Explain in Khmer



YouTube: ICT4D-KH
Copyright By Tann Thona

No comments:

Post a Comment

Post Top Ad