You are here

Hall sensor table

6 posts / 0 new
Last post
spacemango
Offline
Last seen: 4 years 4 months ago
Joined: 2020-05-14 09:47
Posts: 11
Hall sensor table

Could someone explain the hall table in FOC mode to me? I understand that one revolution is 200 degrees instead of 360 and that the hall table entry somehow corresponds to the placement of the hall sensors.

In BLDC mode the hall table was easy to understand. Hall table [1] is the hall output between 0 and 60 degrees and so on if I understand everything correctly. So the values I got there were -1 2 1 3 5 4 6 -1.

I tried to convert these values to the FOC mode by taking (200/6)*2, (200/6)*1, (200/6)*3 and so on but that didn't really work great. 

Any idea how to do this?

My biggest concern is with the values -1/255 in hall table entry 0 and 7. Could someone explain that please?  

pf26
Offline
Last seen: 5 days 12 hours ago
VESC FreeVESC Silver
Joined: 2018-12-04 08:44
Posts: 53

During Hall Sensor detection in FOC mode, the motor turns slowly according to the set current vector (Id), and the Hall sensor response (3 bits corresponding to each of the three sensors being on or OFF, make 8 combinations, among which only the ones with one or 2 sensors ON are possible). Than the VESC averages the angle for each sensor combination it sees, leaving to 255 the ones that never occured. Indeed, the angles are adjusted to 200 corresponding to 360° - most likely to fit a Uint8_t and leaving space to 255.  If you look at the code in mcpwm_foc.c, you notice it is tricky to make angle averages, especially around 0 - 360°... 

This method assumes that the rotor position follows the Id current precisely, which is only true when unloaded, and also not so good if the motor BEMF is not sinusoidal.. I think itmay be better to rotate the motor a bit faster (in each direction) to make detection for these motors.

spacemango
Offline
Last seen: 4 years 4 months ago
Joined: 2020-05-14 09:47
Posts: 11

So during detection VESC uses the back-emf to get the angle? 



How should I do this if I do it without the detection? I have an oscilloscope so I can check the hall output, which I have already done. Then I get 2 6 1 4 3 5 in decimal numbers. But how do I know where to put this in the hall table? Do these correspond to hall table [1] to [6]? Are [0] and [7] always 255/-1? 

pf26
Offline
Last seen: 5 days 12 hours ago
VESC FreeVESC Silver
Joined: 2018-12-04 08:44
Posts: 53

The VESC does not use the back emf here (it would be very low at that kind of speed anyway). It just sets a rotor angle by adjusting the current amongst the 3 motor phases.

Yes, your numbers correspond to the hall table entries. [0] and [7] are left to 255 because they never appear (because there is always at least one hall sensor ON, and never 3)

Eric
Offline
Last seen: 1 year 11 months ago
Joined: 2017-08-28 10:27
Posts: 16

It is possible to increase the angle resolution by 25% by changing 200 to 250 in:

hall_table[i] = (uint8_t)(ang * 200.0 / 360.0);

 

pf26
Offline
Last seen: 5 days 12 hours ago
VESC FreeVESC Silver
Joined: 2018-12-04 08:44
Posts: 53

You probably can. But you certainly need to make some other changes accordingly - where the hall sensor table is used..