The hysteresis of comparator.

Discussion in 'Analog & Mixed-Signal Design' started by iONic, Dec 2, 2018.

  1. iONic

    Thread Starter AAC Fanatic!

    Nov 16, 2007
    1,444
    70
    I have built this tile circuit to test the hysteresis potential for turning on an LED and eventually a 110V AC socket with an LED light bulb(albeit dimable.)
    After adjusting the 2k pot for the desired light sensitivity I still had trouble getting the LED to turn full on or full off. There are areas of light that make the LED on only partially.

    Any clues as to what may be causing this?

    Also: what would be the best isolation for interfacing this circuit with a socket with AC mains voltage...Opto > TRIAC?? Wait, I have a few SSR's...that should do it.

    DALwH.PNG
     
    Last edited: Dec 2, 2018
  2. AlbertHall

    AAC Fanatic!

    Jun 4, 2014
    6,648
    1,556
    You need to connect pin 1 to pin 4.
     
  3. iONic

    Thread Starter AAC Fanatic!

    Nov 16, 2007
    1,444
    70
    As per your instructions I tied pin1 to pin4(ground).

    Observations:
    When PR1 is tied to Vcc & R1 is tied to GND, varying the 2k Pot will "pop" the LED on or off, but no amount of light or darkness changes the LED's state.
    When PR1 is tied to Vcc & PR1 is tied to GND, varying the 2k Pot will VERY SLOWLY turn the LED on or off, but no amount of light or darkness changes the LED's state.
     
  4. Ylli

    Member

    Nov 13, 2015
    401
    103
    Definitely need pin 1 grounded. Now add a 1K pull-up between 7 and pin 8. Change the 470 ohm on the base of Q1 to 4.7K. May need to reduce the hysteresis by increasing the 100k resistor up to as high as 1 meg. If the LED does not go out completely, add a signal diode (1N4148) between Q1 emitter and ground.
     
    iONic likes this.
  5. iONic

    Thread Starter AAC Fanatic!

    Nov 16, 2007
    1,444
    70
    The output of the 311 seems to be transistor based. Do I need to drive an additional transistor to operate the LED?
     
  6. Ylli

    Member

    Nov 13, 2015
    401
    103
    Actually, no you do not. May need to swap the LDR and R1 to get the direction of 'sense' you want.
     
  7. iONic

    Thread Starter AAC Fanatic!

    Nov 16, 2007
    1,444
    70
    :)Yes, I Tied the PR High and the resistor, R1, Low so that when darkness falls, the light comes on.
    Also swapping the 470 Ohm resistor to 4.7k didn't do much, visually, nor did the 1N4148. Not sure if the pull-down resistor did anything, but the value of the hysteresis resistor(100k) was changes first to 470k(sometimes did not register the same on/off state with the same light. So I increased to 820k and all is working nicely right now! I should have known to look for this issue...the thought did pass through my skull, but I blew it off!

    Looking good Ylli!
    Thanks
     
    Last edited by a moderator: Dec 2, 2018
  8. BobaMosfet

    Senior Member

    Jul 1, 2009
    399
    91
    This is not a useful circuit for working with AC and mains voltages, particularly for light dimming. An SCR is the correct thing to use, but you need to understand that for A/C you must have a zero-cross detector circuit so that you switch only when AC is zero volts. This eliminates all kinds of problems, voltage spikes etc, and gives you a means to isolate using and opto-isolator.
     
    cmartinez likes this.
  9. iONic

    Thread Starter AAC Fanatic!

    Nov 16, 2007
    1,444
    70
    I was ready to use the output to drive a Solid State Relay. Was this not an acceptable method?
    Does an SCR include a "zero-cross detector?"
    Do you have any suggestions on where to obtain the knowledge you recommend?
     
  10. ScottWang

    Moderator

    Aug 23, 2012
    6,414
    991
  11. danadak

    Well-Known Member

    Mar 10, 2018
    1,886
    394
    The LM311 is not RR (Rail to Rail) input, so operation outside the CM (common mode) limits
    of the inputs not predictable. There are modern parts with RRI capability.

    upload_2018-12-3_6-18-30.png


    Regards, Dana.
     
    iONic likes this.
  12. AnalogKid

    AAC Fanatic!

    Aug 1, 2013
    7,060
    1,996
    1. The 311 has an open collector output stage. You need to add a pull up resistor from pin 7 to Vcc to supply base current to Q1.

    2. The 311 does not have a "rail-to-rail" input stage. What is the resistance range of the photoresistor?

    ak
     
  13. cmartinez

    AAC Fanatic!

    Jan 17, 2007
    5,557
    6,612
    If the TS intention is to trigger a TRIAC (of a couple of back-to-back SCRs), then it would be simpler if he were to use a driver with an integrated zero volt trigger feature, such as the MOC3063M, instead of designing his own.
     
    iONic likes this.
  14. eetech00

    Senior Member

    Jun 8, 2013
    1,212
    245
    Hi

    This circuit is really not appropriate for driving/dimming an AC load.

    Should use a Triac with zero crossing trigger as suggested in Post #13.

    eT
     
  15. Ylli

    Member

    Nov 13, 2015
    401
    103
    Come on guys. The TS is not using this to drive an AC load, he is going to use it to drive the input of a SS relay to turn a light on and off. It may not be the most elegant circuit to create the final results, but it will work OK and the TS challenged himself to come up with a functional circuit.

    The relay will take care of the zero crossing issue, and keeping the inputs to the 311 within their common mode range should not be an issue.
     
  16. BobaMosfet

    Senior Member

    Jul 1, 2009
    399
    91
    Actually the ZC I'm referring to, does not use an SCR- It isn't a dimmer, it's just a detector. But many commercial dimmer designs do, which is OK. They use the SCR because the AC signal keeps causing it to unlatch. Which is fine, and you can use it to latch as well. But the best place to start your PWM is at ZC, and you need a detector for that.

    And as it happens, I found it:

    You can find answers in the forums here. I pointed one out in this thread that will give you exactly what you want, and is opto-isolated. Does not use an OpAmp, that's just the question the original TP had asked about.

    https://forum.allaboutcircuits.com/...-ic-to-measure-frequency.146659/#post-1251323
     
    Last edited: Dec 3, 2018
  17. iONic

    Thread Starter AAC Fanatic!

    Nov 16, 2007
    1,444
    70
    The circuit originally posted did not include any opto-isolation or TRIAC/MOSFET Driver parts yet. This was to be added in the second stage of the build.

    Something to this effect...
    isolation.PNG

    Either the above or a SSR @ 3-15VDC > 240VAC 5A (CX240D5)

    also: there will be no dimming of the lighting in this circuit. My mistake in mentioning that the LED 110V light bulb might be dimable. I want to make it "reverse" compatible to Tungsten and Florescent lighting as well.
     
    Last edited: Dec 3, 2018
  18. AlbertHall

    AAC Fanatic!

    Jun 4, 2014
    6,648
    1,556
    Er, yes, ummm...
    I hope the load is connected between this circuit and the mains, otherwise there will be a bang and smoke!
     
  19. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    8,836
    2,071
    The body diode of the FET will conduct in alternate half cycles, regardless of the opto output state.
     
  20. AlbertHall

    AAC Fanatic!

    Jun 4, 2014
    6,648
    1,556
    I was expecting it to be triac and didn't even notice that it wasn't :oops:
     
Loading...