LDR light-controlled LED circuit in Proteus, LDR sensor, Proteus circuit, light-controlled LED

How to use LDR Sensor in Proteus

1.3M Views
40
700
60
25
60
PCBWay

Hello friends! Today we will use an LDR sensor in Proteus to make a light-controlled LED circuit. We will begin with the photoresistor itself, convert its changing resistance into a voltage, and then compare that voltage with a reference to decide when the LED should illuminate.

The original project demonstrates both a numeric light control and an animated torch control in Proteus. We will retain those illustrations and the project download while explaining what the circuit actually measures. A simulator control value is not automatically a measured voltage, and a photoresistor does not directly produce a calibrated lux reading.

If you are new to the schematic editor, our Proteus ISIS and ARES tutorial collection covers the basic workflow. Here we will concentrate on the sensor, threshold calculation and the LM324 stage used in the original circuit.

LDR light-controlled LED circuit in Proteus, LDR sensor, Proteus circuit, light-controlled LED
Figure: LDR light-controlled LED circuit in Proteus.

What Is an LDR Sensor?

LDR stands for light-dependent resistor. It is also called a photoresistor. For the conventional device discussed here, resistance decreases as illumination increases and rises as the sensor becomes darker. Its electrical behavior is continuous, so it does not inherently have only ON and OFF states.

Light-dependent resistor circuit symbol, LDR sensor, Proteus circuit, light-controlled LED
Figure: Light-dependent resistor circuit symbol.

Light-controlled indicators and automatic lighting demonstrations use this resistance change to distinguish brighter and darker conditions. The switching decision is made by the surrounding circuit or software. The same LDR can produce a light-activated or dark-activated output depending on the divider and comparison polarity.

The resistance-versus-illumination relationship is not generally linear. It also depends on the particular component, light spectrum, temperature and manufacturing variation. A threshold circuit can work without an exact lux conversion, but an illuminance meter needs characterization or a sensor designed for that measurement.

Convert Resistance into a Voltage

The simplest interface places a fixed resistor and the LDR in series across a supply. Take the output from their junction. If the fixed resistor is above the junction and the LDR connects the junction to ground, the divider equation is:

Vsensor = Vsupply × RLDR / (Rfixed + RLDR).

LDR and fixed resistor voltage divider, LDR sensor, Proteus circuit, light-controlled LED
Figure: LDR and fixed resistor voltage divider.

In this arrangement, increasing light lowers the LDR resistance and therefore lowers the sensor voltage. Darkness raises the voltage. Swapping the positions of the LDR and fixed resistor reverses that direction, so always inspect the actual circuit before describing its behavior.

Example with a 5 V supply and a 10 kilohm upper resistor
Assumed LDR resistanceCalculated sensor voltageInterpretation
1 kilohm0.455 VLower resistance, relatively brighter condition
10 kilohms2.50 VEqual divider resistances
100 kilohms4.545 VHigher resistance, relatively darker condition

These are selected resistance values for calculation, not promised resistance readings at particular lux levels. A real sensor's datasheet or measured calibration curve is needed to attach illumination values to them.

Find the LDR Models in Proteus

Open the component picker and search for the LDR or light-dependent-resistor models available in your installation. The historical screenshots show two interactive presentations: one with a numeric control and another with a torch whose position represents changing illumination.

Numeric and torch-based LDR simulation controls, LDR sensor, Proteus circuit, light-controlled LED
Figure: Numeric and torch-based LDR simulation controls.

The animation is a way to vary the model's stimulus. It is not a complete optical simulation of a particular torch, lens, room or distance. Read the selected model's properties to identify the controlled quantity and its units.

The original article called the numeric display a voltage reading. That should not be assumed. Use a voltage probe or voltmeter across the relevant circuit nodes to measure voltage; use the model documentation to interpret its light-level control.

LDR torch control at different illumination settings, LDR sensor, Proteus circuit, light-controlled LED
Figure: LDR torch control at different illumination settings.

Move the torch or change the control while the simulation runs, and watch the divider voltage separately. This gives a useful cause-and-effect chain: illumination stimulus changes resistance, resistance changes junction voltage, and the comparison stage changes the output state.

Understand the Original LM324 Circuit

The preserved schematic uses one amplifier section of an LM324. The LDR divider is connected to the inverting input, while an adjustable reference reaches the non-inverting input. An LED and series resistor connect the output toward ground.

Original LM324 and LDR indicator schematic, LDR sensor, Proteus circuit, light-controlled LED
Figure: Original LM324 and LDR indicator schematic.

When the reference voltage is greater than the sensor voltage, the amplifier tends toward a high output and the LED can illuminate. When the sensor voltage is greater, the output tends low. Because this divider voltage falls with increasing light, the illustrated arrangement is intended to be light-activated.

The LM324 is an operational amplifier being used open-loop for a comparison task. It is not an ideal comparator with unrestricted input range and perfect supply-rail output swing. The Texas Instruments LM324 datasheet gives the supply, input common-mode and output-loading limits that must be respected.

Why input range matters

The traditional LM324 input range includes the negative supply but does not extend all the way to the positive supply. Our unmodified divider approaches the positive supply in darkness. A 5 V supply alone therefore does not make every possible 0-to-5 V input valid for this amplifier.

The original reference network also uses a variable resistance above a fixed resistor. Its reference range is not automatically zero to the full supply. Calculate the connected resistor network rather than treating every potentiometer drawing as the same three-terminal voltage divider.

A circuit may appear to change state in one simulation while still operating outside a real component's guaranteed input conditions. For hardware, either constrain both input voltages appropriately or select a comparator whose documented input range covers the required signal.

A Bounded 5 V Demonstration Arrangement

For a clearer LM324 exercise, keep the 10 kilohm upper sensor resistor and add a 10 kilohm resistor in parallel with the LDR. This limits the lower divider resistance to at most 10 kilohms, so the sensor node cannot rise above approximately 2.5 V from a 5 V supply.

For the reference, use 22 kilohms from 5 V to the reference node and 10 kilohms from that node to ground. The nominal reference is 5 × 10 / (22 + 10) = 1.5625 V. Connect it to the non-inverting input and the bounded sensor node to the inverting input.

This is a described revision to the historical circuit, not a claim that the attached project already contains those changes. Retain a common ground, provide the amplifier supply connections and add local supply decoupling appropriate to the device.

Calculate the switching resistance

The effective lower resistance is the parallel combination Reffective = RLDR × 10 kΩ / (RLDR + 10 kΩ). At the nominal switching point, the sensor voltage equals the 1.5625 V reference.

Solving the divider gives Reffective = 10 kΩ × 1.5625 / (5 - 1.5625) = 4.545 kΩ. Substituting that result into the parallel-resistance equation gives RLDR approximately 8.33 kΩ.

Below that LDR resistance, the sensor node is below the reference and the output tends high. Above it, the sensor node is higher and the output tends low. Input offset, component tolerances and noise move the real transition away from this ideal calculation.

Choose an Appropriate LED Resistor

The original screenshot labels the LED resistor as 100 ohms. That value should not be copied without checking the supply, LED forward voltage and available amplifier output current. An op-amp output is not a regulated LED current source.

For a modest indicator exercise, consider a 1 kilohm resistor and calculate the expected current from the actual output voltage. If the loaded output is 3.5 V and the LED forward drop is 2 V, the approximate current is (3.5 - 2) / 1000 = 1.5 mA.

Those voltages are calculation assumptions, not guaranteed LM324 output levels. Consult the particular device's specifications and measure the simulated or physical output under load. Use a separate driver when the load needs more current than the comparison stage should supply.

Do not substitute a relay coil for the LED directly. A coil introduces different current requirements and inductive switching behavior. The present circuit is an indicator demonstration, and a power-load interface needs its own design.

Run a Controlled Simulation

  1. Start with only the LDR divider and a voltage measurement at its junction.
  2. Change the light stimulus and confirm the expected direction of voltage change.
  3. Add the reference network and measure its voltage independently.
  4. Connect both signals to the amplifier with the intended polarity.
  5. Add the LED and its calculated series resistor.
  6. Move slowly through the threshold, recording the two input voltages and output voltage.
  7. Repeat the sweep in the opposite direction and look for chatter or unstable switching.

Original numeric LDR control and LED states, LDR sensor, Proteus circuit, light-controlled LED
Figure: Original numeric LDR control and LED states.

The historical screenshots show the original circuit in two operating states. They help illustrate the intended output behavior, but the numeric light-control display should be interpreted according to the selected model rather than relabeled as a voltmeter.

Torch-controlled LDR circuit in two light conditions, LDR sensor, Proteus circuit, light-controlled LED
Figure: Torch-controlled LDR circuit in two light conditions.

Perform the same voltage observations with the animated torch model. If two models have different stimulus scales, compare their electrical behavior at matched resistance or divider voltage instead of assuming that matching control numbers represent identical illumination.

Prevent Flicker Near the Threshold

Without hysteresis, a slowly varying input near the reference can repeatedly cross the decision boundary. Small supply variations, electrical noise or moving shadows may then cause the LED to flicker.

Hysteresis introduces two different switching thresholds: one for turning on and another for turning off. In an analog comparator circuit, positive feedback can establish these thresholds. Calculate the feedback network using the actual high and low output levels and the loading of the reference node.

For a conceptual voltage example, a light-activated output might switch on below 1.45 V and remain on until the sensor voltage rises above 1.65 V. The 0.20 V separation defines the hysteresis band. These are illustrative targets, not thresholds produced automatically by the original schematic.

A capacitor can reduce fast fluctuations, but filtering and hysteresis solve different problems. Excessive filtering makes the response slow; hysteresis defines how the decision depends on its previous state.

Connect the Divider to a Microcontroller

You can also read the junction voltage with an analog input and perform the decision in software. Keep the signal within the ADC input limits and ensure a common reference. Check the ADC's source-impedance and acquisition-time requirements for the resistor network you choose.

For an ideal 10-bit ADC with a 5 V reference, the nominal code width is 5 / 1024 = 4.883 mV. A 1.5625 V signal lies at about code 320 on that scale. Real reference tolerance, noise and ADC behavior affect the measured code.

That number is a voltage-related code, not lux. A software threshold can use calibrated codes directly when the goal is repeatable switching. If you need physical illumination units, characterize the sensor and account for its nonlinear response.

Download the Original Simulation

The original project remains available here. Open it to explore the historical light controls and circuit arrangement, then apply any revisions you want to study in a separate copy.

Download LDR Sensor in Proteus Simulation

The download has not been rebuilt with the bounded input network described above. Keeping the original and revised arrangements distinct makes it possible to compare their node voltages and understand why component operating limits matter.

Choose Resistors for the Region You Want to Detect

A fixed divider resistor determines which part of the LDR's resistance range produces a useful voltage change. If it is much smaller than the LDR under every intended condition, the unmodified junction stays close to the supply. If it is much larger, the junction stays near ground.

Start by measuring the sensor resistance around the light condition where you want the output to change, then choose the divider and reference around that region. A resistor selected for bright desk lighting may give poor discrimination between two much darker conditions.

For the simple divider, rearranging the voltage equation gives RLDR = Rfixed × Vsensor / (Vsupply - Vsensor). This estimate assumes negligible loading and known supply voltage. Near the supply rail, a small voltage error creates a large resistance error because the denominator becomes small.

The parallel resistor in our bounded example changes that calculation: first determine the effective lower resistance, then remove the known parallel contribution mathematically. Applying the simple formula and calling its result the LDR resistance would be incorrect.

Supply tracking and filtering

When both the reference divider and sensor divider use the same supply, their ideal voltage ratios scale together. The resistance at which they cross can therefore be relatively insensitive to supply variation. This does not eliminate amplifier input limits, output-drive changes or voltage drops in real wiring.

If you add a capacitor at the sensor node, its approximate time constant is the divider's Thevenin resistance multiplied by capacitance. In the bounded example, that resistance cannot exceed 5 kilohms. A 100 nF capacitor then gives a maximum nominal time constant of 0.5 ms, excluding the LDR's own response and other effects.

Choose filtering from the disturbance you want to suppress. That small capacitor will not create a seconds-long delay for passing headlights, and making it much larger changes the response time. Document the intended switch-on and switch-off behavior before choosing components.

Troubleshooting and Review

Useful checks for an LDR switching circuit
SymptomWhat to inspect
Divider voltage moves in the unexpected directionWhich resistor is above and below the junction
Output changes opposite to the intended light behaviorComparison input polarity and LED connection
LED never turns onReference range, amplifier supply, output drive and LED polarity
Erratic switching near a thresholdNoise, missing hysteresis and supply stability
Simulation works but hardware does notInput common-mode limits, loading, actual LDR and wiring
Numeric stimulus mistaken for voltageModel parameter units and an independent circuit voltage probe

For a useful experiment record, note the supply voltage, resistor values, sensor model, reference voltage and measured output states. If a threshold changes when the supply changes, investigate whether the sensor and reference scale together and whether the amplifier remains within its valid operating region.

On hardware, mount the LDR so the controlled LED does not unintentionally illuminate it. Optical feedback can create a different behavior from the intended ambient-light switch. Shielding, orientation and physical spacing can matter as much as resistor values.

The original article described a hardware demonstration. This revision retains its project materials but does not claim a new physical test or a fresh Proteus run of the revised circuit.

Frequently Asked Questions

Is an LDR a digital sensor?

The bare photoresistor is a variable resistance. A comparator module built around it may provide a digital output, but that decision comes from the module's additional circuitry.

Does moving the simulated torch reproduce a measured distance?

Not necessarily. It changes the model stimulus. Use the model's documentation to interpret the control instead of assuming an optical distance calibration.

Can this circuit become a night-light?

Yes, reverse the decision appropriately so darkness enables the indicator. Recalculate thresholds and check the output stage rather than only reversing the LED.

Why not calculate lux directly from the divider voltage?

You first need the particular LDR's resistance-versus-illumination relationship. The divider equation alone only relates resistance and voltage.

Is the LM324 always the best comparator?

No. A dedicated comparator may be more suitable. Select one for the supply, input range, speed, output interface and threshold behavior required by the application.


Comments

6

Join the conversation

Reply1

Dear Syed Nasir will you please tell me which proteus version you are using because above file is not opening in my proteus and i am using proteys v7.10. Moreover kindly share with rar file of your proteus version i will be very thankful to you.

Best Regards,

Farhan Aziz

Reply5

The project conducted above is very nice. I like the point where you have explained Circuit Designing of LDR Sensor in Proteus.
Its good article thanks for sharing this article with us.