IR reflective sensor to measure shaft rpm

i want to use the qtr-1rc ir reflective sensor to measure the rpm of a brushless DC motor. the motor is black, so i was thinking of using a white strip on the motor so that its detected as the motor rotates. however, i am new to arduino and programming. can someone please help me with this. thanks

Hello.

You might be able to use a QTR-1RC reflectance sensor to measure the RPM of a motor, but it will take some programming. Because of the way the QTR-1RC sensor functions, the output node needs to first be charged by applying a voltage to the OUT pin, then the voltage needs to be removed, and the time it takes for the voltage to decay due to the integrated phototransistor can be measured. You might be able to use some of the methods in our Arduino library for the QTR reflectance sensors to write some code that measures RPM, but it would probably be much easier to use a QTR-1A sensor instead. The QTR-1A sensor outputs an analog voltage, so the output should more closely resemble an encoder signal.

Brandon

Hi,

Thank you so much for your quick reply. I was hoping to use your code to measure the rpm by measuring the frequency of the colors (1,-1) changes. I tried my motor with the a white strip on it. The QTR sensor did detect it and at different speeds. Is there a way that I can change the serial print to show the rpm by using the frequency of how quickly it changes between black and white? Any advice would be greatly appreciated. I will also look into the QTR-1A as you suggested.

Thank you

You should be able to change the code to display the RPM of the motor. One way to do that would be to use a variable as a counter to keep track of how many times the sensor detects the change from black to white over a certain amount of time, then multiply that variable by an appropriate number to scale it to how many revolutions would happen in 1 minute. For example, if your counter measures 50 revolutions in 15 seconds, you can multiply it by 4 to get 100 RPM.

Brandon