Light Detector Using NAND Gate.: Objective
Light Detector Using NAND Gate.: Objective
LDR.
LED.
Connecting wires.
Bread board.
Regulator.
Theory: In this project, we will build a light detector circuit using a NAND gate chip. A light
detector circuit is a circuit that can detect light. When a bright light shines on the circuit, such as
from a flashlight, we will make it so that a LED turns on. The circuit is very basic. The
component that will allow us to detect light is a photo resistor (LDR). We will use a photo
resistor's light-sensing ability to detect whether the circuit is exposed to darkness or bright light.
How this works is that a photo resistor's resistance changes in proportion to the amount of light
it is exposed to. In darkness, it has very high resistance. In bright light, its resistance drops
dramatically. If placed in a voltage divider circuit with a fixed resistor, we can exploit this
resistance-altering behavior so that when connected to a NAND gate, we can produce a logic
HIGH output when the photo resistor is exposed to bright light and a logic LOW output when
the photo resistor is exposed to darkness. All of this will be explained in detail below how
exactly this works. But realize that a photo resistor's resistance-changing ability allows us to
distinctly know whether ita is exposed to darkness or bright light. Knowing this, we can
effectively build a light detector circuit.
1|Page
Truth Table:
The following chart shows NAND gate logic, which shows what output a NAND gate chip will
produce for a set of given inputs. NAND Gate Logic.
This means that if one of the inputs are a 0, the NAND gate will output a logic HIGH at its
output, which means the output will be drawn up to VCC and the load will be powered. If both
inputs feeding into the NAND gate are a 1, only then will the NAND gate output a logic LOW at
its output, which means the output will be drawn down to GND, and the load will not be
powered.
2|Page
Construction And Working
Figure:
Procedure:
Firstly, we must give power to the NAND gate IC. We will feed it 5V of power, so we give +5V
to pin 14 and we connect pin 7 to GND. This establishes power to the IC. The circuit is very
basic. The component that allows us to detect light is a photo resistor (LDR). We set up a
voltage divider circuit composed of a photo resistor and a 6.8K fixed resistor. In a voltage
divider circuit, voltage is distributed across the components in direct proportion to the amount of
resistance each component offers. The more resistance a component offers in relation to the
other, the more voltage that will fall across that component. This is shown in the ohm's law
formula, V= IR. You can see the direct relationship between voltage and resistance in the
formula. The greater the resistance a component offers, the more voltage that falls across it.
Conversely, the less resistance a component offers, th voltage that falls across it. When a photo
resistor is exposed to darkness, it has very high resistance, in the order of a few mega ohms (M
2). With resistance this high, most of the voltage from the power supply feeding the voltage
divider circuit falls across the photo resistor, with very little voltage falling across the 6.8KKQ
3|Page
fixed resistor. Thus, when connected to the inputs of NAND gate, with voltage so high, the
NAND gate will essentially interpret the voltage divider as if it were HIGH (or 1). When the
voltage feeding the inputs of a NAND gate are greater than half of the power supply voltage, it
will interpret it as a HIGH value. Since we will tie both inputs together, the NAND gate will
interpret this as two ones, so it will output a 0 (or LOW), which means the output will be drawn
down to GND and the load will not be powered. Remember, NAND gate logic, two 1s gives a 0.
This is the only time we get an output value of 0 in NAND gate logic. If a 0 is present anywhere
in the inputs, including twice, the NAND gate will output a 1 When a photo resistor is exposed
to bright light, its resistance drops dramatically, in order of 20-30K , or less, depending on the
type in use. With this resistance this low, most of the voltage from the power supply falls across
the 330K resistor, and less than half falling across the photo resistor. With voltage this low, the
NAND gate will interpret as a logic level of 0. Thus, the output will be drawn up to VCC and
the load, the LED, will be powered on. So you can see how this voltage divider circuit allows us
to get 2 different logic levels produced by the NAND gate IC in different lighting conditions.
4|Page
The Advantages of LDRS
LDRs are highly valued for several reasons, making them a go-to choice for projects ranging
from simple DIY setups to complex professional systems. Here are some of the key advantages
that highlight the versatility and practicality of LDRs:
3.Cost-Effectiveness:
LDRs are inexpensive and readily available, making them an economical choice for both
hobbyists and professional developers. Despite their low cost, they do not compromise on
effectiveness, delivering reliable and precise light detection. This affordability makes them
popular in both commercial and educational applications.
5.Ease of Integration:
LDRs are easy to integrate into electronic circuits, as they do not require special biasing. They
are compatible with a wide range of microcontrollers, including Arduinos and PICs, facilitating
a streamlined design process. Their optimal resistance range simplifies circuit integration and
ensures easy readings with standard measuring devices.
6.Good Linearity:
LDRs demonstrate good linearity in their resistance changes relative to light intensity variations.
This feature is advantageous in applications like audio electronics, where they are used in
volume control setups and to control the frequency of RC (resistor-capacitor) filters. Unlike
photodiodes, LDRs provide a robust and practical solution for managing audio signals.
5|Page
6|Page
The Limitations of LDRS
Despite the numerous advantages of Light Dependent Resistors (LDRs), they also come with a
set of limitations that can impact their effectiveness in certain applications. Understanding these
drawbacks is crucial for selecting the appropriate sensor for your needs. Here are some of the
primary disadvantages of LDRs:
4.Environmental Susceptibility:
LDRs are influenced by environmental factors such as temperature and humidity, which can
alter their resistance characteristics and lead to less accurate light detection. This susceptibility
makes them less ideal for precision tasks or in conditions where environmental stability cannot
be guaranteed.
7|Page
Working Principle
8|Page
Future Trends in Light Detection Technology
9|Page
Conclusion
In conclusion, the light detector utilizing a NAND gate represents a fascinating intersection of
analogy sensing and digital logic. By employing a phototransistor to sense light intensity and a
NAND gate to process the resulting signals, this circuit effectively demonstrates how basic
electronic components can work together to create a responsive and functional device.
The key advantages of this design include its simplicity, cost-effectiveness, and versatility,
making it suitable for various applications, from automated lighting systems to safety alarms. As
technology advances, we can expect further innovations in light detection, including enhanced
sensitivity, integration with smart systems, and improved energy efficiency.
This project not only showcases fundamental concepts in electronics and logic design but also
emphasizes the importance of light detection in modern technology. The continuous evolution of
these systems will undoubtedly lead to smarter, more efficient solutions that can better respond
to our environmental needs and improve our daily lives.
10 | P a g e
Reference
Educational Websites
All About Circuits. (n.d.). "Understanding Phototransistors." Retrieved from
https://www.allaboutcircuits.com
SparkFun Electronics. (2020). "Phototransistor Basics." Retrieved from
https://www.sparkfun.com
Online Resources
Electronics Tutorials. (n.d.). "NAND Gate Logic." Retrieved from
https://www.electronicwings.com
Circuit Basics. (2021). "How to Use Phototransistors."
11 | P a g e