Photocell "switch" help

Discussion in 'The Projects Forum' started by Fixxxer, Apr 6, 2008.

  1. Fixxxer

    Thread Starter Member

    Feb 15, 2007
    15
    0
    Hey, everyone. I'm VERY new to electronics (trying to teach myself still), so bear with me here if what I'm asking seems really simple. I'm working on a project that involves a light/dark-activated switch and I need some help...

    I have a solenoid that takes 24v to activate, and I want it to activate when a laser beam (from a laser pointer) is broken. I know that I'll need a photocell to act as a switch, but I'm not really sure what else. I've searched the forums and Google, but I haven't really come across what I need. Maybe I'm not searching for the right things though.

    My power source is 24v, so I really just need to design a "switch" circuit to activate the solenoid when the laser beam is broken. Can any of you help me out? Maybe point me towards a schematic that you already know of?

    Here are the specs on the photocell that I have:
    Make: Archer
    Type: Cadmium Sulfide
    Max Voltage: 200v
    Resistance at 10 Lux: 15 Kohms
    Typical Resistance 100 Lux: 3 Kohms
    Resistance Dark Minimum (1 minute): 0.5 Megohms

    Thanks in advance! :)
     
  2. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    try this website http://home.cogeco.ca/~rpaisley4/PhotoDetectors.html
     
  3. thingmaker3

    Retired Moderator

    May 16, 2005
    5,072
    6
    When the laser beam is interrupted, the light on the CSD will go from "bright" to "dark." The CSD resistance will respond by going from "less" to "more."

    If the CSD is part of a voltage divider, the voltage drop across the CSD will go from "less" to "more" as well. The circuit provided by Mik3 compares this change to a reference with the op-amp, using the op-amp output to turn on the LED. Your solenoid could be put in place of the LED and it's resistor, if your op-amp can sink enough current to close your relay.

    Another way to do this would be biasing a transistor with the voltage divider. An NPN bipolar transistor or an N-Channel MOSFET could be turned on by the change in voltage across the CSD. Either could control the current through your relay.
     
  4. Fixxxer

    Thread Starter Member

    Feb 15, 2007
    15
    0
    Excellent! That really helps a lot, guys. Thanks for the quick replies! :D
     
  5. Fixxxer

    Thread Starter Member

    Feb 15, 2007
    15
    0
    As suggested by thingmaker3, I decided to use a transistor as a switch in my circuit. However, I'm having some trouble...

    I was going to try using an LM339 dual voltage comparator (since I happened to have one on hand), as suggested in the link provided by mik3, but it looks like won't handle the 500mA (@ 24V) that my solenoid draws. So, I decided to use a 2N2222A transistor (datasheet) instead, since it can handle up to 800mA.

    Here is the circuit that I'm using. I replaced the LED and 470 resistor with my solenoid:
    [​IMG]

    I have also added a protection diode across the solenoid, as shown here:
    [​IMG]

    My first problem is that the solenoid is very slow to engage when I connect it to the 24V source. I can see it move a little, but it never fully engages. I'm guessing this has something to do with the two resistor values in my circuit, but I don't know enough about transistors (yet!) to really know for sure. I'm scared to play with the 10k variable resistor too much, since I've only got a few of these 2N2222A transistors and I've already managed to fry one.

    My second problem is that the transistor starts to get very hot after I connect the 24V source to the circuit. I'm guessing this is related to my first problem above... I haven't been able to take any multimeter measurements because I'm scared to leave the circuit connected to the battery for too long (I don't want to burn up the transistor).

    Can you provide any suggestions on what I might be able to try?
     
  6. Audioguru

    New Member

    Dec 20, 2007
    9,411
    896
    The transistor is frying because it doesn't get enough base current to completely turn on. The solenoid uses 500mA so the base current of the transistor must be about 50mA for it to turn on completely. If the LDR is dark then the total resistance from the base to the +24V should be (24V - 0.8V)/50mA= 464 ohms. If you use 470 ohms/2W then it should work.
    But then the LDR will fry when it is in the light.

    You need a darlington transistor instead of a transistor to drive the solenoid. A darlington transistor uses a very low base current. You can make a darlington with two 2N2222 transistors.
     
  7. thingmaker3

    Retired Moderator

    May 16, 2005
    5,072
    6
    Another option would be to drive the 2N2222 with the LM339. The comparator only needs a fraction of a milliamp on the inputs, and can provide more than the 7mA needed on the BJT base for 500mA collector current.
     
  8. Fixxxer

    Thread Starter Member

    Feb 15, 2007
    15
    0
    Thanks again for the quick replies, guys. I'm learning a lot here, so I really appreciate your help.

    Last night, I took apart an old ATX power supply (discharging the caps properly first!), and I happened to find two C4242 transistors (datasheet) in there!

    They're good for 400V/7A, so they should be more than suitable for my needs. I ran the figures on driving a C4242 from an LM339, but it turns out that the required base current for the C4242 (55mA) is more than the LM339 can output. So, I decided to give the Darlington Pair a try...

    Here are all of the figures that I came up with:

    LDR dark resistance:
    (Using ambient light as "dark", since I'll be using a laser as "light".)
    ~1.5kohm

    Supply Voltage:
    24V

    Solenoid current draw:
    (I checked a few more times, and it's a little higher than 500mA.)
    ~550mA

    Single C4242 hFE:
    10

    Darlington Pair C4242 hFE:
    10 * 10 = 100

    Base current @ saturation:
    (Ic / hFE)
    550mA / 100 = 5.5mA
    5.5mA + 30% (to be sure it saturates) = 7.15mA

    Base voltage @ saturation:
    1.4V (assuming 0.7V for each C4242)

    Resistor value needed:
    (24V - 1.4V) / 0.00715A = 3161ohm (3.161kohm)


    The only number that I had to guess at was the C4242's base voltage at saturation. From what I've been reading, 0.7V appears to be the standard, but I'm not really sure if that's true for all transistors or if it varies...

    So if my math is right, the two transistors should saturate and activate the solenoid when the two resistors in my circuit diagram (above) are less than or equal to 3.161kohm. Does this look right to you guys?
     
  9. Audioguru

    New Member

    Dec 20, 2007
    9,411
    896
    hFE is used on a linear transistor that has plenty of collector to emitter voltage. Nearly all transistors have a max saturation voltage drop spec'd when the base current is 1/10th its collector current.
    550mA collector current needs a 55mA base current to fully saturate all transistors with that part number. Some will require less base voltage if you bother to test them all.

    In a darlington transistor the output transistor has a high collector current and a high saturation voltage. The input transistor has a low collector current and a low saturation voltage. Most darlington transistors have their max saturation voltage drop spec'd when their base current is 1/250th of the collector current.
     
  10. nomurphy

    AAC Fanatic!

    Aug 8, 2005
    567
    12
    You have plenty of voltage to work with, use an N-ch mosfet and you can use higher value resistors.

    For example, use an IRF540 and hit the gate with +5V or more to turn on the solenoid. Keep it under +2V to make sure it is off.

    It would be a better design to use a comparator to drive the xstr, the comparator would create a defintive turn-on/off point with a little hysterisis so it doesn't chatter.
     
  11. Fixxxer

    Thread Starter Member

    Feb 15, 2007
    15
    0
    It works!

    I ended up using the same Darlington Pair circuit that I described above, but the two resistors were changed to equal ~12.5k (one 10k resistor in series with one 5k variable resistor set at ~2.5k). That should give me enough room to play with the resistance to compensate for different lighting conditions.

    The solenoid is very quick to respond when the laser beam is broken, so it looks like we have a winner here!

    Thanks again for all of your help. I've really learned a lot! :D
     
Loading...