question for the seasoned

Discussion in 'The Projects Forum' started by fredric58, Dec 9, 2014.

  1. fredric58

    Thread Starter Member

    Nov 28, 2014
    143
    0
    Hi, I am new to electronics, I am also ADDICTED! It is so cool. Here's the deal.....I can read a schematic, I know what the components are, and individually, I have a good idea of what they do. How they "party" together is a different story and why I am here to LEARN. My project is a dark sensor switch that will activate a 9v circuit AND POWER IT. (that's important)

    I have studied OP AMPS and COMPARATORS, PHOTO TRANSISTORS, PULL UPs, RELAYS, VOLTAGE REGULATORS, POSITIVE FEEEDBACK and pretty much anything to do with this circuit. I have come close, but have yet to succeed. In ALL the tutorials the only thing ever powered is an LED. And I can build such a circuit. BUT!!!

    What I WANT to build is:
    1. a dark activated switch. ? (WHICH photo sensor is BEST? there are different kinds....)
    2. powered by 12v (a car battery)
    3. There is a converter, which converts 12v to to 5v to run the SWITCH circuit, (BECAUSE..... that's the only circuit I am familiar with) BUT!!!!!!! I NEED.... 9V OUT PUT from the ORIGINAL 12 volts. OK? Not to power an LED. There are tons of these circuits on youtube........
    4. It has to be an ON, or OFF switch (and have a hysteresis region) NO HUNTING.
    5. When it is "ON"... it must deliver 9 VOLTS, (from the original 12 v) to ANOTHER circuit.

    I am hoping that someone might know how to do this. I can "almost" do this, But like I said all the tutorials only power an LED. 2-3 (+-) volts. and I need 9v. A steady 9v..... Thanks to anyone who may respond and who may be able to help. Your input is GREATLY appreciated.

    NOT sure if I created the thread correctly, if not, let me know.
     
  2. Papabravo

    Expert

    Feb 24, 2006
    10,136
    1,786
  3. fredric58

    Thread Starter Member

    Nov 28, 2014
    143
    0
    You are correct, voltage regulator. And yes. I can regulate 12v to 9v with out any problem and power my 9v device. I just have to "be there" to turn it on. I don't want to be there.
    I have built this DARK SENSOR switch that is designed to operate on 5v, and power an LED. It's based on a LM331 comparator and it works just like I want it to. It is a true ON or OFF switch that doesn't hunt. But I do not know how to modify it to handle

    12v in -> dark sensor switch -> 9v out, OR if it is even possible?
     
  4. Papabravo

    Expert

    Feb 24, 2006
    10,136
    1,786
    Your schematic shows an LM339 Quad comparator, but your text says LM331. Never heard of an LM331, so I'll assume meant LM339. The output stage of an LM339 is an open collector. That means it can use any voltage to define the high state. All you need is a pullup resistor to +9VDC. It could also be any other voltage allowed by the datasheet.
     
  5. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    5,773
    1,103
    It would be easy to modify your dark sensor circuit, but it would help to know how much current does your 9V circuit draw?

    Edit: What tolerance does the 9V have?
    Edit2: Do you want the 9V circuit to be ON or OFF when it is dark?
     
    Last edited: Dec 10, 2014
  6. fredric58

    Thread Starter Member

    Nov 28, 2014
    143
    0
    lm339 is a quad, the lm331 is a single comparator. would the circuit pictured need to be powered by 9v to produce a 9 v output? and if it were, what equation would be used to select the pull up resistor to determine v out.

    Alec T, hi, it is designed to run off a 9v battery and the circuit will be on at dark.
    Also, can I eliminate the 500k pot at the top and use a voltage divider, like (2) 10k's? that would put me at 50% as a reference?
     
    Last edited: Dec 10, 2014
  7. Papabravo

    Expert

    Feb 24, 2006
    10,136
    1,786
    LM331 is the single equivalent of the LM339 or LM393 -- got it.
    EDIT: Woops....the LM331 is not a comparator, but a voltage to frequency converter. Shame on me for taking you at your word.

    The output is still an open collector, but I'm not at all sure the function inside is what you want.


    http://www.ti.com/lit/ds/symlink/lm331.pdf

    You can power the comparator(LM339,LM393) with any voltage that you choose, and that choice determines the range of inputs that the comparator will respond to. You need to be careful when both inputs are close to either of the supply rails. Output inversion can be the result. The output of an open collector stage is not related to the power supply for the part. It is determined by the supply voltage that the pullup resistor is connected to.

    Example you power the comparator with [+12V, GND] and pullup the output to +9V
    The size of the pullup resistor is not critical and is chosen based on the load it is driving. If you want the output to sink say 15 mA then you would use
    Code (Text):
    1.  
    2. 9Volts / .015 Amperes = 600 Ohms
    3.  
    Then you pick one of the closest available values, which for 1% resistors looks like 590 Ohms or 604 Ohms
     
    Last edited: Dec 10, 2014
  8. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    5,773
    1,103
    Yes, but how much current does it draw? 10mA? 100mA? .....? If the 9V battery is a PP3 then presumably only a few mA. What does the driven circuit do? Your answer will determine the best/cheapest sort of output driver transistor needed.

    Edit:
    You could do that, but then you'd have no adjustment to take account of the different responses of different photocells to a given light level, or to to set "how dark is dark".
     
    Last edited: Dec 10, 2014
  9. BobTPH

    Active Member

    Jun 5, 2013
    782
    114
    You will need to use the output of the comparator to drive a transistor or relay to switch power to your 9V circuit.

    The easiest way is to use an N-channel MOSFET between the 9V load and its ground connection. You would tie the gate to the output of the comparator and the pullup resistor, which could be 10K. The your circuit will be powered when the comparator output is high.

    If your circuit needs the ground to be absolutely 0V, you could switch the high side using a P-channel MOSFET. In this case, you circuit would be powered when the comparator output is low.

    Bob
     
  10. fredric58

    Thread Starter Member

    Nov 28, 2014
    143
    0
    MY BAD on the LM331. like I said, I am very new to this and am here for guidance and to learn. So lets back up to the beginning. The device draws 40mA during operation.
     
  11. MrChips

    Moderator

    Oct 2, 2009
    12,420
    3,355
    Did you mean an LM311 comparator?
     
  12. fredric58

    Thread Starter Member

    Nov 28, 2014
    143
    0
    I may have transposed the numbers, I ended up with a 331 though. I'll go back and double check my notes. Anyone have a link to a good read on comparators? I'm having trouble understanding the pull up resistor. because the +5, 470, LED and grd make a complete path? The LED isn't always on but I think it should be/or would be????
     
  13. Papabravo

    Expert

    Feb 24, 2006
    10,136
    1,786
    You forget we have not seen your schematic, only the one with the LM339. BTW you will never get an LM331 to work like a singe comparator from the LM339. So put them aside for another project.

    For perhaps the third time do you know what is meant by an open collector output stage? Without this crucial piece of knowledge all the rest of your efforts will be useless.
     
  14. fredric58

    Thread Starter Member

    Nov 28, 2014
    143
    0
    It's the first time! and why I asked in a previous post if anyone had a link to an explanatory of comparators. I AM new to electronics. and I do not mind studying at all. I am not particular to any specific circuit. I simply need to have one that will serve my purpose. I will use a 12v car battery, it will regulate to 9v, go through a dark sensor switch and power a 9v device that has a power draw of 40 mA's. Upon finding such a circuit, I will compare it to the one I have presented. Take it apart, analyze it, and see if I can figure out the difference in the circuitry and WHY. With or with out help I will succeed. I am just that determined and ornery. Yes I know the 331 will not do what I want. Think of me like Edison, I will figure it out despite myself... So what can you tell me about the collector output stage? but MORE importantly.... can you explain it in a manner that can be understood by a layman? Some teach, some do...GOOD teachers.....are PRICELESS.

    I'm now an Unemployed senior with No income.
     
  15. Papabravo

    Expert

    Feb 24, 2006
    10,136
    1,786
    Why not try the eBook associated with the forum. It will probably do a better job with pictures and drawings than I can do with words. I'm sorry my words mean nothing to you, but I hope that one day soon you can come back to them and understand their meaning.

    Try here for starters
    http://www.allaboutcircuits.com/vol_4/chpt_3/2.html
     
  16. iimagine

    Active Member

    Dec 20, 2010
    129
    9
    To understand this, you would have to learn how a transistor work. You can bias a transistor with one voltage source and having its collector switching another voltage source.
     
  17. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    5,773
    1,103
    This mod of your circuit should do what you want :-
    Light-switched9Vreg.gif
    When the photocell is dark (darkness level set by Trim1) the 339 output is low, turning on Q1 and Q2. The load is driven by Q2 emitter. A fraction of the load voltage is derived by voltage divider R6/R7. If the fraction exceeds 2.5V the shunt regulator TL431A conducts, pulling down the base voltage of Q2 and hence the load voltage and thus stabilising it. R6 and R7 are selected such that when the load voltage is 9V the fraction tapped off is 2.5V. R2 provides positive feedback to give the comparator hysteresis and prevent hunting.
    The zip file attached is for simulation with LTspice and includes models for a generic photocell and the TL431A.
     
  18. fredric58

    Thread Starter Member

    Nov 28, 2014
    143
    0
    Papi, thanks for the link to the e-book, I have a much better understanding, not a complete, but better. Alec I will check it out.
     
  19. fredric58

    Thread Starter Member

    Nov 28, 2014
    143
    0
    Alec, I am going to guess here as I can't find a schematic that indicates which poles of the TL431A go where. I know one is reference, one the anode and one is the cathode. K to grd? A to to 560? ref to r6 & r7 divider? It's the last component. I know it is as simple as base emitter and collector is for transistors, just can't find anything to indicate which part of the symbol is what..... Thanks
     
  20. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    5,773
    1,103
    Not like that.
    From the datasheet :-
    TL431A-pinout.gif
     
Loading...