I am trying to build a circuit that can measure the gear box RPM using a QRD114 and a reflector wheel. The actual circuit is attached along with a circuit diagram. I ultimately want to control the gearbox to move at certain intervals, and measure RPM.
The anode connected to the 240 ohm resistor to the op amp.
I can’t get it to show me the RPM of the reflector wheel.
int sensor = 0;
volatile long timeStoreA;
volatile long timeStoreB;
double stall = 100;
timeStoreA = 0;
timeStoreB = 0;
long deltaT = abs(timeStoreA - timeStoreB);
long revs = deltaT*6.;
long RPM = 60./revs * 1000000.;