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


Joined Sep 17, 2013
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.


Joined May 20, 2015
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.


Joined Jun 6, 2011
Or you can just connect it directly to the input, depends on the need for fast edge transitions.
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.


Joined Jul 18, 2013
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.
Last edited: