You are here

PWM encoder support

3 posts / 0 new
Last post
Ieton2hahw
Offline
Last seen: 4 months 2 weeks ago
VESC Free
Joined: 2019-04-05 05:29
Posts: 2
PWM encoder support

I'm looking for a magnetic encoder solution that works from 0 speed and is robust to EMI for a combat robot. I think the PWM signal from an AS5047U will work for this. I'm interested in implementing the code for this and contributing it. I'm looking for some feedback on how to implement that.

Reasons I'm doing something new: With ABI you have to spin the motor open-loop after power-on or reset, which interacts poorly with drivetrains (jerkiness at the start) and flywheels (hard to make it move open loop). I'm also seeing a lot of noise (usually not enough to have trouble spinning up enough to switch to sensorless, but it's still concerning). This is with shielded sensor cables; unshielded ones don't work at all. I've seen enough reports of noise problems with SPI I'm ruling that out. My VESCs end up fairly far from the encoders for space reasons, and the EMI inside these robots is terrible.

TIM3 (the one used for ABI when that's enabled) supports measuring the on time and period of a PWM signal. I'm planning to use that on the A encoder input pin.

The PWM signal from this encoder is effectively a duty cycle, which is capped at under 100% (so you can always find the beginning), and has a lower bound for error detection. It has a nominal period of around 1.8 ms. How should the encoder code handle receiving a pulse length indicating an error, or not receiving any pulses for some timeout?

Any interest in adding parameters for nominal period, minimum duty cycle, and maximum duty cycle to make this configurable for other absolute PWM encoders? For example, the US Digital M3K could be used with different values for those numbers.

frank
Offline
Last seen: 1 week 3 days ago
VESC BronzeVESC FreeVESC GoldVESC OriginalVESC PlatinumVESC Silver
Joined: 2016-12-27 20:19
Posts: 847

AS5047 is supported already.

Ieton2hahw
Offline
Last seen: 4 months 2 weeks ago
VESC Free
Joined: 2019-04-05 05:29
Posts: 2

I only see support for the AS5047 over SPI. Which sensor port mode are you thinking of for PWM support?