Smart Saves you the trouble of manually going

Smart LCD Brightness Control Using Arduino & LDR

Zain Ahmed, Student,
SMME, NUST

We Will Write a Custom Essay Specifically
For You For Only $13.90/page!


order now

Abstract— here is a simple Arduino project that focuses on adjusting the brightness of an LCD screen, whenever there is not sufficient
light in a room. An LDR sensor is used along with Arduino to sense the light
intensity. LDR changes its resistance based on the light. The LCD will
display the temperature and humidity. The project consists of Arduino UNO board,
a DHT 11 sensor along with an LDR and LCD. The resistance of the LDR changes
based on light intensity and as a result the voltage drop across the LDR also
changes. Analog input pin A1 for the Arduino reads this voltage drop. DHT11 is
a sensor used to measure the temperature and humidity of the surroundings. The
Arduino is used to read the sensor values through programming. DHT11 is
connected to the 6th digital pin of Arduino. These values are
displayed on the LCD. LCD module used here is JHD162A. 4 bit mode for the LCD is used. Data is
sent through 4 data pins and 3 control pins in contrast to 8 bit mode.

Index Terms— Arduino, Humidity,
LCD, Light Intensity, LDR Sensor, Programming, Temperature, Voltage Drop

 

I.    
Motivation

F

ollowing
are the motivations behind the Automatic LCD Brightness Control:

·        
Saves you the trouble of manually going to the
device settings, repeatedly, in order to adjust the screen brightness.

·        
Based on the surroundings and weather LCD
brightness can be automatically changed to a more comfortable level.

·        
Usage preference: A display may
be set to bright for presentations but if working on it close up, i.e. a touch
screen, better to turn it down.

·        
Lifetime of backlights: LCD panels have a
lifetime of about 50,000 hours for the backlight. By using a more efficient
system, (as the one proposed) the lifetime can be extended.

One other major part of the project is the temperature and moisture
display on the LCD screen.

·        
Temperature and moisture are two of the most
important factors in the industrial processes. Food industry to fertilizers and
oil industry these factors are imperative in any industry. More over these
factors are to be noted continuously by the workers and supervisors in the
remote locations. LCD with the sensors provides a robust tool for monitoring
these parameters. The brightness control of the LCD is also an important factor
here as it makes the LCD immune to brightness and can prevent mistakes in
critical stages of any process.

·        
Apart from industrial applications the sensor
can be used in bakeries and hospitals. Moisture content is air can be conducive
to airborne diseases and there must be a way to regulate it. So using small
sensor packages such as these is a good solution to the problem. Moreover in
bakeries moisture and temperature are among the most important factors as they
are imperative in working of certain enzymes and also for the fermentation of
yeast. Needless to say, it is near impossible for a bakery to work without
proper regulation of moisture and temperature due to nature of processes there.
Moreover the temperature and moisture range present in a typical bakery kitchen
is well within the range of a cheap sensor so it is easier to implement.

 

 

II.    
Layout Diagram

 

III.    
Expected Results

First of all,
we have configured the A1 pin of the Arduino as input pin to read the LDR
sensor output. In the setup function, the “Serial.begin(9600)” command will
help in communication between the Arduino and serial monitor.

In the loop function, we will read
from the sensor analog pin A1 and will store the values in the “LDR_out”
variable. Then we will map these values to 0-255 range. The mapped values are
then used to generate PWM (Pulse Width Modulation) output at the 10th pin
of Arduino (which is connected to the LED+ pin of LCD module). In this way the
brightness of the LCD can be varied with surrounding light intensity.

A library is used in the program
for obtaining readings from DHT11 module. The temperature and humidity readings
are obtained from functions “DHT.temperature” & “DHT.humidity”
respectively.

IV.    
Work Done

My basic work done on the project is the Arduino code. The
code begins with “#define “. It calls the library which has been
added to the code. This results in the ability to read the DHT11 sensor. Next
the command” LiquidCrystal lcd(12, 11, 5, 4, 3, 2);” is used. It is used to
specify the pins connected to the Arduino. The LCD is used in 4 bit
configuration. Its detailed use is given later in the text.  LDR is connected in series to another
resistor. A fixed voltage of 5V is given to these resistors. There are fixed
drops across the resistors for fixed light intensity. But as the intensity
changes the resistance of the LDR also changes which affects the voltage drop
across it. This change of drop across the LDR gives us. Arduino takes input
from the analog pin A1.  The Arduino
reads the analog signal in the form of a 10 bit ADC. The analog signal reads
the value by analogRead()2 function. This function accepts one
value. It is the integer carrying the value of the pin number of Arduino taking
the analog input. The output of the signal gives a value between 0-1023. This
is because of the 10 bit ADC. It converts a analog voltage into 1024 portions
and assigns a value to it. This converts the signal into a DC signal. This
signal is used to power the backlight of the LCD. The net voltage determines
the light of the LCD. Greater the value of the net voltage, greater is the
brightness of the LCD. The duty cycle of the wave is determined by the
analogWrite()3. The unction accepts two values. The first value determines
the output pin for the signal, while the second value determines the value of
the duty cycle. The value is give between 0-255. 255 gives a 100 percent duty
cycle (which will result in maximum brightness) while on the other hand 0 gives
a duty cycle of zero with no brightness on the screen. In our case first we had
to divide the output of analogRead() by 4. This is because we can only give a
value between 0-255 to the analogWrite() function. So in order to bring the
value in the required range we had to do the said division of the value.

Once this is done it is simply used as
the output value determining the duty cycle to control the brightness. The
second task is to take the output from the DHT11 sensor and print it on the
LCD. This utilizes a DHT library. The library has function to read the values
of sensor. First to acquire the signal DHT.read11 is used. The primary commands
used are DHT.humidity and DHT.tempreature. These values are printed on the LCD
screen using lcd.print(). A function “delay()”4 is used to
temporarily block the program. It is a blocking function which stops the
program. If this function is not used the values on the LCD change continuously
and do not become stable. To rid this problem delay() is used at two points in
the code.

The Code/Program

#include

#include

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

#define DHT11_PIN 8

 

dht DHT;

 

int LDRpin=A1;

int backlight=10;

int LDRout;

int lcd_back_light;

int humidity_level;

int temperature_level;

int analogvalue;

 

 

void setup()

{

 pinMode(LDRpin,INPUT);

 pinMode(backlight,OUTPUT);

 lcd.begin(16,2);

 Serial.begin(4800);

}

 

void loop()

{

 int chk =
DHT.read11(DHT11_PIN);

 

 humidity_level=(DHT.humidity);

 temperature_level=(DHT.temperature);

 lcd.setCursor(0,0);

 lcd.print(“Humidity=”);

 lcd.print(humidity_level);

 lcd.print(“%”);

 lcd.setCursor(0,1);

 lcd.print(“Temperature=”);

 lcd.print(temperature_level);

 lcd.print((char)223);

 lcd.print(“C”);

 

LDRout=analogRead(LDRpin);

 lcd_back_light=LDRout/4;

 

analogvalue=analogRead(0)/4;

Serial.println(analogvalue);

delay(20);

 

 Serial.println(lcd_back_light);

 analogWrite(backlight,lcd_back_light);

 delay(1000);

}

 Another major part of
the project that came immediately after the Arduino code was that of
interfacing LabVIEW with the Arduino. This was accomplished through the LIFA
(LabView Interface with Arduino). The main challenges faced in this part were
not related to technical side of things but more related to settings up the
whole interface.

Various modules needed installation before the LabView was
able to identify the COM PORT, the Arduino used to connect to the PC.

The LIFA5 interface provided
the necessary tools to program the Arduino code in the LabVIEW. The major
differences were present in some of the functions available in the LabVIEW
which were either absent or renamed in Arduino. This resulted in a modification
of the code.

The nature of the change in code can be
shown thorough the fact that a while loop should be used to continouly show the
output in LabVIEW while it is not used in arduino. The function analogWrite()
is not present in the LabVIEW instead, a function “PWM Write Pin” is used.  The graphical code is given as:

 

V.    
Future Work Possibilities

A.    
Smart Billboards

Based on ambient
light conditions, the brightness of the digital advert boards can be maxed out,
or kept at a minimum. This will result in helping with the life of the LCD
panels.

B.    
Smart TV Displays

This
can be used to extend the mobile technology to larger screens to make adaptive
TV displays that respond to lighting conditions inside a room and, hence, automatically
adjust brightness. This will result in a more immersive experience and less eye
strain in dark rooms.

C.    
Hue Changing Screens

A slight
modification on pure brightness control. Can be implemented in tandem with
light sensors in mobile sensors to change the hue of the screen to reduce
strain on eyes.

D.    
Light Level

Can be used to indicate light levels which can
come in handy in certain situations.

E.     Robust Industrial Grade Sensors

The project can be modified by (modifications such as a more
rugged and accurate sensor along with a LCD with less wire clutter) can be used
to make more robust sensor (not necessarily measuring temperature and moisture.

 

VI.    
Conclusion

This was the first extended project with the use of micro
controller. This project has helped me familiarize myself with Arduino and
other electric components. I am more comfortable writing the code for Arduino
and use in more creative ways in the future.  Another major learning experience offered by
the project is that of the use of LabVIEW and its integration in the actual
real world situations. Through this project I was able to get through the steep
learning curve of interfacing the LabVIEW with arduino. The project itself can
be improved also. A number of other sensor can be added to the given module and
there output can be viewed on the screen. The use of DHT11can be used as just
an example. The LCD can be used with for other parameters such as water level
sensors, accelerometers, pressure sensors and strain gages. Another major
improvement that can be implemented is that a better LCD can be used. The
current LCD has a lot of wires which result in a clutter and the project in the
current state is a bit fragile to be used in the conditions as initially
intended. The wires can be easily plugged out causing the connection to become
loose and preventing the circuit from working. This can be solved by using a 3
wire serial LCD module such as SKU:DFR00911. This LCD module reduces
the clutter as it has only 3 wires as previously mentioned. But the main
disadvantage of the LCD (and the main reason we were unable to use it) is that
of cost. The price of this module is almost 4-5 times compared to that of a
conventional LCD used.  

Acknowledgment

Murtaza Arshad for helping us out in the work related to Arduino
code. Work was mainly related to serial plotter and serial monitor. Afzaal Ahmed
 helped us out with debugging of DHT
library. 

x

Hi!
I'm Owen!

Would you like to get a custom essay? How about receiving a customized one?

Check it out