Smart surroundings. The Arduino is used to

Smart LCD Brightness Control Using Arduino & LDR Zain Ahmed, Student, SMME, NUST Abstract— here is a simple Arduino project that focuses on adjusting the brightness of an LCD screen, whenever there is not sufficientlight in a room. An LDR sensor is used along with Arduino to sense the lightintensity. LDR changes its resistance based on the light. The LCD willdisplay 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 changesbased on light intensity and as a result the voltage drop across the LDR alsochanges.

Analog input pin A1 for the Arduino reads this voltage drop. DHT11 isa sensor used to measure the temperature and humidity of the surroundings. TheArduino is used to read the sensor values through programming. DHT11 isconnected to the 6th digital pin of Arduino.

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


order now

These values aredisplayed on the LCD. LCD module used here is JHD162A. 4 bit mode for the LCD is used. Data issent 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 ollowingare the motivations behind the Automatic LCD Brightness Control:·        Saves you the trouble of manually going to thedevice settings, repeatedly, in order to adjust the screen brightness.

·        Based on the surroundings and weather LCDbrightness can be automatically changed to a more comfortable level. ·        Usage preference: A display maybe set to bright for presentations but if working on it close up, i.e.

a touchscreen, better to turn it down.·        Lifetime of backlights: LCD panels have alifetime of about 50,000 hours for the backlight. By using a more efficientsystem, (as the one proposed) the lifetime can be extended.One other major part of the project is the temperature and moisturedisplay on the LCD screen. ·        Temperature and moisture are two of the mostimportant factors in the industrial processes.

Food industry to fertilizers andoil industry these factors are imperative in any industry. More over thesefactors are to be noted continuously by the workers and supervisors in theremote locations. LCD with the sensors provides a robust tool for monitoringthese parameters. The brightness control of the LCD is also an important factorhere as it makes the LCD immune to brightness and can prevent mistakes incritical stages of any process. ·        Apart from industrial applications the sensorcan be used in bakeries and hospitals. Moisture content is air can be conduciveto airborne diseases and there must be a way to regulate it.

So using smallsensor packages such as these is a good solution to the problem. Moreover inbakeries moisture and temperature are among the most important factors as theyare imperative in working of certain enzymes and also for the fermentation ofyeast. Needless to say, it is near impossible for a bakery to work withoutproper regulation of moisture and temperature due to nature of processes there.Moreover the temperature and moisture range present in a typical bakery kitchenis well within the range of a cheap sensor so it is easier to implement.  II.    Layout Diagram III.    Expected ResultsFirst of all,we have configured the A1 pin of the Arduino as input pin to read the LDRsensor output. In the setup function, the “Serial.

begin(9600)” command willhelp in communication between the Arduino and serial monitor.In the loop function, we will readfrom 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 arethen used to generate PWM (Pulse Width Modulation) output at the 10th pinof Arduino (which is connected to the LED+ pin of LCD module).

In this way thebrightness of the LCD can be varied with surrounding light intensity.A library is used in the programfor obtaining readings from DHT11 module. The temperature and humidity readingsare obtained from functions “DHT.temperature” & “DHT.humidity”respectively.IV.

    Work DoneMy basic work done on the project is the Arduino code. Thecode begins with “#define “. It calls the library which has beenadded to the code. This results in the ability to read the DHT11 sensor. Nextthe command” LiquidCrystal lcd(12, 11, 5, 4, 3, 2);” is used.

It is used tospecify the pins connected to the Arduino. The LCD is used in 4 bitconfiguration. Its detailed use is given later in the text.

 LDR is connected in series to anotherresistor. A fixed voltage of 5V is given to these resistors. There are fixeddrops across the resistors for fixed light intensity. But as the intensitychanges the resistance of the LDR also changes which affects the voltage dropacross it. This change of drop across the LDR gives us.

Arduino takes inputfrom the analog pin A1.  The Arduinoreads the analog signal in the form of a 10 bit ADC. The analog signal readsthe value by analogRead()2 function. This function accepts onevalue. It is the integer carrying the value of the pin number of Arduino takingthe analog input.

The output of the signal gives a value between 0-1023. Thisis because of the 10 bit ADC. It converts a analog voltage into 1024 portionsand assigns a value to it. This converts the signal into a DC signal. Thissignal is used to power the backlight of the LCD.

The net voltage determinesthe light of the LCD. Greater the value of the net voltage, greater is thebrightness of the LCD. The duty cycle of the wave is determined by theanalogWrite()3. The unction accepts two values. The first value determinesthe output pin for the signal, while the second value determines the value ofthe duty cycle.

The value is give between 0-255. 255 gives a 100 percent dutycycle (which will result in maximum brightness) while on the other hand 0 givesa duty cycle of zero with no brightness on the screen. In our case first we hadto divide the output of analogRead() by 4.

This is because we can only give avalue between 0-255 to the analogWrite() function. So in order to bring thevalue in the required range we had to do the said division of the value.Once this is done it is simply used asthe output value determining the duty cycle to control the brightness. Thesecond task is to take the output from the DHT11 sensor and print it on theLCD.

This utilizes a DHT library. The library has function to read the valuesof sensor. First to acquire the signal DHT.read11 is used. The primary commandsused are DHT.humidity and DHT.tempreature. These values are printed on the LCDscreen using lcd.

print(). A function “delay()”4 is used totemporarily block the program. It is a blocking function which stops theprogram. If this function is not used the values on the LCD change continuouslyand do not become stable. To rid this problem delay() is used at two points inthe code. The Code/Program#include #include

h>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 ofthe project that came immediately after the Arduino code was that ofinterfacing LabVIEW with the Arduino. This was accomplished through the LIFA(LabView Interface with Arduino). The main challenges faced in this part werenot related to technical side of things but more related to settings up thewhole interface.

Various modules needed installation before the LabView wasable to identify the COM PORT, the Arduino used to connect to the PC. The LIFA5 interface providedthe necessary tools to program the Arduino code in the LabVIEW. The majordifferences were present in some of the functions available in the LabVIEWwhich were either absent or renamed in Arduino. This resulted in a modificationof the code.

The nature of the change in code can beshown thorough the fact that a while loop should be used to continouly show theoutput 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 PossibilitiesA.    Smart BillboardsBased on ambientlight 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 LCDpanels. B.

    Smart TV DisplaysThiscan be used to extend the mobile technology to larger screens to make adaptiveTV displays that respond to lighting conditions inside a room and, hence, automaticallyadjust brightness. This will result in a more immersive experience and less eyestrain in dark rooms. C.    Hue Changing ScreensA slightmodification on pure brightness control. Can be implemented in tandem withlight sensors in mobile sensors to change the hue of the screen to reducestrain on eyes.D.    Light LevelCan be used to indicate light levels which cancome in handy in certain situations.E.

     Robust Industrial Grade SensorsThe project can be modified by (modifications such as a morerugged and accurate sensor along with a LCD with less wire clutter) can be usedto make more robust sensor (not necessarily measuring temperature and moisture. VI.    ConclusionThis was the first extended project with the use of microcontroller. This project has helped me familiarize myself with Arduino andother electric components. I am more comfortable writing the code for Arduinoand use in more creative ways in the future.  Another major learning experience offered bythe project is that of the use of LabVIEW and its integration in the actualreal world situations.

Through this project I was able to get through the steeplearning curve of interfacing the LabVIEW with arduino. The project itself canbe improved also. A number of other sensor can be added to the given module andthere output can be viewed on the screen. The use of DHT11can be used as justan example. The LCD can be used with for other parameters such as water levelsensors, accelerometers, pressure sensors and strain gages. Another majorimprovement that can be implemented is that a better LCD can be used.

Thecurrent LCD has a lot of wires which result in a clutter and the project in thecurrent state is a bit fragile to be used in the conditions as initiallyintended. The wires can be easily plugged out causing the connection to becomeloose and preventing the circuit from working. This can be solved by using a 3wire serial LCD module such as SKU:DFR00911. This LCD module reducesthe clutter as it has only 3 wires as previously mentioned. But the maindisadvantage of the LCD (and the main reason we were unable to use it) is thatof cost. The price of this module is almost 4-5 times compared to that of aconventional LCD used.  AcknowledgmentMurtaza Arshad for helping us out in the work related to Arduinocode.

Work was mainly related to serial plotter and serial monitor. Afzaal Ahmed helped us out with debugging of DHTlibrary. References and FootnotesA.    References1.      https://www.dfrobot.

com/wiki/index.php/3-wire_Serial_LCD_Module_(Arduino_Compatible)_(SKU:DFR0091)2.      https://www.arduino.cc/reference/en/language/functions/analog-io/analogread/3.      https://www.

arduino.cc/reference/en/language/functions/analog-io/analogwrite/4.      https://www.arduino.cc/reference/en/language/functions/time/delay/5.      http://www.ni.

com/gate/gb/GB_EVALTLKTLVARDIO/US6.      https://www.arduino.cc/en/Reference/LiquidCrystalConstructor   

x

Hi!
I'm Mary!

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

Check it out