Need help with operation

Discussion in 'The Projects Forum' started by crash563, Feb 25, 2013.

  1. crash563

    Thread Starter Member

    Feb 25, 2013
    47
    1
    Can anyone help with the operation of this circuit in the PDF file. RX and Ry are photocells. The main idea is that when RX and Ry see the same amount of light, the comparator should give a low signal.
     
    • Doc1.pdf
      File size:
      154.1 KB
      Views:
      14
  2. #12

    Expert

    Nov 30, 2010
    16,247
    6,742
    As long as Rx and Ry are zero, you will get nothing useful.

    The LM339 is an open collector device. It's output is, "no current" until the negative input pin is at a higher voltage than the positive input pin. Then, the output transistor becomes, "on" and the voltage at the output pin becomes close to zero as the chip dumps the current provided by R4.

    Apparently the "photocells" are variable resistance devices. You are supposed to adjust VR1 until you get the right response.
     
    Last edited: Feb 25, 2013
  3. crash563

    Thread Starter Member

    Feb 25, 2013
    47
    1
    the nominal values under a controlled lighting make Rx and Ry equal 600ohms
     
  4. #12

    Expert

    Nov 30, 2010
    16,247
    6,742
    In that case, I'd change VR1 to 1k to make the adjustment less temperamental.
     
  5. crash563

    Thread Starter Member

    Feb 25, 2013
    47
    1
  6. WBahn

    Moderator

    Mar 31, 2012
    17,715
    4,788
    This circuit will not do what you want. This circuit is a hysteretic comparator that will have two transition points. A HI->LO and a LO->HI. When the output of the comparator is LO, the voltage on the non-inverting input will be at the LO->HI transition threshold. Since it is an inverting comparator, all we know about the input voltage (the voltage at the invering input) is that it is somewhere higher than this voltage. Once the input voltage drops below this threshold, then the comparator changes state and goes HI and the voltage at the non-invering input changes to a higher threshold, which is the HI->LO threshold. So, to switch states again, the input voltage must rise not only above the threshold that caused the last switch, but a higher threshold. The same is true in reverse once it does cross that higher threshold -- the threshold changes back to the lower LO->HI threshold.

    Between these two thresholds, the output could be either HI or LO, so you don't know.

    If you are truly wanting to know when the two are seeing equal light (within some tolerance), then you need a window comparator.
     
    #12 likes this.
  7. crash563

    Thread Starter Member

    Feb 25, 2013
    47
    1
    I understand that to calculate these thresholds are also diffacult i beleive due to the change in inputs if i can be given a general set of equations that can be used to calculate the thresholds and input values it can also really help me.
     
  8. crash563

    Thread Starter Member

    Feb 25, 2013
    47
    1
    After configuring the circuit in the pdf file the circuit will not respond to changes from the photocells
     
  9. #12

    Expert

    Nov 30, 2010
    16,247
    6,742
    For Vin ~4.5V and Vout is either 0 or 9 V
    Ifeedback is 4.5/1010000= 44.55ua.

    impedance at the positive input is 10300 ohms.
    for V=IR, the change in input voltage caused by the feedback current is 44.55ua x 10300 = .046 volts

    It's all Ohm's Law.

    correction: that math was for half a flop. When the circuit flops from 0 to 9 or 9 to 0, the difference in the threshold voltage will be twice as much....092 volts
     
    Last edited: Feb 25, 2013
  10. crash563

    Thread Starter Member

    Feb 25, 2013
    47
    1
    I totally lost please help
    I dont understand how it really works
     
  11. WBahn

    Moderator

    Mar 31, 2012
    17,715
    4,788
    But what's the point?

    The circuit you show will not do what you say you want it to do, which is to give you a LO output when the light seen by the two sensors is equal. So why go down a rabbit hole only to discover, at the end of the day, that you have a circuit that doesn't do what you want?

    Are you even clear on what you want?

    If sensor A is seeing considerably less light than sensor B, what do you want the output to be?

    If sensor A is seing about the same amount of light as sensor B, what do you want the output to be?

    If sensor A is seeing considerably more light than sensor B, what do you want the output to be?
     
  12. crash563

    Thread Starter Member

    Feb 25, 2013
    47
    1
    sensor A seeing less light the output is low.
    if seeing the the same amount of light the ouput is low
    sensor A seeing more light the output is high
     
  13. crash563

    Thread Starter Member

    Feb 25, 2013
    47
    1
    even after simulation and building on a breadboard that is not the case. The output goes high
     
  14. #12

    Expert

    Nov 30, 2010
    16,247
    6,742
    There is nothing on the drawing you presented that says, "sensor". Please clarify.
     
  15. crash563

    Thread Starter Member

    Feb 25, 2013
    47
    1
    rx an ry are photocells'
     
  16. #12

    Expert

    Nov 30, 2010
    16,247
    6,742
    True. Now, which one is sensor 1 and which one is sensor 2?
     
  17. crash563

    Thread Starter Member

    Feb 25, 2013
    47
    1
    sensor 1 is Rx and sensor 2 is RY
     
  18. #12

    Expert

    Nov 30, 2010
    16,247
    6,742
    Assuming you are using something like Cadmium Sulphide photocells that decrease resistance when light hits them, Rx (sensor1) (sensor A) is on the negative input and supplies current. When light hits Rx, it will decrease resistance and the voltage on the negative input will increase. When that voltage becomes more than the voltage on the positive input, the comparator will switch its internal transistor on and the voltage at its output will be close to zero. More light creates low output. This is backwards from what you asked for in post #12. One solution is to reverse the sensors with their resistors so that the resistors are connected to 9 volts on one end and the sensors are connected to ground on one end.

    As for what happens when the inputs are equal, this is a positive feedback circuit so the answer depends on the previous state of the comparator. The output will remain the same as it used to be (a few minutes ago) until the input voltage passes the voltage on the other input by .092 volts.
     
  19. WBahn

    Moderator

    Mar 31, 2012
    17,715
    4,788
    Okay, this definitely helps and it is very, very different than what you stated in your original post:

    That strongly implies that you want the comparator output to be low when they see the same amount of light and to be high otherwise, regardless of which one is seeing more light. This is further strengthened by the fact that you don't distinguish between Rx and Ry.

    Do you see the value and importance of clearly stating what you want the circuit to do?

    So, further to that end, you've now said that:

    The output should be LO when Sensor A is seeing the same or less light than Sensor B.

    You've also now indicated that Sensor 1 is Rx and Sensor 2 is Ry. Okay, now, which is Sensor A and which is Sensor B? I'm assuming that Sensor 1 and Sensor A are the same thing?

    The next thing is that while you've said that rx and ry are nominally 600Ω under controlled lighting, you haven't indicated whether this goes up or down as the amount of light increases. I imagine it goes down, but don't leave information like that out. We are NOT mind readers!

    Based on the revised specifications, you do not need a window comparator, but it is still unclear whether you need or want a hysteretic comparator. Do you want the switching point between LO to HI and HI to LO to occur as the amount of light seen by each sensor is the same?
     
  20. crash563

    Thread Starter Member

    Feb 25, 2013
    47
    1
    Ok that worked but how to calculate for the hystersis and threshold voltages
     
Loading...