Announcement

Collapse
No announcement yet.

Non inverting Schmitt Trigger question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Non inverting Schmitt Trigger question

    Good day folks. Pretty complicated project on my hands here, so please bare with me, as there's no way I can keep it brief: I need to design a circuit which only triggers (its output goes high) when a certain voltage threshold is reached. Of course, we're looking at a Schmitt trigger.
    I looked into it and thanks to Dave from EEV, I kinda grasped the concept of how they work and how you build one with an op amp, however when it comes to actually simulating it and putting it to the test, it gets extremely complex.
    In his tutorial, Dave demonstrated an inverting Schmitt trigger, meaning its output goes high when the input goes low and vice versa - I don't need that. What I need it to do is go high when the input is high, so we have the non-inverting configuration for that (I started off with wiki here). The inverting input is grounded and the non-inverting one is connected to two resistors: R1 goes to the input (my control signal) and it forms a divider with R2 which comes from the output of the op amp. Now it's time for the math, which is where my head starts spinning as always. The formula for the upper and lower thresholds appears to be, though I may be wrong, UT or LT (upper or lower)=(R1/R2)*Vs, where Vs is the maximum voltage the op amp can reach. This theory appears to be correct and a crude simulation seemed to work. I tried it as follows: R1 is 1k, R2 is 10k and the upper rail of the op amp is 10v...calculate that and I get a threshold of 1, meaning the output swings negative when the input is roughly -1v and it goes back to positive when it goes to 1v....good.....but not so fast :|
    You see, everything I read and tried so far demonstrates a split-supply circuit, where the op amp has both + and - voltage rails. In other words, the output can swing both positive AND negative, while the inverting input remains the very middle (to 0v GND). This is where I'm facing difficulties, as my circuit is a single rail circuit, meaning there's no negative rail - instead the lowest I can go is ground or zero V, which messes up the math big time. From what I understand, there IS a way for this to work with a single-rail supply as well and it involves biasing: remember how earlier I said the inverting input was tied to ground (0v) ? Biasing apparently involves connecting the inverting input to a more positive voltage instead of ground, so now our thresholds are "shifted" away from 0v, with this biasing voltage becoming our new "zero" (halfway) point between the two thresholds so to say......confusing, I know. This is actually what I need help with: I came across a calculator which does the math for you (here), but it doesn't tell you the formulas and how it obtains those numbers, so it's only useful up to a point. When I provided those ideal round numbers, it worked perfectly and the math made perfect sense (see the above example: round numbers, positive AND negative rails, simple, perfect).
    However, when I could no longer "go negative" and the lowest I could go was 0v, I got stuck: set the "low threshold" to 0 (can't go lower than that), set the "High threshold" to 2 let's say, set the "Output voltage high" to 10v and the "Output voltage low" to 0 (so the op amp can now only go to GND): the resistor values I get are 2k and 10k.....that's fine, but this time, the calculator adds the biasing voltage as "Vref" further down as 1.667v. While I do understand what it does (it's exactly the biasing I was talking about), I COULD NOT figure out how it obtains those numbers and makes things even more annoying. Funnily enough, if I simulate using those numbers, it DOES seem to work. I came across a very complex and detailed paper here which has a lot of formulae but no examples and I really busted my balls trying to work them out...check out page 14, it's exactly what I'm interested in: a non-inverting Schmitt trigger with a reference voltage higher than GND (the reference can't be GND in my case, since my input can't swing lower than 0v). Formula 1.20: I can't work out how to derive Vref from that formula. In other words, I don't understand how the calculator gave me the value it did (1.667v). And of course these are all "rounded" examples - I'll need to have some stable formulae to adapt the numbers to my needs....once I get it down it will be easy. The first step is always the hardest is what they say Cheers guys and thanks for taking your time to help
    Wattevah...

    #2
    Re: Non inverting Schmitt Trigger question

    ever heard of FORMATTING?

    that's one brick of text in your post!

    Comment


      #3
      Re: Non inverting Schmitt Trigger question

      I think you mean a comparator? That has a precise trip point whereas a Schmitt trigger is fairly loose, imprecise. Both operate with max. gain and some hysteresis (positive feedback) for clean switching action.

      So using the inverting or non-inverting op-amp configurations is not done because you are reducing gain which gives soft or muchy trip points.

      I suggest looking at single-supply op-amp like LM358 or a LM339 comparator with PNP input transistors (which can take input to GND).

      You can also add a NPN to the op-amp's output to invert it.

      Comment


        #4
        Re: Non inverting Schmitt Trigger question

        LM393?
        http://www.bristolwatch.com/ele/vc.htm
        https://cdn.badcaps-static.com/pdfs/...a7d889d4ba.pdf
        http://home.cogeco.ca/~rpaisley4/Comparators.html
        Never stop learning
        Basic LCD TV and Monitor troubleshooting guides.
        http://www.badcaps.net/forum/showthr...956#post305956

        Voltage Regulator (LDO) testing:
        http://www.badcaps.net/forum/showthr...999#post300999

        Inverter testing using old CFL:
        http://www.badcaps.net/forum/showthr...er+testing+cfl

        Tear down pictures : Hit the ">" Show Albums and stories" on the left side
        http://s807.photobucket.com/user/budm/library/

        TV Factory reset codes listing:
        http://www.badcaps.net/forum/showthread.php?t=24809

        Comment


          #5
          Re: Non inverting Schmitt Trigger question

          Originally posted by stj View Post
          ever heard of FORMATTING?

          that's one brick of text in your post!
          Believe me it was even worse than that, that's why I put that disclaimer in the beginning :P
          Wattevah...

          Comment


            #6
            Re: Non inverting Schmitt Trigger question

            Originally posted by redwire View Post
            I think you mean a comparator? That has a precise trip point whereas a Schmitt trigger is fairly loose, imprecise. Both operate with max. gain and some hysteresis (positive feedback) for clean switching action.

            So using the inverting or non-inverting op-amp configurations is not done because you are reducing gain which gives soft or muchy trip points.

            I suggest looking at single-supply op-amp like LM358 or a LM339 comparator with PNP input transistors (which can take input to GND).

            You can also add a NPN to the op-amp's output to invert it.
            The LM339 is a quad op-amp, which is fine, but I still need to build that circuit around it and work out those numbers, right ? I mean is there a difference between a schmitt trigger and a comparator ? Of course there are PLENTY of differences, so don't shoot me for asking that, but they're both op-amp-based at their cores from what I understand.
            Wattevah...

            Comment


              #7
              Re: Non inverting Schmitt Trigger question

              Found another interesting article here. Page 18, equation 8 is what I'm interested in - calculating Vref.
              Wattevah...

              Comment


                #8
                Re: Non inverting Schmitt Trigger question

                That's a nice tech note on comparators.
                Their approach is to know the trip voltage and hysteresis.
                In that example, Vtrip=1.2v and Vhys=0.4V.
                The two resistors are calculated using 0.4V
                Next is Vref. Big equation says you need 1.3V reference to get an end result of 1.2V trip. The difference is due to the hysteresis and loading of RI.
                You could use a trim pot or voltage reference IC to make Vref.

                Comment


                  #9
                  Re: Non inverting Schmitt Trigger question

                  Dannyx, why not take a deep breath and start over. No amount of text is going to get your circuit designed, so why not post a block diagram of what you are doing? You will need a breadboard to lay out your project. Split supply is not a problem. Use a couple of 9v batteries, or 2 surplus wall transformers of the same voltage. You might or might not need a split supply - who can figure it out from your novel? The same goes for your Schmitt trigger. Maybe yes, maybe no. At this point it is rather useless to read data sheets and pick out part numbers.
                  Is it plugged in?

                  Comment


                    #10
                    Re: Non inverting Schmitt Trigger question

                    I did it on my own after all and put together something rather nifty and got it all figured out. Check it out: it's not quite polished yet, but it DOES work. I put together a few formulae to help out with general op amp configurations: there's one for calculating gain and there's the non-inverting comparator (which is what I've been trying to achieve all along). Of course, it's all numerical stuff, since everything will vary slightly in practice, but it should at least be in the ballpark. It will hopefully come in handy for someone else out there, so there - I did my homework
                    Attached Files
                    Wattevah...

                    Comment


                      #11
                      Re: Non inverting Schmitt Trigger question

                      Looks pretty good. This would be a typical building block for part of an actual circuit that does something. Usually, this circuit is called a comparator and it is most often assumed that comparators will have a small amount of positive feedback, especially for slowly changing input signals. Depending upon your actual project, it might be possible to do the same thing with a CMOS logic gate, or a couple of transistors. Keep us posted.
                      Is it plugged in?

                      Comment


                        #12
                        Re: Non inverting Schmitt Trigger question

                        Originally posted by Longbow View Post
                        Looks pretty good. This would be a typical building block for part of an actual circuit that does something. Usually, this circuit is called a comparator and it is most often assumed that comparators will have a small amount of positive feedback, especially for slowly changing input signals. Depending upon your actual project, it might be possible to do the same thing with a CMOS logic gate, or a couple of transistors. Keep us posted.
                        Yes of course. This is part of a larger project I'm working on, though I'm building it in "blocks" so to say, and this is one of them. What I'm trying to build is a device that rolls up my car windows when I lock it with the key fob....sounds boring, I know, and I AM aware you can get them pre-made, but I actually have one of these installed on my car and I'm not entirely pleased with how it works, mainly because it's pretty "dumb", in that it only rolls the windows for a fixed period of time - it doesn't take into account whether the window is actually down to require rolling up, in other words it doesn't do any sort of current sensing to determine if the window is already closed and the motor is basically jammed - it will try rolling it anyway which not only overloads the motor but also drains the battery. The problem sometimes also works the other way around: if the window IS all the way down and the device starts rolling it up, once the set time is up, it just stops, regardless of whether the window has fully closed or not, so sometimes I come back to my car only to realise one of the windows still has a little gap at the top - so goddamn frustrating, esp if it's raining and you just want to get inside without looking back to check.
                        Wattevah...

                        Comment


                          #13
                          Re: Non inverting Schmitt Trigger question

                          Yeah another wall of text came your way, but I much prefer giving all of the details instead of having people asking me to clarify some stuff. Cheers.
                          Wattevah...

                          Comment


                            #14
                            Re: Non inverting Schmitt Trigger question

                            Eh, well, wall of text will mean TLDR so you'll still need to clarify

                            Comment


                              #15
                              Re: Non inverting Schmitt Trigger question

                              Originally posted by eccerr0r View Post
                              Eh, well, wall of text will mean TLDR so you'll still need to clarify
                              Call me clueless, but what does TLDR mean ? I'm not really on all this internet lingo, other than maybe FYI, DIY LOL ROFL, etc
                              Wattevah...

                              Comment


                                #16
                                Re: Non inverting Schmitt Trigger question

                                Too Long, Didn't Read - yes, it's a real phenomenon.
                                Last edited by eccerr0r; 06-19-2017, 03:48 PM. Reason: Clarification ;-)

                                Comment


                                  #17
                                  Re: Non inverting Schmitt Trigger question

                                  It will part of the current sensing for the motor: when the current draw of the motor rises above a set threshold, the circuit will stop, since the window has reached the end of travel and mustn't "push" any further....at least that's the idea...I simulated something and it appears to work.
                                  Wattevah...

                                  Comment


                                    #18
                                    Re: Non inverting Schmitt Trigger question

                                    You will need to handle the inrush current when the power is first applied to the motor which will cause fault triggering, but that how you will learn with hands on once you put it to test in the real world.
                                    You need to find what the inrush current is and how long it lasts.
                                    Last edited by budm; 06-20-2017, 01:00 AM.
                                    Never stop learning
                                    Basic LCD TV and Monitor troubleshooting guides.
                                    http://www.badcaps.net/forum/showthr...956#post305956

                                    Voltage Regulator (LDO) testing:
                                    http://www.badcaps.net/forum/showthr...999#post300999

                                    Inverter testing using old CFL:
                                    http://www.badcaps.net/forum/showthr...er+testing+cfl

                                    Tear down pictures : Hit the ">" Show Albums and stories" on the left side
                                    http://s807.photobucket.com/user/budm/library/

                                    TV Factory reset codes listing:
                                    http://www.badcaps.net/forum/showthread.php?t=24809

                                    Comment


                                      #19
                                      Re: Non inverting Schmitt Trigger question

                                      Originally posted by budm View Post
                                      You will need to handle the inrush current when the power is first applied to the motor which will cause fault triggering, but that how you will learn with hands on once you put it to test in the real world.
                                      You need to find what the inrush current is and how long it lasts.
                                      Damn, that's true...didn't think of that :| Considering the windows have 30A fuses in the fuse box, I can imagine the current is quite high...understandably, since they're high torque motors. I need to come up with a circuit which only triggers once the current is maintained for longer than 1s or so, that is, when the window has definitely reached its end of travel...perhaps a capacitor that charges up and triggers a zener diode after its charged to a certain level...just a quick n' dirty idea that came through my mind as we speak.
                                      Wattevah...

                                      Comment


                                        #20
                                        Re: Non inverting Schmitt Trigger question

                                        Your description of the power windows is interesting. Depends upon how many functions are already controlled by the main computer. How much of the logic is local (inside the door itself)? All this logic CAN be implemented locally, but I would first ask if there is something faulty with the present setup?

                                        Another example is a powered antenna. My car has a local circuit attached to the motor. That circuit assumes that the antenna is in the down position when the car is shut off. In this case, the antenna is either all the way up, or all the way down. For your window, it seems like the motor should only be required to close the window when you lock the car, regardless of where the window might be. So the direction would only be "up". If the window is already all the way up, then the stall circuit will detect it.

                                        Since there is no mechanical limit switch, the up and down limit is a circuit that senses the stall current in the motor, and then shuts it off.

                                        If I have the antenna assembly on the bench, the measured inrush current is not an issue because the motor is relatively small and geared down. The circuit is designed to detect the limit condition by sensing a current peak that lasts for a certain length of time. The stall event can last as long as your design says it should for reliable detection. So, including special circuitry to detect startup (inrush) current is unnecessary. There is no micro on that board, either. Just a couple of relays and a few discrete transistors and other parts.
                                        Last edited by Longbow; 06-23-2017, 08:57 AM.
                                        Is it plugged in?

                                        Comment

                                        Working...
                                        X