2
\$\begingroup\$

I have this basic darkness detection circuit. I want to connect this circuit with a 8-bit PISO shift register and want this to output a high or low value.
I am not sure where to get the output from.
I tried playing around with it in tinkercad and falstad.com but I haven't been able to figure this out yet

schematic

simulate this circuit – Schematic created using CircuitLab

If I try to take the voltage from output 1, it stays on because it still has a pathway even without the base current. enter image description here

As seen here, I was expecting the voltage in the multimeter measurement to go to zero when the LED on the left is off. But it doesn't.

If I take it from output 2, it is always off. I am trying to learn electronics as a hobby so I am not sure if there is something simple I am missing here. This is what my test circuit looks like when the output should be off.

enter image description here

The only thing I can think of right now is connecting two transistors together like a Darlington pair but I am not sure if that will work

\$\endgroup\$
21
  • 3
    \$\begingroup\$ "Output" 2 is just ground. Output 1 should should change from a couple hundred mV to nearly 5 V if the transistor is turning off properly and you're not loading it. Can you show a schematic of what you are hooking it up to and how? \$\endgroup\$
    – John D
    Commented Jul 10, 2023 at 20:15
  • \$\begingroup\$ Do you mean the tinkercad schematic? \$\endgroup\$ Commented Jul 10, 2023 at 20:20
  • \$\begingroup\$ There is only one output, 1 and 2 is terminals to connect wires or connector pins. \$\endgroup\$
    – user263983
    Commented Jul 10, 2023 at 20:24
  • \$\begingroup\$ Whatever schematic isn't working the way you think it is. Show the schematic, the voltages present and what you think they should be. \$\endgroup\$
    – John D
    Commented Jul 10, 2023 at 20:24
  • \$\begingroup\$ That's not a schematic, but what's the voltage on the base of your transistor when you expect it to be off? \$\endgroup\$
    – John D
    Commented Jul 10, 2023 at 20:33

1 Answer 1

8
\$\begingroup\$

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.

schematic

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:

enter image description here

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:

enter image description here

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:

  1. 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
  2. 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
  3. 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
  4. 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:

  1. 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:

enter image description here

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:

schematic

$$\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.)

\$\endgroup\$
30
  • 3
    \$\begingroup\$ +1 For adding the LTspice simulation, and for giving a suggestion for what transistors to use. As someone who has learned a lot of theory but is limited in practical experience it is very helpful when posts like these include actual existing components model numbers like 2N3906 and 2N2222. \$\endgroup\$
    – Carl
    Commented Jul 11, 2023 at 7:36
  • 2
    \$\begingroup\$ @Carl I wanted to write about how to do the design itself, from scratch. But I am not sure the questioner cares enough to want to read it. So I just dove in, instead. And I'll take your point about providing part numbers more to heart. When and where possible it takes only a little effort and is worth a moment. \$\endgroup\$ Commented Jul 11, 2023 at 7:50
  • 4
    \$\begingroup\$ This particular question is very difficult, because OP doesn't have the necessary foundation for anything shorter than 1000 words to be useful to them. I for one am happy to see answers like this, regardless of whether OP appreciates or can even understand it, because I often find little gems that just didn't occur to me. R4/R5 for hysteresis, and the collector resistor replaced by a BE junction, very interesting little touches that I wouldn't otherwise have considered. Thanks! \$\endgroup\$ Commented Jul 12, 2023 at 0:29
  • 3
    \$\begingroup\$ Long long ago a site originator (Jeff I think) posted a statement of the main objectives of Q&A. Non verbatim - "Post quality question and answer sets that have a long lifetime and that drive search engine traffic to the site". That still applies, although I've not seen it stated anywghere since. This does that very well. And also makes the site technically attractive as an information source, which is what I like to see. \$\endgroup\$
    – Russell McMahon
    Commented Jul 12, 2023 at 0:48
  • 2
    \$\begingroup\$ @AnalogKid Yeah. I can't change that part of the world, unfortunately. At least I've provided the necessary information of the key papers. That alone will save time. And for those without access, use a local library or else whatever works as sci-hub access. The doi's will work fine with sci-hub. And a search engine might also find something at a university. I've not tried to go to that extent. It's sufficient to provide the standard references, I think. \$\endgroup\$ Commented Jul 13, 2023 at 13:05

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.