EFeru / hoverboard-firmware-hack-FOC

With Field Oriented Control (FOC)
GNU General Public License v3.0
1.05k stars 876 forks source link

An unusual wheel. I need your help and an explanation. #492

Closed novval closed 1 month ago

novval commented 1 month ago

Variant

HOVERCAR

Control type

FOC

Control mode

None

Description

Hi friends!!! I came across an unusual wheel in which the hall sensors are positioned at 60 degrees, but the middle sensor is physically inverted 180 degrees, which is why the signal diagrams coincide with the diagrams of the hall sensors at 120 degrees. But the winding of the wheel windings is in the other direction. That's what I got with this wheel (left on photo). msg1895742494-6409 msg1895742494-6407 View from the side of the wheel axis. Clockwise Wheel with reverse winding and inverted middle hall: The normal wheel (right in the photo)
... ...
h: 2, H: 5, ~ABC: 010, ABC: 101, P: 0 h: 2, H: 5, ~ABC: 010, ABC: 101, P: 0
h: 3, H: 4, ~ABC: 110, ABC: 001, P: 1 h: 3, H: 4, ~ABC: 110, ABC: 001, P: 1
h: 1, H: 6, ~ABC: 100, ABC: 011, P: 2 h: 1, H: 6, ~ABC: 100, ABC: 011, P: 2
h: 5, H: 2, ~ABC: 101, ABC: 010, P: 3 h: 5, H: 2, ~ABC: 101, ABC: 010, P: 3
h: 4, H: 3, ~ABC: 001, ABC: 110, P: 4 h: 4, H: 3, ~ABC: 001, ABC: 110, P: 4
h: 6, H: 1, ~ABC: 011, ABC: 100, P: 5 h: 6, H: 1, ~ABC: 011, ABC: 100, P: 5
h: 2, H: 5, ~ABC: 010, ABC: 101, P: 0 h: 2, H: 5, ~ABC: 010, ABC: 101, P: 0
... ...
SPDA:-724 SPDL:-724 SPDA:674 SPDL:674
Counterclockwise (INVERT_L_DIRECTION) Wheel with reverse winding and inverted middle hall: The normal wheel (right in the photo)
... ...
h: 2, H: 5, ~ABC: 010, ABC: 101, P: 0 h: 2, H: 5, ~ABC: 010, ABC: 101, P: 0
h: 6, H: 1, ~ABC: 011, ABC: 100, P: 5 h: 6, H: 1, ~ABC: 011, ABC: 100, P: 5
h: 4, H: 3, ~ABC: 001, ABC: 110, P: 4 h: 4, H: 3, ~ABC: 001, ABC: 110, P: 4
h: 5, H: 2, ~ABC: 101, ABC: 010, P: 3 h: 5, H: 2, ~ABC: 101, ABC: 010, P: 3
h: 1, H: 6, ~ABC: 100, ABC: 011, P: 2 h: 1, H: 6, ~ABC: 100, ABC: 011, P: 2
h: 3, H: 4, ~ABC: 110, ABC: 001, P: 1 h: 3, H: 4, ~ABC: 110, ABC: 001, P: 1
h: 2, H: 5, ~ABC: 010, ABC: 101, P: 0 h: 2, H: 5, ~ABC: 010, ABC: 101, P: 0
... ...
SPDA:-711 SPDL:711 SPDA:669 SPDL:-669

where: h - halls = hall_ul << 2 | hall_vl << 1 | hall_wl; H - ~h P - vec_hallToPos_Value[halls]

I went through 36 combinations of phase wires and hall sensors. In combinations where the wheel rotates well, the brake works like a gas. In other combinations, the brake, although it tries to slow down, but the rotation is bad, with a bang. In SPD mode, when you press the gas, the wheel spontaneously accelerates to the maximum, and does not react to the brake.

If I change the sign of speedAvg in the calcAvgSpeed() [util.c] function, then the brake starts working correctly. But in SPD mode, as before, when pressing the gas, the wheel spontaneously accelerates to the maximum, the brake leads to a shock change of rotation at maximum rpm.

Do I understand correctly that a correction is required in the Speed_Estimation block?

Please tell me how can I fix this problem with the C code? Thank you!

novval commented 1 month ago

The problem is solved. It is necessary to invert the signals of all three hall sensors. Thanks pawelbu (https://web.telegram.org/a/#1699048505)