A Simple Technique to Measure the Light Intensity Using Arduino and LDR

2
A Simple Technique to Measure the Light Intensity using Arduino and LDR by realfinetime realestate | in transistor at 10:34 http://www.learnerswings.com/2014/08/a-simple-technique-to-measure-light.html We have already seen the Circuit to Turn On an LED During Day and Turn Off the Same at Night Using LDR and BC 547. Here we will measure the light intensity around light sensor using an arduino mega. Circuit is simple and is done as shown in the following diagram. Connections are done as shown in the circuit diagram. Collector pin of transistor is given to the analog pin ( A0 ) of arduino to get an analog value for light intensity. 5V for the working of transistor is supplied from 5V pin of arduino. Ground for the circuit is given from the Gnd pin of Arduino. Pinout diagram of BC547 is given at the left side top in the diagram. Transistor - BC 547 is the transistor used here. It is an NPN transistor and is suitable for small operations. 5V - Normally supplied from Arduino. R1 - This is a current limiting resistor. It helps to switch the transistor between ON and OFF states by controlling the current through R1 and hence through the base of transistor. If that resistor is not connected, there is a possibility that, base current will always remain high because, LDR alone cannot resist the current considerably to turn off the transistor. R2 - It is a pull down resistor . It will ground the base, if there is no external signals to the base of transistor. When an external signal is connected, beginners confuse whether this signal get grounded through R2. But this signal will not get grounded because of high resistance of R2 ( 10K ). R3 - If R3 is not connected, when transistor turns on, power supply get shorted through A,C,B,E and F due to the low resistance of transistor. This will increase current abruptly which will damage the transistor as well as power supply. Working of circuit Current that flows through the transistor ( collector to emitter ) is directly proportional to the base current of the transistor. During night, resistance of the LDR is maximum. Then minimum current will flow to the base of transistor and hence current through the transistor ( collector to emitter ) will be minimum. Current at the collector point of transistor has two options, either it can flow to the analog pin of arduino or it can flow through the transistor to ground. When the base current is small, current will flow to the arduino because of the large impedance of transistor. Then analog pin of arduino will read a high value. During the day time, resistance of LDR is minimum. Hence base current will be maximum. Collector current will flow through the transistor to ground. Then arduino will get a small current and the reading will be minimum. Value will be maximum at night ( 1023 ) and minimum at day ( 0 ). This value will be in between minimum and maximum values, if the light intensity is between the light intensity of day and night. Now upload the following program to your arduino board. This program will read the collector current through the analog pin 0 ( A0 ) and will display it in serial monitor in 100ms delay.

Transcript of A Simple Technique to Measure the Light Intensity Using Arduino and LDR

A Simple Technique to Measure the Light Intensity using Arduino and LDRby realfinetime realestate|in transistor at10:34 http://www.learnerswings.com/2014/08/a-simple-techniqe-to-measre-light.html!e ha"e alrea#y seen the $ircit to %rn &n an '() )ring )ay an# %rn &ff the *ame at +ight ,sing ')- an# .$ /40. 1ere we will measre the light intensity aron# light sensor sing an ar#ino mega. $ircit is simple an# is #one as shown in the following #iagram.$onnections are #one as shown in the circit #iagram. $ollector pin of transistor is gi"en to the analog pin 2 30 4 of ar#ino to get an analog "ale forlight intensity. /5 for the wor6ing of transistor is spplie# from /5 pin of ar#ino. 7ron# for the circit is gi"en from the 7n# pin of 3r#ino. 8inot #iagramof .$/40 is gi"en at the left si#e top in the #iagram.Transistor - .$ /40 is the transistor se# here. 9t is an +8+ transistor an# is sitable for small operations.5V - +ormally spplie# from 3r#ino.R1 -%his is a crrent limiting resistor. 9t helps to switch the transistor between &+ an# &:: states by controlling the crrent throgh -1 an# hence throghthe base of transistor. 9f that resistor is not connecte#; there is a possibility that; base crrent will always remain high becase; ')- alone cannot resist the crrent consi#erably to trn off the transistor.R2 -9t is a pll #own resistor. 9t will gron# the base; if there is no e 0?// "ariable to store the "ale coming from the sensor"oi# setp24 @*erial.begin2AB004?C"oi# loop24 @// rea# the "ale from the sensor:sensor5ale > analog-ea#2sensor8in4? *erial.println2sensor5ale4?#elay21004? C9f ploa#ing is sccessfll; open yor serial monitor. )onDt forget to change the ba# rate to AB00. $hange the light intensity aron# ')- by some metho#s. *erial monitor will print the "ale of "arying light intensity.