CN116298369A - Device and method for measuring motor speed based on non-contact magnetic rotary position sensor - Google Patents
Device and method for measuring motor speed based on non-contact magnetic rotary position sensor Download PDFInfo
- Publication number
- CN116298369A CN116298369A CN202310369208.XA CN202310369208A CN116298369A CN 116298369 A CN116298369 A CN 116298369A CN 202310369208 A CN202310369208 A CN 202310369208A CN 116298369 A CN116298369 A CN 116298369A
- Authority
- CN
- China
- Prior art keywords
- motor
- frequency
- position sensor
- pulse signal
- speed
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01P—MEASURING LINEAR OR ANGULAR SPEED, ACCELERATION, DECELERATION, OR SHOCK; INDICATING PRESENCE, ABSENCE, OR DIRECTION, OF MOVEMENT
- G01P3/00—Measuring linear or angular speed; Measuring differences of linear or angular speeds
- G01P3/42—Devices characterised by the use of electric or magnetic means
- G01P3/44—Devices characterised by the use of electric or magnetic means for measuring angular speed
- G01P3/48—Devices characterised by the use of electric or magnetic means for measuring angular speed by measuring frequency of generated current or voltage
- G01P3/481—Devices characterised by the use of electric or magnetic means for measuring angular speed by measuring frequency of generated current or voltage of pulse signals
- G01P3/487—Devices characterised by the use of electric or magnetic means for measuring angular speed by measuring frequency of generated current or voltage of pulse signals delivered by rotating magnets
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01P—MEASURING LINEAR OR ANGULAR SPEED, ACCELERATION, DECELERATION, OR SHOCK; INDICATING PRESENCE, ABSENCE, OR DIRECTION, OF MOVEMENT
- G01P3/00—Measuring linear or angular speed; Measuring differences of linear or angular speeds
- G01P3/42—Devices characterised by the use of electric or magnetic means
- G01P3/44—Devices characterised by the use of electric or magnetic means for measuring angular speed
- G01P3/46—Devices characterised by the use of electric or magnetic means for measuring angular speed by measuring amplitude of generated current or voltage
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Transmission And Conversion Of Sensor Element Output (AREA)
Abstract
Description
技术领域technical field
本发明涉及电机转速测量技术领域,特别涉及一种基于非接触式磁旋转位置传感器的电机转速测量装置及方法。The invention relates to the technical field of motor speed measurement, in particular to a motor speed measurement device and method based on a non-contact magnetic rotation position sensor.
背景技术Background technique
随着工业自动化与人工智能的快速发展,在当今的工业自动化装置中或家用电器设备中,电机得到了广泛地应用与发展。转速是电动机极为重要的一个状态参数,它的测量精度将直接影响电动机其它有关参数和特性的测试以及故障检测与诊断的准确性。With the rapid development of industrial automation and artificial intelligence, motors have been widely used and developed in today's industrial automation devices or household appliances. The speed is an extremely important state parameter of the motor, and its measurement accuracy will directly affect the accuracy of testing other related parameters and characteristics of the motor, as well as fault detection and diagnosis.
当前主要的测量方法有离心式转速表测试方法、测速发电机测速法、闪光测速法、光电码盘测速法、霍尔元件测速法等。在上述的方法中,大多要求同轴安装传感器且同轴度要求高,安装难度比较大。稍有偏斜,便影响最终读数。并且都是硬连接,不但存在机械磨损,而且降低了编码器与系统的使用寿命。霍尔元件测速法,虽不需要硬连接,但需要加工特制的测速转盘,并在主轴上开孔固定,安装工艺较为复杂,且精度不高,只适用于精度要求一般的场合。The current main measurement methods include centrifugal tachometer test method, tachometer generator speed measurement method, flash speed measurement method, photoelectric code disc speed measurement method, Hall element speed measurement method, etc. In the above-mentioned methods, most of the sensors are required to be installed coaxially and the coaxiality is required to be high, so the installation is relatively difficult. A slight skew will affect the final reading. And they are all hard connections, which not only cause mechanical wear, but also reduce the service life of the encoder and the system. Although the Hall element speed measurement method does not require hard connection, it needs to process a special speed measurement turntable and fix it with a hole on the spindle. The installation process is more complicated and the accuracy is not high. It is only suitable for occasions with general accuracy requirements.
常用的数字式转速采集计算方法主要有以下3种:M法(频率法)、T法(周期法)、M/T法(频率/周期法)。其中,M法,当被测转速较高或电机转动一圈发出的转速脉冲信号的个数较大时,才有较高的测量精度,因此M法适合于高速测量;T法,在被测转速较低(相邻两个转速脉冲信号时间较大)时,才有较高的测量精度,所以T法适合于低速测量;M/T法,是同时测量检测时间和在此检测时间内光电脉冲发生器所产生的转速脉冲信号的个数来确定转速。由于同时对两种脉冲信号进行计数,因此只有“同时性”处理得当,M/T法才能有较高的测速精度。Commonly used digital speed acquisition and calculation methods mainly include the following three types: M method (frequency method), T method (period method), and M/T method (frequency/period method). Among them, the M method has higher measurement accuracy when the measured speed is high or the number of speed pulse signals sent by the motor rotates a circle is large, so the M method is suitable for high-speed measurement; T method, when the measured Only when the speed is low (the time of two adjacent speed pulse signals is relatively large) can the measurement accuracy be higher, so the T method is suitable for low-speed measurement; the M/T method is to simultaneously measure the detection time and the photoelectric The speed is determined by the number of speed pulse signals generated by the pulse generator. Since the two pulse signals are counted at the same time, only when the "simultaneity" is properly handled can the M/T method have a high speed measurement accuracy.
经检索,专利公布号CN 104426439 A,发明创造名称:用于监测电机的旋转位置的方法和设备,该申请案监测来自所述脉冲型旋转位置传感器的信号输出以及与用于所述电动机的控制信号相关联的基准信号。基于公称转子位置、转子的公称旋转速度以及所述基准信号与来自所述脉冲型旋转位置传感器的信号输出的下降边缘之间的时间,确定与所述基准信号一致的所述电动机的转子的位置。该申请案使用的信号采集方法是在一段时间间隔内捕捉传感器脉冲信号的个数,速度的计算方法是M/T法。因此,该申请案存在适用于低分辨率脉冲型旋转位置传感器,测量精度不高,以及测量范围小,不适合高速测量,高速时脉冲信号发生振铃效应会导致测量不准确的问题。After retrieval, patent publication number CN 104426439 A, title of invention: method and device for monitoring the rotational position of a motor, the application monitors the signal output from the pulse-type rotational position sensor and is used for the control of the motor The reference signal to which the signal is associated. Determining the position of the rotor of the electric motor consistent with the reference signal based on the nominal rotor position, the nominal rotational speed of the rotor and the time between the reference signal and the falling edge of the signal output from the pulse-type rotary position sensor . The signal acquisition method used in this application is to capture the number of sensor pulse signals within a period of time, and the speed calculation method is the M/T method. Therefore, this application has the problem that it is suitable for low-resolution pulse-type rotary position sensors, the measurement accuracy is not high, and the measurement range is small, so it is not suitable for high-speed measurement. The ringing effect of the pulse signal at high speed will lead to inaccurate measurement.
发明内容Contents of the invention
1.发明要解决的技术问题1. The technical problem to be solved by the invention
针对现有技术中关于电机转速测量方案存在的,测速精度较差,测速范围较小,要求控制器系统严格同步,安装要求高的问题,本发明提供了一种基于非接触式磁旋转位置传感器的电机转速测量装置及方法。本发明使用模拟量采集方法,即采集信号电压,并经过快速傅里叶(FFT)变换算法,将时域信号转换为频域信号,再将脉冲的频率值转换为电机的转速,提高了转速计算的精度。Aiming at the problems existing in the motor speed measurement scheme in the prior art, the speed measurement accuracy is poor, the speed measurement range is small, the controller system is required to be strictly synchronized, and the installation requirements are high, the present invention provides a non-contact magnetic rotation position sensor A motor speed measuring device and method. The present invention uses an analog quantity acquisition method, that is, acquires the signal voltage, and converts the time-domain signal into a frequency-domain signal through a fast Fourier transform (FFT) algorithm, and then converts the frequency value of the pulse into the rotational speed of the motor, thereby improving the rotational speed. The precision of the calculation.
2.技术方案2. Technical solution
为达到上述目的,本发明提供的技术方案为:In order to achieve the above object, the technical scheme provided by the invention is:
本发明的一种基于非接触式磁旋转位置传感器的电机转速测量方法,其步骤为:A kind of motor speed measuring method based on non-contact magnetic rotary position sensor of the present invention, its steps are:
步骤一、采集电机旋转一圈输出的脉冲信号,基于该脉冲信号粗略地计算电机转速值;Step 1. Collect the pulse signal output by the motor for one revolution, and roughly calculate the motor speed value based on the pulse signal;
步骤二、结合电机粗略速度值,得到传感器A/B引脚输出的脉冲频率,基于该脉冲频率选择采样频率;Step 2. Combine the rough speed value of the motor to obtain the pulse frequency output by the A/B pin of the sensor, and select the sampling frequency based on the pulse frequency;
步骤三、基于采样频率,采集非接触式磁旋转位置传感器A/B引脚输出的脉冲信号电压值,并实时处理采样的数据;Step 3. Based on the sampling frequency, collect the pulse signal voltage value output by the A/B pin of the non-contact magnetic rotation position sensor, and process the sampled data in real time;
步骤四、对步骤三处理后数据进行FFT变换,再对变换结果进行复数求模值运算,求出各点的幅值,并选出幅值最大的点的序列n,基于该序列数获得传感器的A/B引脚输出的脉冲信号的频率F;Step 4. Perform FFT transformation on the data processed in step 3, and then perform complex modulo calculation on the transformation result to find the amplitude of each point, and select the sequence n of the point with the largest amplitude, and obtain the sensor based on the sequence number The frequency F of the pulse signal output by the A/B pin;
步骤五、根据传感器的A/B引脚输出的脉冲信号频率F,进行速度换算,获得电机转速值。Step 5: Perform speed conversion according to the frequency F of the pulse signal output by the A/B pin of the sensor to obtain the motor speed value.
更进一步地,步骤一中,将磁旋转位置传感器的径向充磁的圆形磁铁安装在非磁性圆形衬套中,将衬套固定在电机轴上并保持轴心一致;安装在电机轴上的磁铁,每旋转一圈输出一个脉冲信号,磁旋转位置传感器的Index引脚采集该脉冲信号,使用单片机引脚的中断功能,采集传感器Index引脚的脉冲信号,记录两个相邻脉冲的时间间隔ΔT,则电机粗略速度值 Furthermore, in step 1, install the radially magnetized circular magnet of the magnetic rotary position sensor in the non-magnetic circular bushing, fix the bushing on the motor shaft and keep the axis center consistent; install it on the motor shaft The magnet on the magnet outputs a pulse signal every time it rotates, and the Index pin of the magnetic rotation position sensor collects the pulse signal, uses the interrupt function of the single-chip microcomputer pin to collect the pulse signal of the sensor Index pin, and records the pulse signal of two adjacent pulses. time interval ΔT, then the rough speed value of the motor
更进一步地,步骤二中,首先确定磁旋转位置传感器的分辨率PPR,结合电机粗略速度值,得传感器的A/B引脚输出的脉冲频率f=PPR*V,选择大于2倍的脉冲频率f作为采样频率fs。Furthermore, in step 2, first determine the resolution PPR of the magnetic rotary position sensor, and combine the rough speed value of the motor to obtain the pulse frequency f=PPR*V output by the A/B pin of the sensor, and select a pulse frequency greater than 2 times f as the sampling frequency f s .
更进一步地,步骤三将采集的传感器的A/B引脚输出的脉冲信号电压值按照采样时间次序,依次存入采样缓冲区中,并实时从采样缓冲区中,以存储当前采样点数值的位置为起点,向前选取2048个采样点数值,进行限幅滤波。Furthermore, in step 3, the pulse signal voltage value output by the A/B pin of the collected sensor is sequentially stored in the sampling buffer according to the sampling time sequence, and the value of the current sampling point is stored in real time from the sampling buffer. The position is the starting point, and the value of 2048 sampling points is selected forward to perform limiting filtering.
更进一步地,步骤五将传感器的A/B引脚输出的脉冲信号频率F除以传感器分辨率,换算得到电机转速值。Furthermore, step five divides the frequency F of the pulse signal output by the A/B pin of the sensor by the resolution of the sensor to convert to obtain the motor speed value.
更进一步地,采样数据经过FFT变换后,得到相应的频率点幅值的实部和虚部,基于该实部和虚部求得相对应的A/B相的相位角,以该相位角判断电机转动方向。Furthermore, after the sampling data is transformed by FFT, the real part and imaginary part of the corresponding frequency point amplitude are obtained, and the corresponding phase angle of the A/B phase is obtained based on the real part and imaginary part, and the phase angle is used to judge Direction of motor rotation.
更进一步地,步骤四选用按时间抽选的基-2FFT算法将信号从时域转换到频域。Furthermore, in step four, the radix-2FFT algorithm selected by time is used to transform the signal from the time domain to the frequency domain.
本发明的一种基于非接触式磁旋转位置传感器的电机转速测量装置,包括电源模块、主控芯片、磁旋转位置传感器、显示屏和通讯模块,所述的磁旋转位置传感器采用无接触式旋转编码器SC60104,使用其正交A/B输出模式;主控芯片采用AT32F403ACGT7单片机,单片机内部的ADC模块,采集传感器芯片A/B引脚输出的脉冲信号的电压值;电机的转速和转动方向实时地显示在显示屏上,单片机通过RS-485通信接口与上位机或特定的终端机通讯,电源模块使用外接电源或锂电池供电。A motor speed measuring device based on a non-contact magnetic rotation position sensor of the present invention includes a power supply module, a main control chip, a magnetic rotation position sensor, a display screen and a communication module. The magnetic rotation position sensor adopts a non-contact rotation The encoder SC60104 uses its quadrature A/B output mode; the main control chip adopts AT32F403ACGT7 single-chip microcomputer, and the ADC module inside the single-chip microcomputer collects the voltage value of the pulse signal output by the A/B pin of the sensor chip; the speed and direction of the motor are real-time The ground is displayed on the display screen, the single-chip microcomputer communicates with the host computer or a specific terminal through the RS-485 communication interface, and the power module is powered by an external power supply or a lithium battery.
3.有益效果3. Beneficial effect
采用本发明提供的技术方案,与已有的公知技术相比,具有如下显著效果:Compared with the existing known technology, the technical solution provided by the invention has the following remarkable effects:
(1)本发明的一种基于非接触式磁旋转位置传感器的电机转速测量方法,在脉冲信号采集上,摒弃了传统采集脉冲个数的方法,改为采集脉冲信号电压。传统采集脉冲信号个数的方法适用于低分辨率的传感器,精度不高,无法进行软件滤波。本发明采集脉冲信号电压,属于一种模拟量采集方式,可以使用高采样速率,适用高分辨率传感器,精度高。(1) A kind of motor rotational speed measurement method based on non-contact magnetic rotary position sensor of the present invention, on pulse signal acquisition, abandons the method of traditional acquisition pulse number, changes to acquisition pulse signal voltage. The traditional method of collecting the number of pulse signals is suitable for low-resolution sensors, and the accuracy is not high, so software filtering cannot be performed. The invention collects the pulse signal voltage, belongs to an analog quantity collection method, can use a high sampling rate, is suitable for a high-resolution sensor, and has high precision.
(2)鉴于电机在较低转速时,采样精度较低,本发明采用了可变采样频率方法,即实时计算传感器Index引脚的脉冲信号个数,先粗略地计算电机转速值,根据此粗略值选择合适的采样频率,如此,在电机低转速时,自动选择低采样频率,在电机高转速时,自动选择高采样频率。如此,可以在保证信号完整性的前提下,选择合适的采样点数参与后续的FFT运算,从而节约内存开销与加快系统的运行速度。(2) In view of the fact that the sampling accuracy of the motor is low when the motor is at a low speed, the present invention adopts a variable sampling frequency method, that is, real-time calculation of the number of pulse signals of the sensor Index pin, first roughly calculating the motor speed value, and according to this rough Select the appropriate sampling frequency, so that when the motor rotates at low speed, the low sampling frequency is automatically selected, and when the motor rotates at a high speed, the high sampling frequency is automatically selected. In this way, under the premise of ensuring the integrity of the signal, an appropriate number of sampling points can be selected to participate in the subsequent FFT operation, thereby saving memory overhead and speeding up the operating speed of the system.
(3)本发明的一种基于非接触式磁旋转位置传感器的电机转速测量装置,采用无接触式旋转编码器,安装方便,提高了测量效率,使用单片机内部的ADC模块,采集传感器芯片A/B引脚输出的脉冲信号的模拟量电压值,提高了采样速度与精度,使用FFT变换算法,也提高了转速计算的精度。(3) A kind of motor speed measuring device based on non-contact magnetic rotary position sensor of the present invention adopts non-contact rotary encoder, which is easy to install and improves measurement efficiency. The analog voltage value of the pulse signal output by the B pin improves the sampling speed and accuracy, and the FFT transformation algorithm is used to improve the accuracy of the speed calculation.
附图说明Description of drawings
图1为本发明的一种基于非接触式磁旋转位置传感器的电机转速测量装置的硬件结构示意图;Fig. 1 is a kind of hardware structure schematic diagram of the motor speed measuring device based on non-contact magnetic rotary position sensor of the present invention;
图2为本发明的一种基于非接触式磁旋转位置传感器的电机转速测量方法的流程图。FIG. 2 is a flow chart of a method for measuring the rotational speed of a motor based on a non-contact magnetic rotary position sensor according to the present invention.
具体实施方式Detailed ways
为进一步了解本发明的内容,结合附图和实施例对本发明作详细描述。In order to further understand the content of the present invention, the present invention will be described in detail in conjunction with the accompanying drawings and embodiments.
实施例1Example 1
结合图1,本实施例的一种基于非接触式磁旋转位置传感器的电机转速测量装置,包括电源模块、主控芯片、磁旋转位置传感器、显示屏、通讯模块。磁旋转位置传感器,采用无接触式旋转编码器SC60104,此传感器是一个片上系统,在单个芯片内部整合了集成式Hall元件、模拟前端和数据处理功能。芯片提供3种可用的增量输出模式,包括正交A/B输出(正交A/B模式)、LSB输出(步进/方向模式)、脉宽调制输出,正交A/B为其缺省模式。本装置中使用的就是其正交A/B输出模式,不需要进行配置。Referring to FIG. 1 , a motor speed measurement device based on a non-contact magnetic rotational position sensor in this embodiment includes a power module, a main control chip, a magnetic rotational position sensor, a display screen, and a communication module. The magnetic rotary position sensor adopts the non-contact rotary encoder SC60104. This sensor is a system-on-chip, which integrates integrated Hall components, analog front-end and data processing functions in a single chip. The chip provides 3 available incremental output modes, including quadrature A/B output (quadrature A/B mode), LSB output (step/direction mode), pulse width modulation output, and quadrature A/B is its missing province mode. The quadrature A/B output mode used in this device does not need to be configured.
关于磁旋转位置传感器的安装,本实施例将直径为6mm的径向充磁的圆形磁铁安装在非磁性圆形衬套中,然后将衬套固定在电机轴上并保持轴心一致。使磁旋转位置传感器的中心与磁铁中心保持同轴,误差在0.485mm以内。磁铁表面距离传感器表面2mm,此距离可以根据磁铁磁场强度进行适当调整。Regarding the installation of the magnetic rotary position sensor, in this embodiment, a radially magnetized circular magnet with a diameter of 6 mm is installed in a non-magnetic circular bushing, and then the bushing is fixed on the motor shaft to keep the axis center consistent. Keep the center of the magnetic rotary position sensor coaxial with the center of the magnet, and the error is within 0.485mm. The surface of the magnet is 2mm away from the surface of the sensor, and this distance can be properly adjusted according to the magnetic field strength of the magnet.
本实施例可以使用外接电源或锂电池供电,电源转换芯片是RT6150AGQW。该电源芯片是高效、固定频率的Buck-Boost DC/DC转换器,可在输入电压高于、低于或等于输出电压条件下工作。集成在其中的电路拓扑可以各种工作模式进行持续的电压转换工作,使之非常适合于单节锂离子电池、多节碱性电池或镍氢电池供电的场合,解决输出电压位于电池电压区间中的电压转换问题。This embodiment can be powered by an external power supply or a lithium battery, and the power conversion chip is RT6150AGQW. The power chip is a high-efficiency, fixed-frequency Buck-Boost DC/DC converter that can work when the input voltage is higher than, lower than or equal to the output voltage. The circuit topology integrated in it can perform continuous voltage conversion in various working modes, making it very suitable for occasions powered by single-cell lithium-ion batteries, multi-cell alkaline batteries or nickel-metal hydride batteries, and solves the problem that the output voltage is in the battery voltage range voltage conversion problem.
主控芯片采用AT32F403ACGT7单片机,该芯片内部集成了单精度浮点运算单元(FPU)及数字信号处理器(DSP),拥有丰富的片上外设及灵活的时钟控制机制。The main control chip adopts AT32F403ACGT7 single-chip microcomputer, which integrates single-precision floating-point unit (FPU) and digital signal processor (DSP), and has rich on-chip peripherals and flexible clock control mechanism.
为了完成与上位机之间长距离的数据通信,同时满足应用现场稳定可靠的要求。本发明采用RS485通信,并且采用光耦隔离电路实现此功能。RS485芯片型号为MAX13487E,此系列芯片内部含有一个状态机和接收比较器。可以通过配置外部硬件,使芯片实现自动地使能或失能驱动器和接收器来保持总线处于正确的工作状态,从而节约单片机I/O引脚。In order to complete the long-distance data communication with the host computer, and meet the stable and reliable requirements of the application site. The present invention adopts RS485 communication, and adopts optocoupler isolation circuit to realize this function. The RS485 chip model is MAX13487E, and this series of chips contains a state machine and a receiving comparator inside. By configuring the external hardware, the chip can automatically enable or disable the driver and receiver to keep the bus in the correct working state, thereby saving the I/O pins of the microcontroller.
本实施例在脉冲信号采集上,摒弃了传统采集脉冲个数的方法,改为采集脉冲信号电压。传统采集脉冲信号个数的方法适用于低分辨率的传感器(编码器),精度不高,无法进行软件滤波。本实施例采集脉冲信号电压,属于一种模拟量采集方式,可以使用高采样速率,适用高分辨率传感器(编码器),精度高。In this embodiment, the traditional method of collecting the number of pulses is abandoned in collecting the pulse signal, and the voltage of the pulse signal is collected instead. The traditional method of collecting the number of pulse signals is suitable for low-resolution sensors (encoders), the accuracy is not high, and software filtering cannot be performed. This embodiment collects the pulse signal voltage, which belongs to an analog quantity collection method, can use a high sampling rate, is suitable for a high-resolution sensor (encoder), and has high precision.
本实施例使用AT32F403ACGT7单片机内部的ADC模块,采集传感器芯片A/B引脚输出的脉冲信号的电压值。同时,为了提高精度,使用高分辨率的传感器及高采样频率,可以更好地恢复原始信号。而为了更好地分析信号特征,对信号进行时域到频域转换。快速傅里叶(FFT)变换算法计算量小,结合高速硬件能实现对信号的实时处理,性能最佳,本实施例经过快速傅里叶(FFT)变换算法,将时域信号转换为频域信号,再将脉冲的频率值转换为电机的转速。通过判断A/B相位差,辨别出电机转动的方向。电机的转速和转动方向,并实时地显示在本地的OLED显示屏上。也可通过RS-485通信接口上传至上位机或特定的终端机,在通信上采用的是Modbus-RTU协议。In this embodiment, the ADC module inside the AT32F403ACGT7 microcontroller is used to collect the voltage value of the pulse signal output by the A/B pin of the sensor chip. At the same time, in order to improve the accuracy, the use of high-resolution sensors and high sampling frequency can better restore the original signal. In order to better analyze the signal characteristics, the signal is converted from the time domain to the frequency domain. The fast Fourier transform (FFT) algorithm has a small amount of calculation, combined with high-speed hardware, it can realize real-time processing of the signal, and has the best performance. This embodiment converts the time domain signal into a frequency domain through the fast Fourier transform (FFT) algorithm. signal, and then convert the frequency value of the pulse into the rotational speed of the motor. By judging the A/B phase difference, the direction of motor rotation can be identified. The speed and direction of rotation of the motor are displayed on the local OLED display in real time. It can also be uploaded to the host computer or a specific terminal through the RS-485 communication interface, and the Modbus-RTU protocol is used for communication.
实施例2Example 2
结合图2,本实施例的一种基于非接触式磁旋转位置传感器的电机转速测量方法,以非接触式磁旋转位置传感器的A相引脚脉冲信号为例,B相原理相同。首先,单片机的RAM中定义了10K的字内存单元,此10K的字内存单元称为采样缓冲区,用于存储脉冲信号的电压值经AD转换后的采样点数据。本实施例的测量步骤如下:Referring to FIG. 2 , a method for measuring motor speed based on a non-contact magnetic rotational position sensor in this embodiment takes the pulse signal of the A-phase pin of the non-contact magnetic rotational position sensor as an example, and the principle of the B-phase is the same. First of all, 10K word memory unit is defined in the RAM of the single-chip microcomputer. This 10K word memory unit is called a sampling buffer, which is used to store the sampling point data after the voltage value of the pulse signal is converted by AD. The measurement steps of the present embodiment are as follows:
步骤一、使用单片机引脚的中断功能,采集传感器的Index引脚的脉冲信号(此Index引脚输出的脉冲信号是安装在电机轴上的磁铁旋转一圈,即电机旋转一圈,产生一个脉冲信号),记录下两个相邻脉冲的时间间隔ΔT,即电机旋转一圈所用时间,则电机粗略速度值 Step 1. Use the interrupt function of the single-chip microcomputer pin to collect the pulse signal of the Index pin of the sensor (the pulse signal output by the Index pin is the rotation of the magnet installed on the motor shaft, that is, the motor rotates a circle to generate a pulse signal), record the time interval ΔT between two adjacent pulses, that is, the time it takes for the motor to rotate one circle, then the rough speed value of the motor
步骤二、根据非接触式磁旋转位置传感器的特性,磁铁旋转一圈,传感器的A相引脚输出256个脉冲信号,即传感器的分辨率PPR为256。结合步骤一中所得的电机粗略速度值,进一步可以计算得出传感器的A相引脚输出的脉冲频率f=PPR*V。选择合适的采样频率fs,fs大于2倍的传感器的A相引脚输出脉冲频率f。根据选择的采样频率fs,对传感器的A相引脚输出的脉冲信号进行模拟量电压值的采样,并将采样点的数值按照采样时间次序,依次存入采样缓冲区中。Step 2. According to the characteristics of the non-contact magnetic rotary position sensor, when the magnet rotates one circle, the phase A pin of the sensor outputs 256 pulse signals, that is, the resolution PPR of the sensor is 256. Combined with the rough speed value of the motor obtained in step 1, the pulse frequency f=PPR*V output by the A-phase pin of the sensor can be further calculated. Select the appropriate sampling frequency f s , and the A-phase pin of the sensor whose f s is greater than 2 times outputs the pulse frequency f. According to the selected sampling frequency f s , the pulse signal output by the A-phase pin of the sensor is sampled for the analog voltage value, and the values of the sampling points are stored in the sampling buffer in sequence according to the sampling time.
值得说明的是,鉴于电机在较低转速时,采样精度较低,本实施例采用了可变采样频率方法。即在电机低转速时,自动选择低采样频率,在电机高转速时,自动选择高采样频率。如此,可以在保证信号完整性的前提下,选择合适的采样点数参与后续的FFT运算,从而节约内存开销与加快系统的运行速度,并且可以提高低速时的精度。而本实施例的实现原理是,实时计算传感器的Index引脚输出的脉冲信号个数,先粗略地计算电机转速值,根据此粗略值选择合适的采样频率。It is worth noting that, in view of the fact that the sampling accuracy is low when the motor rotates at a low speed, this embodiment adopts a variable sampling frequency method. That is, when the motor rotates at a low speed, a low sampling frequency is automatically selected, and when the motor rotates at a high speed, a high sampling frequency is automatically selected. In this way, under the premise of ensuring the integrity of the signal, an appropriate number of sampling points can be selected to participate in the subsequent FFT operation, thereby saving memory overhead and speeding up the running speed of the system, and can improve the accuracy at low speed. The implementation principle of this embodiment is to calculate the number of pulse signals output by the Index pin of the sensor in real time, first roughly calculate the motor speed value, and select an appropriate sampling frequency according to this rough value.
安装在电机轴上的磁铁,每旋转一圈传感器的Index引脚会输出一个脉冲信号。利用AT32F403ACGT7单片机的中断功能采集此Index脉冲信号,再记录下两个相邻脉冲信号的时间间隔,即电机旋转一圈所用时间,可以简单的粗略计算电机速度,该方法简单却非常具有实用性。The magnet installed on the motor shaft, the Index pin of the sensor will output a pulse signal every time it rotates one circle. Use the interrupt function of the AT32F403ACGT7 single-chip microcomputer to collect the Index pulse signal, and then record the time interval between two adjacent pulse signals, that is, the time taken by the motor to rotate a circle, and the motor speed can be simply and roughly calculated. This method is simple but very practical.
步骤三、实时处理传感器的A相引脚输出脉冲信号的采样的数据,此处的数据是以fs采样频率所采集到的传感器A相引脚输出的脉冲信号电压值,即从采样缓冲区中,从存储新采样点数值的位置处,向之前已经存入缓冲区中的数值里选取2048个采样点数值,进行限幅滤波,去除一些不可信的采样点数据,可以更好地还原信号,保证信号的连续性和完整性。Step 3, real-time processing of the sampled data of the A-phase pin output pulse signal of the sensor, the data here is the pulse signal voltage value of the sensor A-phase pin output collected by f s sampling frequency, that is, from the sampling buffer , from the position where the value of the new sampling point is stored, select 2048 sampling point values from the value that has been stored in the buffer before, and perform limiting filtering to remove some unreliable sampling point data, which can better restore the signal , to ensure the continuity and integrity of the signal.
步骤四、对选取的2048个采样点的数值进行FFT变换,将信号从时域变换到频域。快速傅里叶变换是求解离散傅里叶变换(DFT)的另一种方法,FFT算法分类包括:时间抽取法(DIT)和频率抽取法(DIF)。本实施例选用按时间抽选的基-2FFT算法。Step 4: Perform FFT transformation on the values of the selected 2048 sampling points to transform the signal from the time domain to the frequency domain. Fast Fourier transform is another method to solve discrete Fourier transform (DFT). FFT algorithm classification includes: time decimation method (DIT) and frequency decimation method (DIF). In this embodiment, the radix-2FFT algorithm selected by time is selected.
对于FFT变换结果进行复数求模值运算,求出各点的幅值,并选出幅值最大的点的序列n。脉冲信号是矩形波,也称为方波,对于方波而言,是由无限个正弦波叠加而成,其中第一个幅值最高的就是方波的频率,也就是传感器A相引脚的脉冲信号频率F。传感器A相引脚的脉冲信号频率F的计算公式为:其中fs是已知的采样频率,n是幅值最大点的序列数,N为已知的参与变换运算选取的采样点数。For the FFT transformation result, the complex number modulo operation is performed to obtain the amplitude of each point, and the sequence n of the point with the largest amplitude is selected. The pulse signal is a rectangular wave, also known as a square wave. For a square wave, it is formed by the superposition of infinite sine waves, and the first one with the highest amplitude is the frequency of the square wave, that is, the frequency of the A phase pin of the sensor. Pulse signal frequency F. The calculation formula of the pulse signal frequency F of the sensor A phase pin is: Where f s is the known sampling frequency, n is the sequence number of the point with the maximum amplitude, and N is the known number of sampling points selected to participate in the transformation operation.
步骤五、根据计算得到的传感器A相引脚的脉冲信号频率F,进行速度换算,换算公式为其中速度V'的单位是RPS(转/每秒),F是传感器A相引脚的脉冲信号频率,PPR是传感器的分辨率,本实施例中传感器的分辨率PPR是256。Step 5. Perform speed conversion according to the calculated frequency F of the pulse signal of the A phase pin of the sensor. The conversion formula is Wherein the unit of the speed V' is RPS (rotation per second), F is the pulse signal frequency of the A phase pin of the sensor, and PPR is the resolution of the sensor, and the resolution PPR of the sensor in this embodiment is 256.
如果要将速度单位换算为RPM,则需V=60*V',即此速度值是精度较高的电机转速值。If you want to convert the speed unit to RPM, you need V=60*V', that is This speed value is the motor speed value with high precision.
采样点经过FFT变换后,可以得到相应的频率点幅值的实部和虚部。相位的计算公式如下:After the sampling point is transformed by FFT, the real part and the imaginary part of the amplitude of the corresponding frequency point can be obtained. The phase calculation formula is as follows:
Pn=atan 2(b,a)P n =atan 2(b,a)
式中:Pn为相位弧度值,rad;a为频率点实部;b为频率点虚部。将幅值最大点的实部与虚部带入上述公式,即可求得相对应的A/B相的相位角。In the formula: P n is the radian value of the phase, rad; a is the real part of the frequency point; b is the imaginary part of the frequency point. Bring the real part and imaginary part of the maximum amplitude point into the above formula, and the corresponding phase angle of A/B phase can be obtained.
上述公式计算得出的相位值单位为弧度rad,需要换算为角度值,换算公式如下:The unit of the phase value calculated by the above formula is radian rad, which needs to be converted into an angle value. The conversion formula is as follows:
式中:θn为相位角度值,°;Pn为相位弧度值,rad。In the formula: θ n is the phase angle value, °; P n is the phase radian value, rad.
电机转动方向判断公式如下:The motor rotation direction judgment formula is as follows:
Δθ=θA-θB Δθ=θ A -θ B
式中:Δθ为相位差,°;θA为相位角度值,°;θB为相位角度值,°。Where: Δθ is the phase difference, °; θ A is the phase angle value, °; θ B is the phase angle value, °.
当Δθ=90°时,即A通道的相位超前B通道的相位角度90°,电机(磁体)顺时针旋转;当Δθ=-90°时,即B通道的相位超前于A通道的相位90°,电机逆时针方向旋转。When Δθ=90°, that is, the phase of channel A leads the phase angle of channel B by 90°, and the motor (magnet) rotates clockwise; when Δθ=-90°, that is, the phase of channel B leads the phase of channel A by 90° , the motor rotates counterclockwise.
以上示意性的对本发明及其实施方式进行了描述,该描述没有限制性,附图中所示的也只是本发明的实施方式之一,实际的结构并不局限于此。所以,如果本领域的普通技术人员受其启示,在不脱离本发明创造宗旨的情况下,不经创造性的设计出与该技术方案相似的结构方式及实施例,均应属于本发明的保护范围。The above schematically describes the present invention and its implementation, which is not restrictive, and what is shown in the drawings is only one of the implementations of the present invention, and the actual structure is not limited thereto. Therefore, if a person of ordinary skill in the art is inspired by it, without departing from the inventive concept of the present invention, without creatively designing a structural mode and embodiment similar to the technical solution, it shall all belong to the protection scope of the present invention .
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310369208.XA CN116298369A (en) | 2023-04-04 | 2023-04-04 | Device and method for measuring motor speed based on non-contact magnetic rotary position sensor |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310369208.XA CN116298369A (en) | 2023-04-04 | 2023-04-04 | Device and method for measuring motor speed based on non-contact magnetic rotary position sensor |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116298369A true CN116298369A (en) | 2023-06-23 |
Family
ID=86792627
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310369208.XA Pending CN116298369A (en) | 2023-04-04 | 2023-04-04 | Device and method for measuring motor speed based on non-contact magnetic rotary position sensor |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116298369A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117686731A (en) * | 2024-02-04 | 2024-03-12 | 南京凯奥思数据技术有限公司 | Rotary machine rotating speed calculation method and system based on recognition signal boundary threshold |
DK202300318A1 (en) * | 2023-04-12 | 2024-10-30 | Ewa Sensors Aps | System and Method for Detection of Rotational Direction |
-
2023
- 2023-04-04 CN CN202310369208.XA patent/CN116298369A/en active Pending
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
DK202300318A1 (en) * | 2023-04-12 | 2024-10-30 | Ewa Sensors Aps | System and Method for Detection of Rotational Direction |
DK181718B1 (en) * | 2023-04-12 | 2024-10-31 | Ewa Sensors Aps | System and method for detecting direction of rotation |
CN117686731A (en) * | 2024-02-04 | 2024-03-12 | 南京凯奥思数据技术有限公司 | Rotary machine rotating speed calculation method and system based on recognition signal boundary threshold |
CN117686731B (en) * | 2024-02-04 | 2024-04-26 | 南京凯奥思数据技术有限公司 | Rotary machine rotating speed calculation method and system based on recognition signal boundary threshold |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN116298369A (en) | Device and method for measuring motor speed based on non-contact magnetic rotary position sensor | |
CN101266284A (en) | Switch reluctance machine rotor angular position and rotation speed detection device and method | |
CN201018440Y (en) | Angular position and rotary speed testing apparatus of switch reluctance motor rotor | |
CN103048486B (en) | Device and method for measuring rotation speeds and positions of rotors of birotor permanent magnet wind-driven generator | |
CN202334412U (en) | Brushless DC motor control system | |
CN103872851B (en) | The rotating speed of electric rotating machine and displacement measurement system | |
CN101729002A (en) | SOPC-based remote monitoring system of no-position sensor brushless DC motor | |
CN205051618U (en) | Electric motor controller of electric automobile | |
CN102759707A (en) | Dynamic characteristic testing instrument | |
CN107659224A (en) | The device and method of rotary transformer axes-angle conversion based on square wave excitation signal | |
CN103368496A (en) | Frequency converter M/T velocity-measuring system and method based on DSP (Digital Signal Processor) | |
CN110940361A (en) | A Magnetic Sensitive Multi-Turn Absolute Encoder | |
CN205156949U (en) | Aerogenerator fault detection device | |
CN103439657B (en) | AC servo motor transmission parameter detection method and the application in fault detect thereof | |
CN210775540U (en) | Diagnosis and collection device for rotating equipment | |
CN101694980A (en) | Control device and operating method of bicycle switched reluctance motor | |
CN209820546U (en) | Antimagnetic metering device | |
CN205301352U (en) | Speed meter for hall sensor | |
CN201523350U (en) | A switch reluctance motor control device for an electric vehicle | |
CN104536461A (en) | Magnetic encoder for wind power yaw controller | |
CN204314324U (en) | A kind of low cost motor speed detect circuit | |
CN203422633U (en) | Multi-signal acquisition velocity measurement and reverse rotation protection control device | |
CN102486383A (en) | An Electrically Retentive Multi-turn Absolute Encoder | |
CN217037076U (en) | Square wave brushless direct current wind power generation system | |
CN206531869U (en) | A kind of automobile engine speed measuring device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |