Schmitt Trigger in conjunction with sensor circuit

Discussion in 'The Projects Forum' started by LearnMeElectricals, Nov 15, 2012.

  1. LearnMeElectricals

    Thread Starter New Member

    Nov 15, 2012
    4
    0
    Hello there,

    I am currently taking part in a group project which involves building a line following robot. I have been taking charge of sensors, and so far I have the following circuit working properly and reacting very well to passing over black lines on the ground.

    [​IMG]

    Apologies for the quality of the drawing, I just knocked it up in paint quickly. D1 is an IR LED and D2 is just a red LED for testing. PT is a phototransistor (which actually responds to both natural and infrared light, however in the original design a IR sensing photodiode was used hence the IR LED).

    The Op-amp being used is the LM324, and the reason for this is the quad inputs/outputs, as there will obviously be more than one sensor to operate the robot.

    But anyway to my predicament, it was suggested to me that I attempt to configure this circuit to that of a schmitt trigger. Looking through the 324 datasheet, there is even an example of adding a slight bit of hysteresis to the circuit. However I am unsure how to implement it in this particular circuit, or calculate any values of positive feedback resistor with the sensor and the phototransistor. I feel like having the 10k pot may also have an impact on this, although I may of course be wrong.

    So if anyone has anyone hints/tips to help me that would be greatly appreciated. Also please do tell me whether you think this is even a good idea to be going for, or if it is unnecessary. This is my first real electronics project and some of the decisions you have to make turn out to be more instrumental than I ever thought they would.

    Thanks for any help,

    LearnMeElectricals
     
  2. tubeguy

    Well-Known Member

    Nov 3, 2012
    1,157
    197
    Connect the pot wiper through a 10k resistor instead of direct to the + input of the op amp.
    Then add maybe a 100k or larger resistor from the opamp output to the + input to provide some positive feedback. You could use a large value pot instead - 500k ??
     
  3. tubeguy

    Well-Known Member

    Nov 3, 2012
    1,157
    197
    Without hysteresis the threshold (switching point) of this comparator circuit is at the voltage set at the + input of the opamp.
    With hysteresis the two points are separated .. the + input is a little higher when the output is Hi and a little lower when the output is Lo. This make the makes the circuit less susceptible to false triggering.
     
  4. LearnMeElectricals

    Thread Starter New Member

    Nov 15, 2012
    4
    0
    Okay ill give it a shot, but could you give some sort of indication of where you pulled these values from, was it some kind of calculation or merely some well experienced estimations? Not that I doubt what you are saying, it would just be nice to understand exactly why these values were being chosen.
     
  5. tubeguy

    Well-Known Member

    Nov 3, 2012
    1,157
    197
  6. MrChips

    Moderator

    Oct 2, 2009
    12,420
    3,355
    To follow up, there are many ways to come up with component values:

    1) Copy the value from another circuit
    2) Calculation
    3) Experimentation, real as well as simulation
    4) Experience

    Take for example the 390Ω resistor in series with D2.
    Calculate the minimum and maximum value for this resistor if the highest current is 20mA and the lowest current is to be 1mA, while assuming the voltage drop across the LED D2 is 2.5V and the supply voltage is 5V. Use Ohm's law.

    Now you have a range for R. Next experiment with values within this range and select the one that gives you the desired brightness.

    Now look at the 200Ω resistor in series with the IR emitter D1. Do the same with this and find a minimum and maximum resistance. In this case, you cannot see the IR light emitted. You have to wait until you do the next step.

    You now have to look at the 160kΩ resistor in series with the photo transistor.
    You have shown this on the emitter side. You can also put this resistor on the collector side, i.e. interchange the transistor and the resistor. (I am assuming the PT is NPN. You did not show). Experiment. The performance of the photo transistor is highly dependent on this resistor. Measure the voltage at this output node while varying the value of this resistor. Move the robot on both sides of the line and watch the output voltage measured. Experiment.
     
    Last edited: Nov 16, 2012
Loading...