Shop OBEX P1 Docs P2 Docs Learn Events
Propeller Schmitt Trigger Inputs — Parallax Forums

Propeller Schmitt Trigger Inputs

Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
edited 2007-11-11 23:28 in Propeller 1
In another thread the Propeller's lack of a Schmitt trigger input option was mentioned. With one spare pin and a few resistors, however, it's possible to convert as many inputs (to be read individually) to Schmitt trigger inputs as you want. In the following schematic, A0 to A2 are Schmitt triggered inputs, and A3 is the feedback pin. Before reading any pin, set A3's output state to the state last observed on the pin being read. This provides the positive-feedback biasing required to create a hysteresis band.

attachment.php?attachmentid=50352

Using 4.7K input resistors and 470K feedback resistors, you will get about a 1% hysteresis band. Lower-valued feedback resistors will increase the hysteresis.

-Phil
277 x 129 - 1K

Comments

  • deSilvadeSilva Posts: 2,967
    edited 2007-11-09 05:29
    Quite ingenious! An idea of your own? The corresponding hardware solution would require a flipflop for each port..

    It works to nearly upto Rin = Rfeedback...
    But note that bandwidth - as always - is constrained by your sampling intervalls; it will not work if the signal changes faster.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-11-09 07:56
    deSilva,

    Right. It's only effective if you sample at the Nyquist rate or faster.

    This is a technique I came up with years ago to sample phototransistor outputs from a wind instrument. There were four fan blades arrayed in the cardinal directions, each with a 50/50 black/white disk on the hub and an IR emitter/receiver pair. The "virtual Schmitt triggering" used five pins on a PIC: four for input and one for feedback.

    -Phil
  • Graham StablerGraham Stabler Posts: 2,510
    edited 2007-11-09 14:10
    very clever
  • Don DDon D Posts: 27
    edited 2007-11-09 14:10
    I nominate this as a worthy entry for the good thread index.

    Maybe a one-source compilation of ingenious virtual circuitry would be useful for the prop community?
  • deSilvadeSilva Posts: 2,967
    edited 2007-11-09 18:54
    ANY compilation of the 1001 things from this forum would be useful smile.gif
  • Fred HawkinsFred Hawkins Posts: 997
    edited 2007-11-09 20:28
    (Well duh) Or more properly, when stuff goes over my (yours too?) head, fall back on Wiki for an explanation.

    In electronics, a Schmitt trigger is a comparator circuit that incorporates positive feedback.
     
    When the input is higher than a certain chosen threshold, the output is high; when the input is below another (lower) chosen threshold, the output is low; when the input is between the two, the output retains its value. The trigger is so named because the output retains its value until the input changes sufficiently to trigger a change. This dual threshold action is called [b]hysteresis[/b], and implies that the Schmitt trigger has some memory. 
    
    The benefit of a Schmitt trigger over a circuit with only a single input threshold is greater stability (noise immunity). With only one input threshold, a noisy input signal near that threshold could cause the output to switch rapidly back and forth from noise alone. A noisy Schmitt Trigger input signal near one threshold can cause only one switch in output value, after which it would have to move to the other threshold in order to cause another switch.
    

    http://en.wikipedia.org/wiki/Schmitt_trigger
  • OzStampOzStamp Posts: 377
    edited 2007-11-11 02:19
    Hi Fellow Proppers



    Single gate schmitt trigger input for Propeller or other.
    The TLC555 low volts 555 timer makes an excellent real schmitt trigger also.

    Big note * the input to output is INVERTED ..

    Added the image as well in jpeg· ..
    Thnx for the pointer John T

    Will be in touch with you later.. just got back from Sydney.

    Cheers
    Ron·· Melbourne Oz
    Home of the PropBus ...





    <!--EndFragment -->

    Post Edited (OzStamp) : 11/11/2007 4:59:02 AM GMT
    255 x 217 - 41K
  • QuattroRS4QuattroRS4 Posts: 916
    edited 2007-11-11 02:26
    Ron,
    Seems to be an issue with 'Snippy0001.jpg'

    John T

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    'Necessity is the mother of invention'
  • Beanie2kBeanie2k Posts: 83
    edited 2007-11-11 06:59
    What's wrong with a 4093?
  • OzStampOzStamp Posts: 377
    edited 2007-11-11 07:10
    Hi Beanie

    Nothing wrong with a 4093..

    Also chips like 40106· + 4584··are fine also.

    Maxim even has some dedicated pushbutton schmitt/debounce chips..

    Philips and I believe TI also have some single gate Schmitt chips..
    From memory they are called PICO gates ...or similar.

    PHiPi circuit idea is really cool and does work.

    We did something similar with the SX chip and the comparator in/output
    we sampled an analog signal via a resistor divider and had a trip point.
    Some feedback and it created a handy signal for a "battery charge or no charge.."

    cheers

    Ron Melbourne Oz
  • deSilvadeSilva Posts: 2,967
    edited 2007-11-11 07:51
    This has become a little bit confusing now..
    ANY chip able of bi-stable states (which generally means containing a kind of flip-flop) can be utilized as a Schmitt trigger. What Phil showed you was, how a Schmitt trigger worked! The standard circuit is this one below.

    He especially pointed out that using the speed of the Propeller (to fulfill Nyquist criteria) and its internal memory, just ONE feed back line suffices to emulate MANY Schmitt Trigger inputs.

    If someone is interested I can post a list of 300 chips with Schmitt-Trigger input and two or three circuits of how to build a Schmitt trigger from transistors...

    Post Edited (deSilva) : 11/11/2007 9:36:13 AM GMT
    315 x 197 - 4K
  • deSilvadeSilva Posts: 2,967
    edited 2007-11-11 08:21
    OzStamp said...
    ..We did something similar with the SX chip and the comparator in/output
    we sampled an analog signal via a resistor divider and had a trip point.
    Some feedback and it created a handy signal for a "battery charge or no charge.."

    I cannot see the connection at the moment... What is "similar"? The use of a resistor? Handlng of an analogue signal?
  • Fred HawkinsFred Hawkins Posts: 997
    edited 2007-11-11 08:22
    OzStamp said...

    Philips and I believe TI also have some single gate Schmitt chips..
    From memory they are called PICO gates ...or similar.

    TI has many (1 gate, 2 gate and 3 gate versions, inverting or not...) This one is their little logic chip for 3.3v and·has 3 gates.

    http://focus.ti.com/docs/prod/folders/print/sn74lvc3g17.html

    To poke around in their little logic chips, try this finder tool

    http://focus.ti.com/paramsearch/docs/parametricsearch.tsp?familyId=339&family=logic&uiTemplateId=SZVI_T
  • Beanie2kBeanie2k Posts: 83
    edited 2007-11-11 08:26
    Cool. cool.gif I was a bit mystified because some of the proposed solutions seemed to me a bit over-complicated. I guess it's another case of the "green eyeshades syndrome" caused by doing electronics design at for-profit companies for too long. shakehead.gif
  • deSilvadeSilva Posts: 2,967
    edited 2007-11-11 08:35
    @Beanie2k: You were mystified by what? And what "de-mystified" you?

    Post Edited (deSilva) : 11/11/2007 9:34:52 AM GMT
  • OzStampOzStamp Posts: 377
    edited 2007-11-11 11:37
    Hi De Silva

    My last comment was in reference to my posting months ago.
    Suggestion similar to Phils suggestion.
    I added this principle to a SX 28 circuit see post
    http://forums.parallax.com/forums/default.aspx?f=7&m=204932

    cheers Ron
  • deSilvadeSilva Posts: 2,967
    edited 2007-11-11 12:56
    @Ron: I see. You created a 1.5 bit DAC to generate 1.5, 2.5, or 3.5 V and used it as a comparator reference input, something not available at the Prop.

    The basic idea Phil used for his Schmitt-trigger was using the - single - trigger point of a Prop input by biasing the signal (which in fact is not reactionless, but high value resistors will do their part....)

    So your batterie charge monitor could look something like this on the Prop:
                .---.
                |   |  1M
                |   |  ___
                |   >-|___|-. 470k
                |   |       | ___
                |   <-------'|___|-<
                |   |
                |   |
                '---'
    (created by AACircuit v1.28.6 beta 04/19/05 www.tech-chat.de)
    

    Post Edited (deSilva) : 11/11/2007 1:04:08 PM GMT
  • bambinobambino Posts: 789
    edited 2007-11-11 20:13
    Very nice Phil,
    I have been thinking of Schnitt-Triggers this week. I was toying with the idea power supplies. Using a zener to bias an op amp running the gate of a Mosfett in a buck topography. The constant swithing is getting the fett to hot because it doesn't really let it shut off. I was hopeing to get a comparator and keep it anolog, but it's nice to know the Prop could fill in the gap.

    I am not fimiliar with Nyquist criteria however, Is that speed compatable with Buck switching?
  • Mike GreenMike Green Posts: 23,101
    edited 2007-11-11 20:33
    bambino,
    Do a web search on "wiki nyquist" and "wiki nyquist frequency" and you'll get a much better explanation than I can provide.
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2007-11-11 21:14
    Clever idea, Phil, and good for counter inputs where the edges are slow or noisy.

    I was thinking about how that could be applied to the COG counters, but came up short. The EDGE detect feedback modes of the counters have negative feedback, B := !A1. Even if there were a positive feedback mode, B := A1, or if one were to put a fast inverter on the B pin, there would still be a runt pulse, due to the one cycle delay, and that would cause the counter to increment when that runt pulse is tested as A1 & !A2. No go. It would take a counter mode that does not exist. (or just an external Schmitt trigger.)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • deSilvadeSilva Posts: 2,967
    edited 2007-11-11 22:50
    smile.gif That was also my first idea: Counters! But even if it worked you would need one for each channel... Phil's main idea is not a Schmitt trigger, but MANY Schmitt triggers.
  • bambinobambino Posts: 789
    edited 2007-11-11 23:03
    Mike,
    I don't know if it could work well or not. I am thinking you would need 50khz to 500khz for the PWM out. Is the prop nyquist capable of 25khz. At any rate I would still like to make it analog.
    A cool circuit none the less!!
  • deSilvadeSilva Posts: 2,967
    edited 2007-11-11 23:13
    @Bambino: If you are talking of the Schmitt algorithm there is no PWM.

    (a) You set the feedback to the old value.
    (b) You read the input
    (c) You update the memory

    That's all.

    The issue is, when you do not come back often enough to this piece of code.
    Consider a drop of the line from 1 to 0 , and than going up to 1/2. You SHOULD read 0, but you do 1, if you do not get this drop. You will get it when you sample faster than twice the freqiency you are interested in (and to avoid aliasing, just use a hardware low-pass, best of second order. You see: Doing Schmitt triggering right in software is not exactly simple smile.gif

    But I think you can survive by spending a COG for updating the inputs. This could work @ 2 MHz/number_of lines.

    Post Edited (deSilva) : 11/11/2007 11:18:34 PM GMT
  • bambinobambino Posts: 789
    edited 2007-11-11 23:28
    No, PWM is a poor choice of words. I was just refering to the output signal controlling the mosfett signal being read by the Schmitt trigger. If hysterisis could be used to help buffer the switching frequency then the Fett might be able to run cooler.
    I don't know, It's just food for thought.
Sign In or Register to comment.