Appropriate for your goal is a Schmitt trigger, providing hysteresis and a clean on/off indication. The following is a BJT version, based upon a long-tailed pair differential amplifier with added positive feedback. Feel free to ask questions if you want details.
This is a pretty standard diff-pair wired up with positive feedback and driving an output BJT into saturation to give a clean signal. (Known as a schmitt trigger.) I chose \$R_2=1\:\text{k}\Omega\$ because that's a reasonably low output impedance that should drive inputs okay. (Not sure, guessing there too. But the 74165 is the sterotype for 8-bit PISO.) Set it up so that draws about \$6\:\text{mA}\$ worst case (mostly to get the output impedance down.) Could lighten things up a bit (larger resistors) if a \$10\:\text{k}\Omega\$ output impedance is acceptable to you.
I split the difference evenly between what I computed for the sum of \$R_3\$ and \$R_4\$. But you can make some adjustments one way or another there.
\$R_6\$ is a little iffy to me. I'd tend to want to make it a bit larger. Maybe twice as much, or so. But experiment.
You can make a little picture of how it works. Think about the base for \$Q_1\$ and for \$Q_2\$ as the two teeter-totter seats with \$R_1\$ being the stand it rests on. Usually, this is operated as a very delicate balance. But in this case, just the opposite. Here, see \$R_4\$ as a bunch of weights that slide along its horizontal wire there. When the wire tilts one way, the weights slide along it towards the declining seat making it fall all the faster for it. Then it hits bottom and stops. The LDR, because of that added weight, has to pull still harder, one way or another, to upset things and start a reversal. The weights then shift back to the other side. And so it goes. Back and forth.
Here's a run in LTspice for the above, but using a larger value for \$R_6\$ so that it shows off the hysteresis better without needing a log-scale to do it:
Okay. I had to do it -- plot it in log-scale. I'll add it just because it shows what I'm doing with the LDR control voltage to get the results I wanted:
References
Since comments below suggest this might be uncovered in searches, I figure I should add the more important papers on the topic of bipolar transistors used in a similar (not exactly the same way) Schmitt topology. They are, in the order needed to follow them well:
- C. Ridders, "Accurate determination of threshold voltage levels of Schmitt trigger," in IEEE Transactions on Circuits and Systems, vol. 32, no. 9, pp. 969-970, September 1985, doi: 10.1109/TCS.1985.1085805
- S. D. Roy, "Comments on "Accurate Determination of Threshold Voltage Levels of a Schmitt Trigger," in IEEE Transactions on Circuits and Systems, vol. 33, no. 7, pp. 734-735, July 1986, doi: 10.1109/TCS.1986.1085979
- H. . -U. Lauer, "Comments on "Accurate Determination of Threshold Voltage levels of a Schmitt Trigger," in IEEE Transactions on Circuits and Systems, vol. 34, no. 10, pp. 1252-1253, October 1987, doi: 10.1109/TCS.1987.1086044
- M. J. S. Smith, "On the circuit analysis of the Schmitt trigger," in IEEE Journal of Solid-State Circuits, vol. 23, no. 1, pp. 292-294, Feb. 1988, doi: 10.1109/4.293
But I believe it's actually the last one from Smith that is most important and also the easiest to follow.
Like the others, Smith uses the variable definitions first created by Ridders. So it helps to at minimum have Ridders' paper at hand when reading Smith.
All of the papers find the two thresholds using a quadratic equation.
Smith's paper also shows how the same procedures he illustrates work across a variety of devices, including the BJT and CMOS. (The basic idea he points out is that switching thresholds occur when the loop gain is 1 -- though he doesn't explicitly say so, this is the so-called Barkhausen criterion.)
There are other papers that came over just a few following years. (Filanovsky and Piskarev come to mind.) But the above are the key ones I know about.
I suppose the above would not be complete without including a reference to Schmitt's paper:
- Otto H Schmitt, "A Thermionic Trigger," in Journal of Scientific Instruments, vol. 15, no. 1, pp. 24-26, 1938, doi: 10.1088/0950-7671/15/1/305
Note to AnalogKid
The Schmitt Trigger was adapted to solid state devices in the 1950's.
Did it really take 30 years to realize that a transistor's beta
affects how a circuit operates?
Here's an example of a BJT Schmitt trigger being used at SLAC circa 1964:
The above can be found in R. S. Larsen, "A Photomultiplier Phase-Sensitive Detector for the Optical Alignment System", TN-64-42, May 1964.
Earlier in the paper the author writes, "The Schmitt trigger and its phase splitter are conventional (Figure 5)." So the idea was already, by then, conventional.
Synopsis of Smith
Just a quick overview from the first page of Smith:
$$\begin{align*}
v_r&=\frac1{K}\cdot\mathscr{F}\left(v_{id}\right), \text{where }v_{id}=v_i-v_r\tag{1}
\\\\
\text{d}\:v_r&=\frac1{K}\cdot\text{d}\:\mathscr{F}\left(v_{id}\right)
=\frac1{K}\cdot\frac{\text{d}}{\text{d}\: v_{id}}\:\mathscr{F}\left(v_{id}\right)\cdot\text{d}\: v_{id}
\\\\
\therefore \frac{\text{d}}{\text{d}\:v_i}\:v_r&=\frac1{K}\cdot\frac{\text{d}\: v_{id}}{\text{d}\:v_i}\cdot\frac{\text{d}}{\text{d}\: v_{id}}\:\mathscr{F}\left(v_{id}\right)
\\\\
&=\frac1{K}\cdot\left(1-\frac{\text{d}}{\text{d}\:v_i}v_r\right)\cdot\frac{\text{d}}{\text{d}\: v_{id}}\:\mathscr{F}\left(v_{id}\right)\tag{2}\label{eq2}
\end{align*}$$
The point here is that switching occurs as \$\frac{\text{d}}{\text{d}\:v_i}\:v_r\to\infty\$. Direct re-arrangement of \$\ref{eq2}\$ yields the requirement: \$1+\frac1{K}\cdot\frac{\text{d}}{\text{d}\: v_{id}}\:\mathscr{F}\left(v_{id}\right)=0\$. (Note that when \$\frac{\text{d}}{\text{d}\: v_{id}}\:\mathscr{F}\left(v_{id}\right)=A\$ then it follows that \$K=-A\$ and if you follow that around the loop it's clear that the loop gain is +1 then, after taking into account the (-) terminal's 180-degrees.)
The above says that:
$$v_{id\pm}=\left(\frac{\text{d}}{\text{d}\: v_{id}}\:\mathscr{F}\right)_\pm^{-1}\left(-K\right)$$
This is a robust, generalized approach to analyzing a Schmitt trigger, regardless of its implementation (vacuum tubes, BJTs, CMOS, opamp, etc.) And it doesn't take much to get here.
So I have to assume those who've looked at and analyzed this question (certainly geniuses such as Schmitt and others since) must have reached this point on their own. I've just not found anything earlier than Smith. (And, it appears, neither did Smith nor the earlier three authors I've listed.)