Ok, I took your circuit, and tweaked it a bit. I looked up your relay, and its published coil resistance is 400Ω. With 330Ω in-series with it, it should pull-in briskly, without overheating. R7 should be a 1/2Wor 1W resistor.
Since you measured the photocell resistance as varying from 2KΩ to ~15KΩ, I changed V2 to reflect this. Note that the simulated resistance of R1 is =V(Rt), so now it goes from 2KΩ to 15KΩ (in 100sec) and back down in the second 100sec.
To confirm this, I plot the expression V(t)/I(R1), which by Ohms Law R=E/I is the resistance of R1 in Ohms. Look at the
red trace and the right hand Y-axis of the upper plot which shows resistance vs time.
You said that you would like the relay to pull in as it gets dark, and you also said that you want the trip point to be ~10KΩ. I diddled R2 and R6 to make the relay pull-in as R1 increases through 10K (getting darker). With R2=80KΩ and R6=470KΩ, I attach cursors in LTSpice's plot to the
red trace, and use them to show that the relay picks-up at R1=10KΩ, and the relay drops-out at R1=8KΩ. I am guessing that is sufficient hysteresis; if not, make R6 smaller and try again.
Note the relay coil current I(L1)
green trace which shows coil current vs time. It shows that the relay is pulled-in at the right time (i.e. when R1 > 10KΩ...)
Also note R2. It is a 100KΩ pot which has been set to 80KΩ!
My model of a
Green LED exhibits a forward voltage drop of ~2.1V, so in the lower plot pane I show V(ref)
light blue and V(t)
dark blue. You can clearly see the effect of the positive feedback provided by R6 in the steps in the
dark blue trace.
Note that D1 does a pretty good job of maintaining 2.1V (
light blue trace), even though, because its dynamic impedance is finite, it is not a perfect voltage reference... Again, if the forward voltage of the specific LED you use in the built-up circuit is different than 2.1V, you might have to tweak R2 a bit to compensate. The LED will always be lit if 24V is applied.
I attached a modified version of your .asc file for you to play with.