Custom made IR RPM sensor

Hi all,

I built myself an infrared RPM sensor (although I’m quite bad at electronics). It works well with a teensy and I can quite accurately read the RPM with a custom program for that (see here).

I then moved to a Pixhawk and it doesn’t work anymore. The settings are fine because I get the 3000rpm when I hook an RC channel, so the problem may be in the signal from my sensor. Here some data:

  • An IR led lights the backplate of the propeller cone which is divided in 8 parts (4 whites, 4 blacks).
  • It is a voltage divider where the upper resistance is the IR sensor (changing from 1.7KOhm to 25KOhm when going from white to black)
  • The lower resistance is 6KOhm
  • In open circuit, powered with 5.3V, readings go from 1V to 4.1V
  • Using a voltmeter capable of reading frequencies, I can read the RPM easily

Now, when i plug the sensor to the Pixhawk (be sure settings are right cause I can read the 50Hz of a RC channel as 3000rpm when multiplier is 1), the two voltage readings are 2.2V and 3.5V and Ardupilot can’t get any RPM reading at all. It remains at -1.

As I said, I do not know too much about electronics, but… does it has something to do with pull-up and pull-down resistances? Am I missing something? I know teensies tend to make our live easier and may be missing something when bringing my sensor to the Pixhawk, but I hesitate trying things bravely to avoid frying my Pixhawk.


what are your RPM parameters? and have your reduced BRD_PWM_COUNT?

I don’t think it’s a parameters thing, but since it may help others (and, of course, I may be wrong):

BRD_PWM_COUNT,4 (meaning AUX5 (pin 54) and AUX6 (pin 55) are not RC out)
RELAY_PIN,-1 (to make sure AUX5 and AUX6 are not used as digital out)
RPM_MIN_QUAL,0.5 (make sure it is not zero!)
RPM_SCALING,1 (in my case it should be 0.25, but for now I don’t care)
RPM_TYPE,2 (pulses in)

Thanks for checking!

you certainly have the parameters side well in hand, all looks good to me, could just be the voltages then as you suspected. Is your IR sensor analogue? You can get them that trigger at a threshold, this would give you a nice square wave. Or you could add a transistor (no idea what sort would be good or how to wire it up, but there must be some examples on the net) to your current setup to give a nice trigger edge.

I wonder if the 1v to 4.1v isn’t resetting the RPM pin as a pulse. Would 0-3.1v be attainable?

I tried various combinations for the voltage divider and also with the power to the IR led (to widen the range of readings)… only at some point, while changing some connections, I got a reading of 700rpm for like 1 second matching the readings of my tester. Unfortunately I could not reproduce.

Finding the right voltage divider with the teensy was way easier, but this one here seems to be quite picky. I’ll set up a test bench and work it out more carefully.

I liked the introduction, and the story and was hooked. Then, the conclusion was missing. Can you followup with your resolution? I’m in the same “copter” so to speak. :slightly_smiling_face:

Thanks for your interest @akobelan. I didn’t move forward too much with that sensor and the Pixhawk. Maybe newer versions can handle it (as the sensor itself worked with a Teensy), so I may try it in the future. Still, I may be able to rescue the electronic drawings and parts number if you wan to try it yourself.


Thanks for responding @nicolaufg. I moved on to a pure Hall effect sensor. The two wire contact closure of a bike speed sensor was the wrong choice without ancillary hardware.

My implementation works but I did need to change RPM to rev/sec. and the 1 Hz filter, and the sample and hold.

Allan Kobelansky