I'm completely new to electronics but my degree gives me a basic course with a project at the end.

I built this small circuit to detect when a light is shined on the LDR to turn on an LED so basically a light detector rather than a dark detector. I am simulating the circuit using LTspice but I cannot seem to get it to work.

My idea pretty much is that the LDR gives off a HIGH or LOW value to the threshold comparator then the inverse is outputted through the OUTPUT pin, since I want the inverse of that, I attached a NOT-gate to the output circuit to light the LED when the NE555 output is LOW instead of HIGH.

Like I said I am fairly new and I might over complicate this circuit for nothing, but I can't seem to find a way to make LDR change the output of the NE555

enter image description here


2 Answers 2


I'll assume your intention is to use the 555 as a kind of snap-action (hysteresis) for your LDR, and to use the .step statement to parameterize the LDR behavior. That is, you want to show proficiency with LTSpice.

The first thing I can help you with. You can change your circuit to use TRIG and TRHESH together to do the snap-action. Tie a voltage divider with your LDR to both TRIG and THRESH, as shown below. What should happen is:

  • light on, voltage is above THRESH (2/3 VCC), output goes low (reset)
  • light off, voltage is below TRIG (1/3 VCC), output goes high (set)


simulate this circuit – Schematic created using CircuitLab

A couple of things.

I ran a DC sweep (the CircuitLab equivalent of .step) on the LDR and it worked fine. I haven't yet figured out how to make CircuitLab to use a .step statement directly, but you can try this modified version with your params you set for the LDR in LTSpice.

Oh, and no need for the NPN. The 555 has plenty of drive for an LED. But if you want to add the NPN, you can simply change the polarity by swapping the LDR and the 5K resistor.

  • \$\begingroup\$ Interesting, thank you for the feedback! I draw the circuit in LTspice and kept my parameters however I seem to not understand something. Playing around with the circuit Hackstastical gave I see that the voltage at the THRS climbs up to the desired value while while LDR resistance rises, however the LED Voltage and current stays to 0 so it's always OFF? P.S tried the circuit in Circuitlab and it works fine, so I'm not sure what is messing up my LTspice version of it \$\endgroup\$ Commented Apr 11, 2020 at 9:31
  • \$\begingroup\$ As a quick test, substitute a signal generator for the LDR/resistor pair to make sure the 555 model is behaving as it should. \$\endgroup\$ Commented Apr 11, 2020 at 15:32
  • \$\begingroup\$ Okay so I placed a pulse signal generator to the THRS instead of the LDR/resistor pair and this is the voltage I'm getting at the LED and the THRS pin ( imgur.com/a/LnRN7jJ ) If the image is not working then LED stays at 0mV while the THRS behave has the pulse. So to me it seems that the NE555 from LTSpice is faulty \$\endgroup\$ Commented Apr 11, 2020 at 23:12
  • \$\begingroup\$ Did you connect both TRIGGER and THRESH in your LTSpice sim? You need to drive both to get the output to toggle. \$\endgroup\$ Commented Apr 11, 2020 at 23:15
  • \$\begingroup\$ Here's how I have it setup ( imgur.com/a/wDzkmAo ) , I connected both to the negative of the Pulse then the positive lead to the THRS pin before it split to the TRIG, also thank you for your help, this thing is driving me nuts \$\endgroup\$ Commented Apr 11, 2020 at 23:20

Since NE555 consists of an opamp, having a high input impedance i.e. no current flows into the input. Since in your circuit, you have attached the LDR in series to input, and I=0, the voltage drop across the resistor is always zero independent of resistance of LDR. To make use of changing resistance of LDR, you need to arrange LDR with another resistor in a voltage divider configuration. Like shown here

I hope your doubt regarding the circuit is clear.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.