0
\$\begingroup\$

I am trying to create a comparator on the Teensy 3.2 to convert an IR receiving diode signal from analog to digital. Currently I am using an op amp, but that takes extra space and extra power, both of which should be limited for my application. The circuit is below (instead of putting output to LED, it goes to pin on microcontroller)

IR receiver

I'm still new to microcontrollers, and tried reading the reference manual for the microcontroller. I can see it has this function, but I'm not sure how to implement it. I thought their might be prebuilt libraries for the Arduino IDE, but had trouble finding the right thing.

The IR system is measuring the rotation of a propeller, and I would just like to have the system count how many times a blade blocks light from the emitter by looking at the falling edge of the IR receiver signal after digitizing. (In the end, too, I plan to power both off of a PWM with as low as possible duty cycle. This could affect how I do the counting in the end)

For a comparator, do I need to create the signal to compare to with a resistor divider? How do I know which teensy pins correspond to the comparator input signal? Could I set it digitally in some way in the MCU registers, avoiding the need for more circuit parts?

Does the output of the comparator come from a certain pin? Can I set it up to cause in interrupt instead and not use that pin, so that it executes code in the program and thats it? Is there a way to make the comparator output stay in a fixed state when the LEDs are both powered off?

Thanks for the advice!

\$\endgroup\$
  • \$\begingroup\$ What is your expected blade frequency? A two bladed model airplane propeller at 10K rpm would be ~333 Hz, though 3 times faster and nearly ten times slower could also be seen. This suggests a common remote-control type ~38 KHz modulated IR system with appropriate demodulating receiver may work. This would handle not only the digital thresholding but also reject a lot of background noise. However it could also turn out that propeller shadow is too narrow and fleeting to register as a signal gap. \$\endgroup\$ – Chris Stratton May 2 '17 at 22:17
  • \$\begingroup\$ If you have to do it from scratch, you'll want a highpass filter, however for a throttleable engine/motor the range may pass through powerline frequency and its rectified double, which could be a source of interference from lights. \$\endgroup\$ – Chris Stratton May 2 '17 at 22:18
  • \$\begingroup\$ Blade frequency is aboutt 200-400hz max, still tbd. Propeller shadow is fine with the op amp. Its a wind speed sensor, shouldnt have worries about powerlines. I couldnt understand the purpose of modulated remote control IR system? It seems more complicated than what I need. \$\endgroup\$ – Alex K May 2 '17 at 22:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.