IR sensor

Is ti possible or am i asking for too much

Maybe. You provided almost no information. No range of RPMs, no link to the sensor you're using, no hint what else your doing in that "other program". Without this information you're the only one who can estimate if your project is feasible.