Light intensity meter using AT89C52 microcontroller
We all know that LDR (light dependent resistor) can be used as one of the most suitable light intensity detector because of its working principle. It works on the principle of photoconductivity. It’s made up of such material whose conductivity varies as per light falls on it. As more light falls on it, more number of photon strikes. The kinetic energy of photons is given to electrons – that makes more number of free electrons – that leads to increase in conductivity of the device. Thus as light intensity increases, the conductivity increases (resistance decreases) and vice versa. So the change is the resistance of LDR can be a measurement of the amount of falling light.
In the given project, LDR is used to measure light intensity inside the room. With a minor change in the circuit, it can be used to measure outdoor light intensity also. It uses microcontroller AT89C52 and LCD to display light intensity. It also indicates how much light inside room like “full light”, “good light”, dim light” etc. However, microcontroller cannot detect the change in resistance directly. LDR has to be given biasing voltage along with pull up or pull down resistance so that change in resistance is converted into change in voltage. The change in analog voltage is converted into digital equivalent using ADC and this digital value is read by microcontroller. Let us discuss this in somewhat more detail manner.
EA Software Engineering Virtual Experience Program Do a virtual internship with Forage. We’d like to use data-collection tools, such as cookies 🍪, to improve and personalize your on-line experience, analyze site traffic and personalize content. Software Software for the. Ic at89c51 digital clock programming AT89C51 digital clock using the Atmel AT89C51 at89c52 digital clock program for digital clock.
As shown in the figure to vary the voltage as per the change in light intensity and the resistance of LDR, the LDR can be connected with fixed value biasing resistance in pull up configuration or pull down configuration. If it is connected in the pull down configuration the voltage increases as light intensity increases and if it is connected in the pull up configuration the reverse will happen. How? Let us see.
Fig. 1: Circuit Diagram of LDR based Voltage Divider Networks used as Light Sensors
As shown in figure (a) the voltage at the junction of LDR and R (fix value resistance) V is
V = (R / R + LDR) × Vcc
So as LDR resistance decreases – means light increases, the voltage increases, and vice versa
In figure (b) the voltage equation changes to
V = (LDR / R + LDR) × Vcc
So in this connection as LDR resistance increases- means light decreases, the voltage increases, and vice versa. So we cannot use this second configuration because we want an increase in voltage with the increase in light intensity. In this project, LDR is used with pull down resistance configuration. Also, the value of fixed resistance R should be chosen after calculations such that as the LDR resistance varies from darkness to full light the voltage V should change from 0 to 5 V. It is very easy to find this value. Just measure the value of LDR resistance in darkness and full light and select the value of R as the mid value of this range. E.g. if LDR resistance varies from 1 K to 25 K (in full light to darkness) select R as 10 K.
So ready to build the project? Here is the circuit diagram followed by description and operation. Software program and logic explanation are given afterward.
Description:
· LDR is connected between Vcc supply and ground through a 10K resistor that gives it bias. The voltage across biasing resistance is given as analog input to ADC0801
· Digital outputs DB0 – DB7 are connected to port P1 of AT89C52 microcontroller
· Control pins RD and WR of ADC are connected with port P3 pins P3.7 and P3.6 respectively
· Interrupt output pin INTR from ADC is connected to external interrupt 1 pin INT1
· Chip select pin CS is connected to ground to make chip always enable
· RC components are connected to CLK R and CLK IN pins that provides internal clock to ADC
· VREF/2 pin is given voltage through potential divider of R3 and R4
· The LCD data pins D0-D7 are connected to port P2. Control pins RS and En are connected with port P3 pins P3.0 and P3.1 respectively. RW pin is connected to ground to enable LCD write always enable
· 1K Pot (not shown in the circuit) is connected to VEE pin to vary brightness of LCD
· A 12 MHz crystal is connected to crystal input pins XTAL1 and XTAL2 along with two capacitors (not shown in the figure). It generates required clock signal for the microcontroller.
Circuit operation:
When light falls on LDR, its resistances varies. More the light falls on LDR decrease its resistances. As the LDR resistance decreases the analog input voltage to ADC increases. That means the input voltage to ADC is directly proportional to light intensity falling on LDR. So more light more voltage and less light less voltage.
ADC converts this analog voltage into 8-bit digital value and gives it to the microcontroller. Microcontroller gets this binary input converts it into decimal and displays it on LCD as light intensity. As the voltage varies from 0 V to around 4.5 V the corresponding digital output varies from 0 to maximum 240 – 250. The maximum value is 255 because of its 8 bit ADC.
The microcontroller compares this value with a different range of values and decides how much light intensity is. If light intensity value is less than 50 then its very low light so microcontroller displays message “dim light”. Likewise, as the value increases the microcontroller decides whether its medium light, good light or full light etc. Please refer the following table:
Sr no | Range of light intensity value | decision |
1 | 0 – 50 | Dim or very low light |
2 | 50 – 100 | Medium light |
3 | 100 – 200 | Good light |
4 | More than 200 | Full light |
Software program and logic:
The program downloaded into internal FLASH of AT89C52 is the soul of the project. It performs following functions
· Handles LCD
· Handles ADC
· Converts HEX value into decimal and then decimal into ASCII
· Compares light intensity value and decides how much light
At89c52 Programming Software Free
So it’s actually the program that gives all the required functionalities to the project. The program is written in C language. It is compiled using KEIL (IDE) cross compiler. Here is the complete C program.
Project Source Code
Circuit Diagrams
Circuit-Diagram-8051-Microcontroller-Light-Intensity-Meter |
Project Video
Filed Under: Electronic Projects
Ham Radio Programming Software
For over 26 years, RT Systems has produced the most up-to-date amateur radio software for all the top radio manufacturers. Along with the most reliable software, RT Systems makes the best cables for programming and/or control. RT Systems invented amateur radio programming in 1995 when the Yaesu FT-11 'cloned' and Rod (yes that's Rod Thompson who is still leading this company) wondered if we could get it to talk to a computer instead of another radio.... once done, the rest is history.
RT Systems provides a system that works! The system includes an RT Systems Programmer designed specifically for your radio (nothing extra to wade through) and a RT Systems USB cable designed to work with your radio and eliminate com port setup. If you already have the correct RT Systems cable for the software, you can purchase and download the RT Systems programmer directly to your computer and use it to program your new radio immediately. You can even copy and paste details from one programmer to another so the file started for the new radio can be ready to go in minutes!
It's sooooo easy...
Skip the knob turns and button presses on the radio. The Programmer brings ALL the features of the radio to the computer screen where they are easily managed.
See it doneEach Programmer is designed for a specific radio model.
You can program your radio without having to wade through options that don’t apply to your radio.
About RT Systems
RT Systems has been at the forefront of amateur radio programming software since 1995 when we introduced the first radio programmer for the Yaesu FT-11.
Read MoreAt89c52 Programming Software
What our customers are saying about us . . .
'Just wanted to drop all of you at RT Systems a message to tell you what outstanding customer support and tech support your company has. Every time I’ve had a problem with drivers on my Windows PC’s, you're on line customer tech support has been the best in the industry. I wouldn’t use any other software for radio programing but RT Systems. The fact that you have now transported many of your apps over to the Mac OS is a real big deal for me. Way to go RT Systems, keep up the outstanding work.'
- K6RMW in Watsonville, CA
- K9RRX in Kalamazoo, MI
- K6HOM in Sacramento, CA
- WB8BTI in Napoleon, Ohio
'Thank you RT Systems for providing excellent software, cables and tech support. You are the first company that I’ve found in many, many years of buying ham radio items that actually takes the time with your tech support to insure that each customer’s questions are completely answered. On every occasion that I’ve called or emailed, your support was instant as well as complete. Many companies claim that they support their software and hardware, then say, ‘Your lack of knowledge of how to use your radio is not our problem’. By contrast, RT Systems asks ‘What radio are you using?’ and walks the customer through each step to get the job done, providing EXCELLENT SERVICE!'
- KD0ZK in Boynton Beach, FL
'I have tried free software available elsewhere, and concluded that it is made for people who’d rather solve programming puzzles than get on the air.'
- WS7SAR in Placerville, California