Ways of interfacing a speed sensor (phototransistor) with a microcontroller

Discussion in 'General Electronics Chat' started by Xavier Pacheco Paulino, Jun 29, 2018.

  1. Xavier Pacheco Paulino

    Thread Starter Active Member

    Oct 21, 2015
    647
    68
    Hi,

    Attached are two ways of reading a phototransistors speed sensor. One uses a comparator LM393 and the other uses simple a Schmitt-trigger inverter. Which one is more suitable? Using the 74HC14 looks cheaper and easier.
     
  2. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    9,484
    2,296
    Depends on Vcc and whether or not you have a use for the other gates in the 74HC14 package. Both circuits will do the job, but note that the 74HC14 has an absolute maximum supply voltage of 7V.
     
  3. Sensacell

    Moderator

    Jun 19, 2012
    2,267
    723
    Or you can just connect it directly to the input, depends on the need for fast edge transitions.
     
  4. Bordodynov

    Well-Known Member

    May 20, 2015
    2,100
    639
    See
    2018-06-29_15-14-39.png
     
    Alex1965 likes this.
  5. Xavier Pacheco Paulino

    Thread Starter Active Member

    Oct 21, 2015
    647
    68
    To be honest, I can't get it.
    Why do you simulate that pair of optocoupler (U1 and U2)?
     
  6. Bordodynov

    Well-Known Member

    May 20, 2015
    2,100
    639
    Simply the circuit on the two optocouplers is much faster than on one. Although, as I understand it, you do not need it. But I modeled one of the options discussed.
     
  7. Xavier Pacheco Paulino

    Thread Starter Active Member

    Oct 21, 2015
    647
    68
    Alright, got it. But I just have one phototransistor, so your model U8 is the one suitable even though is slower.
     
  8. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    4,139
    6,065
    Many MCUs have built-in comparators and adjustable references on chip. Often, the comparator output can be configured to also control one or more timers with very little code.

    I try to eliminate as much analog front-end as possible these days. It makes for more flexible, lower-cost, and higher reliability designs.
     
  9. Xavier Pacheco Paulino

    Thread Starter Active Member

    Oct 21, 2015
    647
    68
    I will just consider connecting the output directly to the microcontroller input.
     
  10. MaxHeadRoom

    Expert

    Jul 18, 2013
    17,732
    5,390
    I use the slot opto's connected directly to the Micro input, either a 10k pull up or down as needed.
    Usually used in conjunction with the TMR1 external clock in.
    There is also the pic18F2331/4431 that has inputs geared to encoder input, quadrature etc.
    Max.
     
    Last edited: Jun 29, 2018
Loading...