REV Absolute PWM Encoder

Hi all,
I am currently planning on using this REV Absolute PWM Encoder for my robotics application. I am currently making a swerve drive for a robotics application and am using a REV NEO motor to turn the module and a hoverboard motor for the drive. I was able to use the hall effect sensor to control speed but not to control position. Either way, I would like to use an absolute encoder for the turn motor and the one I chose is a PWM encoder ranging from the 0-1024us pulse.

Is there any way to implement a PWM absolute encoder with the ODrive firmware? If not is there a way I could add custom support and if so by guidance.

Thank you,
Devin Willis

Hi Devin,

PWM encoders are not supported (AFAIK)
Also, if that encoder has a 0-1ms pulse width, then it has a maximum possible sample rate of 1kHz, which is not sufficient to serve the ODrive’s 8kHz FOC control loop.

Oh, I see. I did some testing last night using the REV encoder in ABI mode and I was able to calibrate the motor and the encoder. I had the encoder on the output shaft of a 16:1 planetary gearbox. When I started trying to tune the PID I was having some interesting issues compared to when I just used the Hall Effect sensor in the NEO motor I was using. It wasn’t until later I realized this was due to the backlash of the gearbox and the lack of coordination between the encoder and the motor cycles.

Knowing this I have seen a few people talk about using two encoders. The hall effect internally then another encoder for actual position control. The only problem I have with this is it seems to remove the option for a second motor which I definitely need.

I only need to use the secondary absolute encoder to move the output shaft of the gearbox to the proper location. I was thinking I can just use the PID and hall effect sensor of the NEO motor to control speed and position. Then I can recalculate my desired position based on the current position of the Hall effect sensor and the current position of the absolute encoder on the output shaft. This would be able to be done at a much lower rate as it is a one-time measurement and calculation so not directly involved in the control loop.

Does this sound like it would be possible. I could potentially use another Arduino and read position from there and send it to the Jetson Nano that will be controlling the Odrive and then integrate these calculations at a higher level. However, it would be much better to integrate directly into the Odrive firmware using one of the methods described here.

Actually, After thinking about it more I realized what I really need is an abstract way to read the current PWM signal. I don’t need any lower-level integration with the movement I can just do that on my controller. But I would like to read the PWM directly on the Odrive and return it using CAN command or serial commands rather than having to use another Arduino.

It might be possible to write support for PWM encoders, potentiometers etc. as load encoders (serving the position loop only) especially after the encoder class refactor that the devs are planning.
Also, it will soon be possible to use absolute SPI encoders as load encoders.

Or you could do it off-board as you say, but that may be a bit complicated.