Read simple ENCODER

Hello all,

I want to read a simple pulse encoder with the auxiliar processor but I only find code to read a quadrature encoders.
What is the solution?
How can I do to read the freqüenci of the encoder?

Thanks

Hello. I assume you are asking about the Orangutan SVP robot controller, but in general you should always tell us exactly what product you are asking about when you ask for help.

The auxiliary processor on the Orangutan SVP can read quadrature encoders, but not simple frequency encoders or tachometers. You could write some code for the main processor to read the encoder frequency. To do this, you could use pin change interrupts to detect transitions on the signal line, and use the OrangutanTime module of the Pololu Library to count the number of transitions within a particular time period.

–David

Isn’t possible to use pulse_to_microseconds(get_last_high_pulse(0)) for example in my case to know the time/frecuency of pulse?

Yes, that would give you a measurement of speed (but not position). If there is a chance of your encoders having different duty cycles, you would be better off using pulse_to_microseconds(get_last_high_pulse(0) + get_last_low_pulse(0)). Note that when the robot is stopped, this won’t work very well. And of course, don’t forget to initialize the library. Full documentation is here:
pololu.com/docs/0J18/8

What frequencies are you expecting from the encoder? If it’s too high, this solution won’t work.

–David Grayson