0
\$\begingroup\$

I'm working on a project that uses an LDR to switch between two mutually exclusive functions. So, when it's bright and sunny, do X and when it's nighttime do Y. The daytime function will involve a PID controller to control a motor (through relays), the nighttime function will cause the motor to "park" and then sleep until daytime. I've decided to do as much of this as possible using discreet components because the object of the exercise is to learn electronics (and I'm something of a masochist).

I'm looking at each section independently and I decided to look at the LDR switch, thinking it would just be a matter of a transistor ot two. Using the following basic transistor switch as my guide, I tried a number of configurations to try to get that SPDT action I required. They all failed - some worse than others.

Basic Transistor Switch

Most of my efforts involved attempting to cascade transistors by attaching the collector of one to the base of the other with the loads in various positions. In general, I had two main problems: either the current flowing through one or more of the branches was quite low or one of the branches wouldn't turn off completely (or at least to an acceptable level).

Now I know I'm not using proper load figures as I should to fine tune the operation of the transistors, but I wonder if transistors are the best option for this type of problem. So, my question is simply this: am I barking up the wrong tree trying to get nicely isolated switch (like a relay - but without using a relay) using transistors only? I'm guessing this requirement is common as muck, so how is this normally achieved?

-- For the benefit of others:

Here's the best scheme I could come up with to meet the requirement of having two sepatate loads receiving full battery voltage and current (more or less). Many, many thanks to gbulmer who put me on the right track here. The trick it seems is to have a high impendence voltage sensing type component to determine the logic level of the transistor.

enter image description here

\$\endgroup\$
3
  • 1
    \$\begingroup\$ An 'obvious' approach to discriminate between two levels of brightness (a voltage) is a comparator. Is that too integrated for your learning purposes? \$\endgroup\$
    – gbulmer
    Commented Oct 2, 2014 at 15:54
  • \$\begingroup\$ I'm struggling to understand how this is any different from the transistor arrangement shown in my question, which has two "logic" levels depending on the LDR "switch" at the base pin. The simplest way of expressing the question is: how do I create an electronic switch that makes the full power of the battery available to one load or the other, so one off and the other on using simple discrete components. \$\endgroup\$
    – Buck8pe
    Commented Oct 2, 2014 at 20:48
  • 1
    \$\begingroup\$ Comparators give a 'near-binary' distinct output, avoiding "or one of the branches wouldn't turn off completely (or at least to an acceptable level)" problem. You could choose parts with enough output to drive BJT or MOSFETs. However, comparators might not be discrete enough. Have a look at comparator \$\endgroup\$
    – gbulmer
    Commented Oct 3, 2014 at 0:12

1 Answer 1

2
\$\begingroup\$

Assuming that your existing circuit works well enough as a single-output, I'd suggest adding a PNP transistor stage to follow on and add a second inverted output.

schematic

simulate this circuit – Schematic created using CircuitLab

For your original circuit, when its light and the LDR has a low resistance, the voltage divider it forms with R2 will turn Q1 on which pulls OUT1 low. When its dark enough and the LDR resistance rises enough to cause Q1 to turn off, OUT1 is then pulled high by R1. The follow-on stage with Q2 acts like a simple inverter using OUT1 as its input. When Q1 is on (and OUT1 is low) Q2 is turned on by the current flowing out of its base through R3. When Q2 is on, OUT2 is pulled high and when Q2 is off OUT2 is pulled low by R4. So although both transistors turn on and off together, the way they're configured causes OUT1 and OUT2 to be in opposite states - much like the SPDT switch you're thinking of.

\$\endgroup\$
3
  • \$\begingroup\$ I threw this into the simulator and stuck an equal load across out1 and out2 and just like in my previous efforts, the circuit became "unbalanced". It's fine if you're using the logic levels to interface with some a voltage sensing device, but drawing current across loads tends to interfere with the switch. I'm starting to think I need a FET or something like that to "decouple" the load from the switch. What do you think? \$\endgroup\$
    – Buck8pe
    Commented Oct 2, 2014 at 20:55
  • 1
    \$\begingroup\$ Ok, you didn't specify what sort of load you were planning on hooking up. You should find that you do have 'full battery voltage' at OUT2 for most reasonable loads connected from there to ground, but not at OUT1. To 'buffer' OUT1, why not add another NPN transistor in an emitter-follower configuration - collector to +5, base to old OUT1, emitter as your new OUT1. \$\endgroup\$
    – brhans
    Commented Oct 4, 2014 at 1:35
  • \$\begingroup\$ Excellent. Another option to consider. My only issue with this arrangement is that when the LDR turns on Q1, it also turns on Q2 with energy lost across one branch or the other. But, that's not a big deal - it's still a big improvement over the options I came up with using two transistors and I've learned a bit about buffering and the emitter-follower configuration. \$\endgroup\$
    – Buck8pe
    Commented Oct 7, 2014 at 20:51

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.