Use of REV Through Bore Encoder (REV-11-1271) Absolute Output with RoboRIO

The REV through-bore encoder advertises an absolute pulse output with a 1025us period with the pulse time varying from 1 to 1024us, linearly scaling from 0-360 degrees of rotation. This would be great to use, as it reduces required inputs to a single Digital I/O and carries the benefits of a hex-bore absolute encoder (for relatively cheap), but I’m unsure of the best way to take this as input onto the RoboRIO.

I’ve considered a couple methods so far:

  • Use a simple RC low-pass filter to filter the pulsed output to an analog value, and use this as analog input to the RIO. Unfortunately, the signal frequency is low enough that a fast filter would have significant voltage variation, and this feels like a generally hacky solution.

  • Use the Counter class in WPILib to measure the rising-rising edge time and the rising-falling edge time and compare them to each other to get the value of interest (as described by Ether and Jared Russel). As I understand it, this would involve instantiating two Counter objects in the kSemiPeriod mode, on the same digital input, setting setSemiPeriodMode() to true and false on the rising-falling and rising-rising time counters respectively, and taking the ratio of getPeriod() for each, multiplying by 360 to get output in degrees). Not sure if there would be problems with using two Counters on the same digital input, or if the class has nuances to its usage beyond what I know now.

Has anyone else used this encoder, or have any thoughts on usage of its absolute output with the RIO?

I agree with your thoughts on the RC filter, would not recommend.

Measuring the exact pulse width with the Counter class would work. However, I would also take a look at the DutyCycleEncoder class.

1 Like

Use DutyCycleEncoder. This style of absolute output was exactly the reason this feature was added to the RoboRIO FPGA and WPILib this year.

4 Likes

Beautiful - thanks for the reference, didn’t know that was added this year. Should work great.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.