You are here

PWM encoder support

5 posts / 0 new
Last post
Ieton2hahw
Offline
Last seen: 10 months 3 weeks ago
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: 3 weeks 6 days ago
VESC BronzeVESC GoldVESC OriginalVESC PlatinumVESC Silver
Joined: 2016-12-27 20:19
Posts: 847

AS5047 is supported already.

Ieton2hahw
Offline
Last seen: 10 months 3 weeks ago
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?

eptv
Offline
Last seen: 1 week 20 hours ago
VESC Original
Joined: 2018-10-21 21:20
Posts: 36

I saw https://github.com/vedderb/bldc/commit/c249d0affe7dcaacb8b7a43cd288a2b2f024449e#diff-1bc88b0bde7d6f755af2b914747a4e5ae8fb6e2bbd2bbf35e5f0fa28fe8d2b6d PWM encoder commit.
But zero information about connection and specially ABI + PWM encoder connection. This encoders installed by default into Taizhou Quanshun motors.

Please share some information about connection pins.

electricfox
electricfox's picture
Offline
Last seen: 5 hours 7 min ago
VESC Original
Joined: 2019-01-01 17:11
Posts: 146

Look at a standart Trampa VESC 6 for example and you will know.