4008/4010 brushless motor FOC development (2) ---- AS5600 magnetic encoder application

1. Introduction

In the process of rotating the brushless motor, it is necessary to accurately know the mechanical angle of the motor. At this time, an encoder is needed. AS5600 is a low-cost 12bit magnetic encoder, and the price of tb is 4 yuan. Compared with other It is very cheap, and the angle output methods include PWM, analog and IIC interface, generally IIC interface.
Valentine HP

2. Use of AS5600

The device address of AS5600 is 0x6c (8 bits), and it supports a maximum clock of 1Mhz, which exceeds the maximum clock of 400Khz defined by IIC.
The read angle register 0x0f stores the high 4 bits, and 0x0e stores the low 8 bits. The combination is exactly 12 bits of data, and the value 0-4096 represents 0-360 degrees. The code is as follows, very simple.

 uint8_t angle_l = iic_read_data(0x6c,0x0f);  // 0x6c,0x0f
 uint8_t angle_h = iic_read_data(0x6c,0x0e);  //0e

ValentineHP

3. AS5600 parameter calibration

The mechanical angle of the motor can be obtained by reading the two registers 0x0F and 0x0E through the IIC interface. At this time, the zero angle of the motor may not correspond to the zero angle read by the AS5600, and calibration is required.

Rotate the motor to the position you expect to be 0°, set the foc angle to 0°, set Uq a little larger, and then power on, you can see that the motor has a slight offset, at this time read the angle value X1 of AS5600, As a mechanical angle zero bias value. Then set the foc angle to 90°, power on, and read the angle value X2 of AS5600 again, then you can determine the number of pole pairs of the motor = (360 / ((X2 -X1)*4)). The conversion relationship between electrical angle and mechanical angle can be determined.

Welcome to follow the gzh below, reply to FOC, communicate, and get all the information

Guess you like

Origin blog.csdn.net/weixin_44678052/article/details/130416593